J. Gardner                                             LaTeX Quick Reference                         http://dataninja.wordpress.com

                                               Verbatim                                        can use multiple file types – eps, pdf, jpg,
           Basic Commands                      begin{verbatim}                                  png
                                               ...                                             same rules for referencing and positioning
Notes                                          end{verbatim}
 = line break                                                                                  as table environment
                                               use for typesetting code
bigskip, medskip, smallskip to increase     use verb+stuff here+ for inline verbatim       Footnote
   size of line break                            environment (any delimiter works)             Normal textfootnote{Contents}.
hangindent=.5in before a paragraph forces                                                     thanks{text} can be used to insert
   a hanging indent                            Verse                                             attribution footnote with * at beginning
% = comment                                    begin{verse}
run LaTeX twice if any references,             First line                                    Theorem
                                               Second line                                   newthoerem{name}[counter]{text}
   citations or tables of contents are used.                                                   [section]
                                               end{verse}
Preamble                                       lines have hanging indents                      begin{name}{text}
usepackage[margin=1in]{geometry} for                                                          ...
  tree-saving margins                          Quote                                           end{name}
                                               begin{quote}                                   “text” is what gets printed, “name” is the
usepackage{setspace} doublespacing for       ...
  double-spaced documents                                                                        reference
                                               end{quote}                                     Use newtheorem*{…} for unnumbered
Document template                              Table                                           Precede newtheorem with
documentclass{article}                        begin{table}[htbp]                               theoremstyle{plain, remark, …}
usepackage[options]{packagename               begin{center}                                  Requires usepackage{amsthm}
}                                              begin{tabular}{ccc}
author{Name}                                  0 & 0 & 0                                                        Math
title{Title}                                  0 & 0 & 0
date{Date}                                    end{tabular}                                   Inline formula
begin{document}                               caption{default}                               $x+y$
maketitle                                     end{center}
...                                                                                            Display formulas
                                               label{defaulttable}                            [x+y]
end{document}                                 end{table}
Document structure                             multicolumn{3}{c}{Column Header}               Equation environment
section{Name}                                 begin{tabular}{|llr|} to put vertical lines    begin{equation}
subsection{Name}                                on either side and to make the first          x=y
                                                                                               label{whatever}
subsubsection{Name}                             columns left-aligned and the thirds right-
paragraph{Name}                                                                               end{equation}
                                                 aligned
subparagraph{Name}                            use hline to make a horizontal line            Equation array environment
section*{Name} suppresses numbering           [htbp] specifies position preferences – h:      begin{eqnarray}
tableofcontents generates the TOC               here; t:top; b:bottom; p: special page for    a&=&b+c
                                                 just float objects – in order specified       d&=&e+f
Font styles                                                                                    label{whatever}
bold: textbf{stuff}                           use ref{defaulttable} to reference the table
                                               use p{2in} to create a paragraph columns        end{eqnarray}
italic: emph{stuff}                                                                           aligns equations at = signs
typewriter: texttt{stuff}                     use [3pt] to adjust spacing between rows
                                                                                               nonumber suppresses number on specified
Cite                                           Longtable                                         line
cite{cite-key}                                begin{longtable}{lrr}
                                               caption{text}                                Key mathematical symbols
works with BibTeX and thebibliography                                                         superscript: x^2; subscript: x_2
                                               1 & 2 
Quick bibliography                             endhead                                        fraction: frac{x}{y} = x/y
begin{thebibliography}{99}                    3 & 4                                         Greek letters: alpha, beta, gamma, etc.
bibitem{cite-key} Citation.                   label{text}                                    decorations: hat{x}, bar{x}, tilde{x},
end{thebibliography}                          end{longtable}                                   vec{a}. dot{a}, stackrel{a}{b} puts a
                                               Use for multipage tables                          over b
BibTeX bibliography                            Requires usepackage{longtable}
bibliographystyle{plain}                                                                      rightarrow, leftarrow, Rightarrow
bibliography{database}                        Automatically centered and positioned             (double arrow), Leftrightarrow
database is a .bib file stored externally      Text before endhead is repeated across         leq less than or equal to, geq
plain, unsrt, abbrev are default                pagebreaks                                     fences: left(, right), left[, etc.
  bibliography styles                          Graphics                                        Matrix
                                               begin{figure}[htbp]                            left[begin{array}{ccc}
             Environments                      begin{center}                                  a&b&c
                                               includegraphics{Graphic.pdf}                   d&e&f
Lists                                          caption{example caption}
begin{itemize}                                                                                end{array}right]
                                               label{fig:example}
item Thing
                                               end{center}
end{itemize}
                                               end{figure}
produces a bulleted list                       requires graphicx package
use begin{enumerate} for a numbered list

Latex cheat sheet

  • 1.
    J. Gardner LaTeX Quick Reference http://dataninja.wordpress.com Verbatim can use multiple file types – eps, pdf, jpg, Basic Commands begin{verbatim} png ... same rules for referencing and positioning Notes end{verbatim} = line break as table environment use for typesetting code bigskip, medskip, smallskip to increase use verb+stuff here+ for inline verbatim Footnote size of line break environment (any delimiter works) Normal textfootnote{Contents}. hangindent=.5in before a paragraph forces thanks{text} can be used to insert a hanging indent Verse attribution footnote with * at beginning % = comment begin{verse} run LaTeX twice if any references, First line Theorem Second line newthoerem{name}[counter]{text} citations or tables of contents are used. [section] end{verse} Preamble lines have hanging indents begin{name}{text} usepackage[margin=1in]{geometry} for ... tree-saving margins Quote end{name} begin{quote} “text” is what gets printed, “name” is the usepackage{setspace} doublespacing for ... double-spaced documents reference end{quote} Use newtheorem*{…} for unnumbered Document template Table Precede newtheorem with documentclass{article} begin{table}[htbp] theoremstyle{plain, remark, …} usepackage[options]{packagename begin{center} Requires usepackage{amsthm} } begin{tabular}{ccc} author{Name} 0 & 0 & 0 Math title{Title} 0 & 0 & 0 date{Date} end{tabular} Inline formula begin{document} caption{default} $x+y$ maketitle end{center} ... Display formulas label{defaulttable} [x+y] end{document} end{table} Document structure multicolumn{3}{c}{Column Header} Equation environment section{Name} begin{tabular}{|llr|} to put vertical lines begin{equation} subsection{Name} on either side and to make the first x=y label{whatever} subsubsection{Name} columns left-aligned and the thirds right- paragraph{Name} end{equation} aligned subparagraph{Name} use hline to make a horizontal line Equation array environment section*{Name} suppresses numbering [htbp] specifies position preferences – h: begin{eqnarray} tableofcontents generates the TOC here; t:top; b:bottom; p: special page for a&=&b+c just float objects – in order specified d&=&e+f Font styles label{whatever} bold: textbf{stuff} use ref{defaulttable} to reference the table use p{2in} to create a paragraph columns end{eqnarray} italic: emph{stuff} aligns equations at = signs typewriter: texttt{stuff} use [3pt] to adjust spacing between rows nonumber suppresses number on specified Cite Longtable line cite{cite-key} begin{longtable}{lrr} caption{text} Key mathematical symbols works with BibTeX and thebibliography superscript: x^2; subscript: x_2 1 & 2 Quick bibliography endhead fraction: frac{x}{y} = x/y begin{thebibliography}{99} 3 & 4 Greek letters: alpha, beta, gamma, etc. bibitem{cite-key} Citation. label{text} decorations: hat{x}, bar{x}, tilde{x}, end{thebibliography} end{longtable} vec{a}. dot{a}, stackrel{a}{b} puts a Use for multipage tables over b BibTeX bibliography Requires usepackage{longtable} bibliographystyle{plain} rightarrow, leftarrow, Rightarrow bibliography{database} Automatically centered and positioned (double arrow), Leftrightarrow database is a .bib file stored externally Text before endhead is repeated across leq less than or equal to, geq plain, unsrt, abbrev are default pagebreaks fences: left(, right), left[, etc. bibliography styles Graphics Matrix begin{figure}[htbp] left[begin{array}{ccc} Environments begin{center} a&b&c includegraphics{Graphic.pdf} d&e&f Lists caption{example caption} begin{itemize} end{array}right] label{fig:example} item Thing end{center} end{itemize} end{figure} produces a bulleted list requires graphicx package use begin{enumerate} for a numbered list