1
1

Compare commits

...

10 Commits

6 changed files with 174 additions and 27 deletions

View File

@ -25,15 +25,6 @@ paperheight=9in,
\definecolor{darkred}{rgb}{0.5,0.0,0.0}
\definecolor{lightgray}{gray}{0.75}
% we want some hypertext stuff please
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
urlcolor=darkblue,
citecolor=darkred,
linkcolor=darkgreen,
}
% switch to a different font
\usepackage{fouriernc}
@ -68,9 +59,22 @@ linkcolor=darkgreen,
\usepackage{lipsum}
\usepackage{blindtext}
% a silly abbreviated I needed to import something
% smarter cross-references that include automatic page-references
\usepackage{varioref}
% a silly abbreviation I needed to import an example
\newcommand{\f}{\bfseries}
% we want some hypertext stuff please
% IMPORTANT: !always load hyperref last!
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
urlcolor=darkblue,
citecolor=darkred,
linkcolor=darkgreen,
}
% alright, now we start the actual book :-)
\title{\textbf{The Typography of History}\\
Lecture Notes for AS.987.123}
@ -83,8 +87,7 @@ phf@cs.jhu.edu}
\maketitle
\chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface}
\chapter{Preface}
\lipsum[1]
@ -108,6 +111,7 @@ please \cite{Conway2000,Meyer2000,Huetal2000,LaTeXe,lshort,Gill}.
On the other hand, we'd prefer to do some
serious Algebraic Topology\index{Algebraic Topology}\index{Topology!Algebraic}
instead of Category Theory\index{Category Theory} to figure this out.
See Figure~\vref{plot}.
\section{A Journey of Doom}
\lipsum[1-4]
@ -175,8 +179,11 @@ Level &
\centering
\includegraphics[width=\textwidth]{plot}
\caption{Something silly PyLab plotted for us}
\label{plot}
\end{figure}
\lipsum[3-8]
\lipsum[3]
Also shown in Figure~\vref{plot} of course.
\lipsum[4-8]
\chapter[Democracy of the Masters]{Democracy of the\\Masters}
\lipsum[1-10]
@ -194,21 +201,22 @@ Level &
\backmatter
\newpage
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{04-lecture-notes}{}
% plain is [2] and full author name, abbrv shortens author
% alpha is [Kan02], common in CS books
% apalike is [Brooks et al., 2010]
\bibliographystyle{plain}
%\bibliographystyle{abbrv}
%\bibliographystyle{alpha}
%\bibliographystyle{apalike}
\chapter*{Colophone}
\addcontentsline{toc}{chapter}{Colophone}
\lipsum[2]
\clearpage
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\printindex
\cleardoublepage
\chapter{Colophone}
\lipsum[2]
\end{document}

77
40-lambda.tex Normal file
View File

@ -0,0 +1,77 @@
\RequirePackage[l2tabu,orthodox]{nag}
\RequirePackage{fixltx2e}
\documentclass[a4paper,12pt]{article}
\usepackage{fourier}
\usepackage{empheq}
\title{\textbf{Lambdas Everywhere}}
\author{Peter H.\ Fr{\"o}hlich\\
phf@acm.org}
\begin{document}
\maketitle
\begin{abstract}
Tries to show how you can \(\lambda\) it up.
Sorry, this is nowhere near complete,
but I don't have time for more right now.
\end{abstract}
\section*{Problem 1}
You can state short fragments like \(S \equiv \lambda nab.a(nab)\) in the text
itself.
Or you can typeset them more prominently as follows:
\[
S \equiv \lambda nab.a(nab)
\]
If need be, you can even number your equations:
\begin{equation}
S \equiv \lambda nab.a(nab)
\label{Slambda}
\end{equation}
Then you can later refer to equation (\ref{Slambda}) and impress your friends
with your \LaTeX{} power.
Got a \emph{really} important result? Frame it!
\begin{empheq}[box=\fbox]{equation}
S \equiv \lambda nab.a(nab)
\end{empheq}
That's about it for just plain \(\lambda\) expressions.
\section*{Problem 2}
One of \emph{many} ways to typeset a derivation.
Note the use of ``\(\equiv\)'' for steps that just rename things versus the use
of ``\(\to\)'' for reductions.
%
\begin{align*}
S3
\equiv {} & (\lambda nab.a(nab)) 3 \\
\equiv {} & (\lambda nab.a(nab)) (\lambda sz.s(s(s(z)))) \\
\to {} & \lambda ab.a((\lambda sz.s(s(s(z))))ab) \\
\to {} & \lambda ab.a((\lambda z.a(a(a(z))))b) \\
\to {} & \lambda ab.a(a(a(a(b)))) \\
\equiv {} & \lambda sz.s(s(s(s(z)))) \\
\equiv {} & 4
\end{align*}
%
If you want to be even clearer, underline the redexes for reductions and use a
fancy font for abbreviations:
%
\begin{align*}
\textsf{S3}
\equiv {} & (\lambda nab.a(nab)) \textsf{3} \\
\equiv {} & (\lambda \underline{n}ab.a(nab)) \underline{(\lambda sz.s(s(s(z))))} \\
\to {} & \lambda ab.a((\lambda \underline{s}z.s(s(s(z))))\underline{a}b) \\
\to {} & \lambda ab.a((\lambda \underline{z}.a(a(a(z))))\underline{b}) \\
\to {} & \lambda ab.a(a(a(a(b)))) \\
\equiv {} & \lambda sz.s(s(s(s(z)))) \\
\equiv {} & \textsf{4}
\end{align*}
%
And we're done for now.
\end{document}

View File

@ -1,5 +1,23 @@
all:
echo "Not implemented. :-/"
TEX=pdflatex
BIBTEX=bibtex
INDEX=makeindex
all: 04-lecture-notes.pdf
# This does a little more work than strictly necessary, but for regular-sized
# documents you probably won't notice on today's machines...
04-lecture-notes.pdf: 04-lecture-notes.tex 04-lecture-notes.bib plot.pdf
$(TEX) $<
while ($(BIBTEX) $(basename $<) ; \
$(INDEX) $(basename $<) ; \
$(TEX) $< ; \
grep -q "Rerun to get cross-references" $(basename $<).log ) do true ; \
done
plot.pdf: plot.py
python $^
.PHONY: clean
clean:
rm -rf *.aux *.log *.toc *.lof *.nav *.out *.snm *.lot *.pdf *.bbl *.blg *.dvi *.idx *.ilg *.ind
rm -rf *.aux *.log *.toc *.lof *.nav *.out *.snm *.lot *.pdf *.bbl \
*.blg *.dvi *.idx *.ilg *.ind

View File

@ -8,6 +8,50 @@ at times!
Still, if you're willing to learn, you'll be rewarded
with almost limitless typographic beauty.
## Contents
- **01-minimal-document.tex** is just about the
shortest thing that will compile
- **02-basic-article.tex** shows something more
complete; minimal knowledge for a rough term
paper I would guess
- **03-fancier-article.tex** uses some packages
to make things look nicer, shows off a basic
bibliography; what you'd really want for a
moderately decent term paper
- **04-lecture-notes.tex** and **04-lecture-notes.bib**
shows off a more complex document (lecture notes for
a fictitious course) and messes with lots of things
including chapter headings; shows how an index and an
external bibliography can be used; also shows off
cross-references in the document
- **05-color-test.tex** and **jhcolors.sty**
demonstrates how to hack a custom style file
- **26-epigrams.tex** is just another example
for laying out a document, a famous one in
this case
- **50-tikz-rs-latch.tex** has a *very* simple
TikZ example for drawing a basic circuit
- **99-basic-presentation.tex** shows how to put
together a simple presentation using beamer
## History
I wrote most of this stuff for a talk I gave to the
Johns Hopkins ACM chapter on 2015/02/12.
I didn't get through all the material, never touched
writing your own .sty files for example.
Let's see if I reprise the talk more frequently now,
the last time I recall giving a similar talk was in
2007 or so. Yikes!
## License
This work is licensed under a Creative Commons