L^{A}TEX Quick Reference Provided by the 15-251 TAs

• Document Template: Start every document like this:

\documentclass{article}
\usepackage{fullpage}
\begin{document}
% Your stuff goes here
\end{document}

• Justification: Text is fully justified by default. You can use these commands to justify left, center, or right:

  – \begin{flushleft}
    \end{flushleft}
  – \begin{center}
    \end{center}
  – \begin{flushright}
    \end{flushright}

• Text Styles: Use \emph{} for emphasized text \textbf{} for bold, \textit{} for italics, \texttt{} for teletype, \textrm{} for roman (normal),

In this sentence, only \textbf{these three words} will be bold.

• Math mode: To put simple equations like x + 2 into the middle of a sentence, just put dollar signs

around it: the answer is $ x+2 $ .

To insert an entire equation, centered on its own line, use the equation environment:

\begin{equation}
  x+2 = 123456789
\end{equation}

• Basic math formatting:

y^{25}  y^{25}

 z_{0}  z_0
 \frac{x+2}{y+1}  \frac\{x+2\}\{y+1\}
 ∑_{x=1}^{10} \sum_{x=1}^{10}

• Unordered lists, ordered lists:

  – \begin{itemize}
    \item
    \item
    \end{itemize}
  – \begin{enumerate}

etc.

• Using L^{A}TEX:

latex myfile.tex  Compile the file. If there is an error, type q and hit return to exit.
latex2e myfile.tex  On some systems you need to run latex2e instead of latex.
xdvi myfile.dvi  Display the result on-screen.

 dvips -o myfile.ps myfile.dvi Convert to postscript
 lpr -Pprintername myfile.ps  Print postscript
 dvips -Pprintername myfile.dvi Print directly from dvi