DOKK Library

LATEX 2ε Cheat Sheet

Authors Winston Chang

License CC-BY-NC-SA-3.0

Plaintext
             LATEX 2ε Cheat Sheet                                    Lists                                                                    Justification
                                                                     \begin{enumerate} Numbered list.                                         Environment                     Declaration
                                                                     \begin{itemize}    Bulleted list.                                        \begin{center}                  \centering
Document classes                                                     \begin{description}Description list.                                     \begin{flushleft}               \raggedright
book       Default is two-sided.
                                                                     \item text         Add an item.                                          \begin{flushright}              \raggedleft
report     No \part divisions.
                                                                     \item[x ] text     Use x instead of normal bullet or number. Re-
article No \part or \chapter divisions.                                                                                                       Miscellaneous
                                                                                        quired for descriptions.
letter     Letter (?).
slides     Large sans-serif font.                                    References                                                               \linespread{x} changes the line spacing by the multiplier x.
Used at the very beginning of a document: \documentclass{class}.     \label{marker }   Set a marker for cross-reference, often of the form
Use \begin{document} to start contents and \end{document} to end                       \label{sec:item}.                                      Text-mode symbols
the document.                                                        \ref{marker }     Give section/body number of marker.                    Symbols
                                                                     \pageref{marker } Give page number of marker.
Common documentclass options                                         \footnote{text} Print footnote at bottom of page.                        &    \&             \_          ...    \ldots           •        \textbullet
10pt/11pt/12pt       Font size.                                                                                                               $    \$       ˆ     \^{}        |      \textbar         \        \textbackslash
letterpaper/a4paper  Paper size.                                     Floating bodies                                                          %    \%       ˜     \~{}        #      \#               §        \S
twocolumn            Use two columns.                                \begin{table}[place]        Add numbered table.
twoside              Set margins for two-sided.                      \begin{figure}[place] Add numbered figure.                               Accents
landscape            Landscape orientation. Must use dvips -t        \begin{equation}[place] Add numbered equation.                           ò   \‘o      ó   \’o     ô   \^o        õ   \~o         ō   \=o
                     landscape.                                      \caption{text}              Caption for the body.                        ȯ   \.o      ö   \"o     o̧   \c o       ǒ   \v o        ő   \H o
draft                Double-space lines.                             The place is a list valid placements for the body. t=top, h=here,        ç   \c c     o.   \d o    o    \b o       o
                                                                                                                                                                                         o   \t oo       œ    \oe
                                                                                                                                                                         ¯
Usage: \documentclass[opt,opt]{class}.                               b=bottom, p=separate page, !=place even if ugly. Captions and            Œ    \OE      æ    \ae     Æ    \AE        å   \aa         Å   \AA
                                                                     label markers should be within the environment.                          ø    \o       Ø    \O      l    \l         L    \L          ı    \i
Packages                                                                                                                                          \j       ¡    ~‘      ¿    ?‘
fullpage Use 1 inch margins.                                         Text properties
anysize Set margins: \marginsize{l}{r }{t}{b}.                                                                                                Delimiters
multicol Use n columns: \begin{multicols}{n}.
                                                                     Font face                                                                ‘‘     “ ‘‘        { \{    [[         ((   < \textless
                                                                     Command             Declaration      Effect                              ’’     ” ’’        } \}    ]]         ))   > \textgreater
latexsym Use LATEX symbol font.
                                                                     \textrm{text}       {\rmfamily text} Roman family
graphicx Show image: \includegraphics[width=x ]{file}.
url      Insert URL: \url{http://. . . }.
                                                                     \textsf{text}       {\sffamily text} Sans serif family                   Dashes
                                                                     \texttt{text}       {\ttfamily text} Typewriter family                   Name          Source       Example               Usage
Use before \begin{document}. Usage: \usepackage{package}
                                                                     \textmd{text}       {\mdseries text} Medium series                       hyphen        -            X-ray                 In words.
Title                                                                \textbf{text}       {\bfseries text} Bold series                         en-dash       --           1–5                   Between numbers.
\author{text} Author of document.                                    \textup{text}       {\upshape text}  Upright shape                       em-dash       ---          Yes—or no?            Punctuation.
\title{text} Title of document.                                      \textit{text}       {\itshape text}  Italic shape
\date{text}   Date.                                                  \textsl{text}       {\slshape text}  Slanted shape                       Line and page breaks
These commands go before \begin{document}. The declaration           \textsc{text}       {\scshape text}  Small Caps shape                    \\                Begin new line without new paragraph.
\maketitle goes at the top of the document.                          \emph{text}         {\em text}       Emphasized                          \\*               Prohibit pagebreak after linebreak.
                                                                     \textnormal{text}{\normalfont text}Document font                         \kill             Don’t print current line.
Miscellaneous                                                        \underline{text}                     Underline                           \pagebreak        Start new page.
\pagestyle{empty} Empty header, footer and no page numbers.          The command (tttt) form handles spacing better than the                  \noindent         Do not indent current line.
\tableofcontents Add a table of contents here.                       declaration (tttt) form.
Document structure                                                                                                                            Miscellaneous
                                                                     Font size                                                                \today      March 28, 2017.
\part{title}
\chapter{title}
                                   \subsubsection{title}
                                   \paragraph{title}
                                                                     \tiny         tiny                  \Large   Large                       $\sim$      Prints ∼ instead of \~{}, which makes ˜.
\section{title}                    \subparagraph{title}
                                                                     \scriptsize scriptsize
                                                                     \footnotesize footnotesize
                                                                                                         \LARGE   LARGE                       ~
                                                                                                                                              \@.
                                                                                                                                                          Space, disallow linebreak (W.J.~Clinton).
                                                                                                                                                          Indicate that the . ends a sentence when following an
\subsection{title}
Use \setcounter{secnumdepth}{x} suppresses heading numbers of
                                                                     \small        small
                                                                     \normalsize normalsize
                                                                                                         \huge    huge                                    uppercase letter.
                                                                                                                                              \hspace{l} Horizontal space of length l (Ex: l = 20pt).
depth > x, where chapter has depth 0. Use a *, as in
\section*{title}, to not number a particular item—these items will
also not appear in the table of contents.
                                                                     \large        large                  \Huge   Huge
                                                                     These are declarations and should be used in the form {\small . . . },
                                                                                                                                              \vspace{l} Vertical space of length l.
                                                                                                                                              \rule{w}{h} Line of width w and height h.
                                                                     or without braces to affect the entire document.                         Tabular environments
Text environments
\begin{comment}  Comment (not printed). Requires verbatim pack-      Verbatim text                                                            tabbing environment
                 age.                                                \begin{verbatim} Verbatim environment.
\begin{quote}    Indented quotation block.                           \begin{verbatim*} Spaces are shown as .                                  \= Set tab stop.          \> Go to tab stop.
\begin{quotation}Like quote with indented paragraphs.                \verb!text!       Text between the delimiting characters (in this        Tab stops can be set on “invisible” lines with \kill at the end of the
\begin{verse}    Quotation block for verse.                                            case ‘!’) is verbatim.                                 line. Normally \\ is used to separate lines.
tabular environment                                                     Citation types                                                            The LATEX document should have the following two lines just before
                                                                        \cite{key}           Full author list and year. (Watson and Crick 1953)   \end{document}, where bibfile.bib is the name of the BibTEX file.
\begin{array}[pos]{cols}
\begin{tabular}[pos]{cols}                                              \citeA{key}          Full author list. (Watson and Crick)
                                                                                                                                                  \bibliographystyle{plain}
\begin{tabular*}{width}[pos]{cols}                                      \citeN{key}          Full author list and year. Watson and Crick (1953)
                                                                                                                                                  \bibliography{bibfile}
                                                                        \shortcite{key}      Abbreviated author list and year. ?
tabular column specification                                            \shortciteA{key}     Abbreviated author list. ?
                                                                        \shortciteN{key}     Abbreviated author list and year. ?                  BibTEX example
l          Left-justified column.                                       \citeyear{key}       Cite year only. (1953)                               The BibTEX database goes in a file called file.bib, which is
c          Centered column.                                             All the above have   an NP variant without parentheses; Ex. \citeNP.      processed with bibtex file.
r          Right-justified column.
p{width}   Same as \parbox[t]{width}.                                   BibTEX entry types                                                        @String{N = {Na\-ture}}
@{decl}    Insert decl instead of inter-column space.                                                                                             @Article{WC:1953,
                                                                        @article         Journal or magazine article.                               author = {James Watson and Francis Crick},
|          Inserts a vertical line between columns.
                                                                        @book            Book with publisher.                                       title   = {A structure for Deoxyribose Nucleic Acid},
tabular elements                                                        @booklet         Book without publisher.                                    journal = N,
                                                                        @conference      Article in conference proceedings.                         volume = {171},
\hline      Horizontal line between rows.                               @inbook          A part of a book and/or range of pages.                    pages   = {737},
\cline{x-y} Horizontal line across columns x through y.                 @incollection    A part of book with its own title.                         year    = 1953
\multicolumn{n}{cols}{text}                                             @misc            If nothing else fits.                                    }
            A cell that spans n columns, with cols column specifi-      @phdthesis       PhD. thesis.
            cation.                                                     @proceedings     Proceedings of a conference.
                                                                        @techreport      Tech report, usually numbered in series.
                                                                                                                                                  Sample LATEX document
Math mode                                                               @unpublished     Unpublished.                                             \documentclass[11pt]{article}
                                                                                                                                                  \usepackage{fullpage}
For inline math, use \(...\) or $...$. For        displayed math, use   BibTEX fields                                                             \title{Template}
\[...\] or \begin{equation}.                                                                                                                      \author{Name}
                                                                        address         Address of publisher. Not necessary for major publish-
Superscriptx ^{x}               Subscriptx         _{x}                                 ers.
                                                                                                                                                  \begin{document}
x
                                P n
               \frac{x}{y}                         \sum_{k=1}^n                                                                                   \maketitle
y
√                               Q k=1
                                  n
                                                                        author          Names of authors, of format ....
 n
   x           \sqrt[n]{x}        k=1
                                                   \prod_{k=1}^n        booktitle       Title of book when part of it is cited.
                                                                                                                                                  \section{section}
                                                                        chapter         Chapter or section number.
Math-mode symbols                                                                                                                                 \subsection*{subsection without number}
                                                                        edition         Edition of a book.
                                                                                                                                                  text \textbf{bold text} text. Some math: $2+2=5$
                                                                        editor          Names of editors.
≤ \leq         ≥    \geq      6=   \neq     ≈     \approx                                                                                         \subsection{subsection}
                                                                        institution Sponsoring institution of tech. report.
× \times       ÷    \div       ±   \pm      ·     \cdot                                                                                           text \emph{emphasized text} text. \cite{WC:1953}
◦ ^{\circ}                                                              journal         Journal name.
               ◦    \circ      0   \prime   ···   \cdots                                                                                          discovered the structure of DNA.
                                                                        key             Used for cross ref. when no author.
∞ \infty       ¬    \neg       ∧   \wedge   ∨     \vee
                                                                        month           Month published. Use 3-letter abbreviation.
⊃ \supset      ∀    \forall    ∈   \in      →     \rightarrow                                                                                     A table:
                                                                        note            Any additional information.
⊂ \subset      ∃    \exists    ∈
                               /   \notin   ⇒     \Rightarrow                                                                                     \begin{table}[!th]
                                                                        number          Number of journal or magazine.
∪ \cup         ∩    \cap       |   \mid     ⇔     \Leftrightarrow                                                                                 \begin{tabular}{|l|c|r|}
                                                                        organization Organization that sponsors a conference.
ȧ \dot a      â   \hat a    ā   \bar a   ã    \tilde a                                                                                        \hline
                                                                        pages           Page range (2,6,9--12).
α \alpha       β    \beta     γ    \gamma   δ     \delta                                                                                          first & row & data \\
                                                                        publisher       Publisher’s name.
 \epsilon     ζ    \zeta     η    \eta     ε     \varepsilon                                                                                     second & row & data \\
                                                                        school          Name of school (for thesis).
θ \theta       ι    \iota     κ    \kappa   ϑ     \vartheta                                                                                       \hline
                                                                        series          Name of series of books.
λ \lambda      µ    \mu       ν    \nu      ξ     \xi                                                                                             \end{tabular}
                                                                        title           Title of work.
π \pi          ρ    \rho      σ    \sigma   τ     \tau                                                                                            \caption{This is the caption}
                                                                        type            Type of tech. report, ex. “Research Note”.
υ \upsilon     φ    \phi      χ    \chi     ψ     \psi                                                                                            \label{ex:table}
                                                                        volume          Volume of a journal or book.
ω \omega       Γ    \Gamma    ∆    \Delta   Θ     \Theta                                                                                          \end{table}
                                                                        year            Year of publication.
Λ \Lambda      Ξ    \Xi       Π    \Pi      Σ     \Sigma
                                                                        Not all fields need to be filled. See example below.
Υ \Upsilon     Φ    \Phi      Ψ    \Psi     Ω     \Omega                                                                                          The table is numbered \ref{ex:table}.
                                                                        Common BibTEX style files                                                 \end{document}
Bibliography and citations
                                                                        abbrv   Standard         abstract    alpha with abstract
When using BibTEX, you need to run latex, bibtex, and latex             alpha   Standard         apa         APA                                  Copyright c 2014 Winston Chang
twice more to resolve dependencies.                                     plain   Standard         unsrt       Unsorted                             http://wch.github.io/latexsheet/