LaTeX cheat sheet

Here's my LaTeX cheat sheet.

Contents:

  1. Links
  2. Documents
  3. Text and blocks
  4. Formatting
  5. References
  6. Math
  7. Theorems, lemmas, proofs, ...
  8. Mathpartir
  9. Mitch's Math Macros

Links

Like my Emacs cheat sheet--this is less a comprehensive cheat sheet and more a list of things I keep looking up.

Back to the top


Documents

Basic article:

\documentclass{article}
\author{Will Guaraldi}
\title{Some title}

\begin{document}
\maketitle
\tableofcontents % if needed

\section{Section 1}

\section{Section 2}

\end{document}

Back to the top


Text and blocks

  \ldots            ...
  \\ or \newline    newline
  \mbox{text}       keeps words together
  \footnote{text}   creates a footnote
  \begin{quote}     creates a quote
    ...
  \end{quote}
  \verb|text|       verbatim text
  \begin{verbatim}  verbatim text
    ...
  \end{verbatim}

  \indent           indents a paragraph
  \noindent         doesn't indent a paragraph

Back to the top


Formatting

  \underline{text}
  \emph{text}

Lists and descriptions

  \begin{enumerate}
    \item text
  \end{enumerate}

  \begin{itemize}
    \item text
  \end{itemize}

  \begin{description}
    \item[name] text
  \end{description

Back to the top


References

  \label{marker}     creates a marker
  \ref{marker}       section number of marker
  \pageref{marker}   page number of marker

Back to the top


Math

  $ ... $            math
  $$ ... $$          displaymath
  \begin{equation}   equations
    ...
  \end{equation}

  \, \: \; \  \quad \qquad   all spaces

  \begin{eqnarray}
    ... & = & ... \\
    ... & = & ... \\
  \end{eqnarray}

  \nonumber\\   will make sure there's no number at the end of the line

Back to the top


Theorems, lemmas, proofs, ...

  \theoremstyle{definition}
  \newtheorem{name-keyword}[counter]{name-of-theorem}[section]
  
  then later...

  \begin{name-keyword}
    theorem here
  \end{name-keyword

  then the proof...

  \begin{proof}
    ...
  \end{proof}

Back to the top


mathpartir

See http://www.ccs.neu.edu/course/csg264/latex/mathpartir/mathpartir.ps for full documentation.

  \inferrule{premise}{conclusion}   it uses \\ to break premisses

Example:

  \begin{mathpar}
    \inferrule
      {some premise\\
       second premise}
      {conclusion}
    \and
    \inferrule
      {some premise}
      {conclusion}
  \end{mathpar}

Back to the top


mmm (Mitch's Math Macros)

This is better explained in the mmm.sty package file.

  \til       tilde
  \bs        backslash
  \hash      hash
  \hasht     #t
  \hashf     #f
  \lbr       left brace
  \rbr       right brace
  \ttvert    vertical line


  \rmop{text}
  \itop{text}
  \bfop{text}
  \ttop{text}
  \itord{text}
  \rmord{text}
  \bford{text}
  \ttord{text}

  then there are "new" versions of \rmop through \ttord.

  \a \b \g \r \l \m \G \s \t \z    greek letters abbreviated

  \newmeta    creates a new metavariable with subscripts
              example: \newmeta\exp{\itop{e}}
              use as:  \exp0, \exp1, \exp2, \exp{}


  \setof{item \alt item}    item such that item such that ...

  \semfcn{operator}{argument}

  \newdom      declares a new domain

  \car \cdr \cons

  \block{text}  for block structure and indented formulas

  \nt{text}    non-terminal?
  \term{text}  terminal

  $$
  \begin{grammar}
    $ lhs $ & $ rhs $ & commentary
  \end{grammar}
  $$

  \begin{tdisplay}[name]      creates a titled displaymath environment
    ..
  \end{tdisplay}

Back to the top