LaTeX for B561

This document is intended for B461 and B561 students wishing to learn the text formatting language LaTeX. LaTeX is the de facto standard for scientific and mathematical documents. You will have many opportunities to use LaTeX during your CS career. This document is intended to be a quick-start guide to the basic elements you need to know for B461/B561. There are many much more comprehensive references available, and it is recommended you also consult one or more of these.


Overview: LaTeX at IUB

LaTeX is a Markup Language. This means the source code is plain text with text markup commands. In LaTeX, markup commands usually start with a "\" (backslash). There are 5 steps involved in going from plain text source code to a finished PDF document.

  1. Create LaTeX source code using the text editor of your choice. Let's say your source code is in a file "foo.tex".

  2. Compile your LaTeX source code to produce DVI (DeVice Independent) WYSIWYG output.

  3. View the DVI result.

  4. Edit the source code and recompile until you have achieved your desired result.

  5. Translate the finished version to PDF.

Document Skeleton

A sample document skeleton is available here. This skeleton should give you the necessary formatting/packages for B561. Your text goes between the \begin{document} and \end{document} commands (after the \maketitle) command. You should change the \author and \title input in the preamble accordingly.

Text Formatting

  1. Comments: Whenever the symbol % is encountered, LaTeX ignores the rest of that line.

  2. List Environments: The typical list environment is used as follows:
    \begin{enumerate}
    \item This is item 1.
    \item This is item 2.
    ...
    \end{enumerate}

    The enumerate environment creates numbered lists. The itemize environment creates bulletted lists. Lists can be arbitrarily nested with one another.

  3. Sectioning: The command \section{Your title here} creates a numbered section. You also can use the subsection, subsubsection, and paragraph commands to create sub-sections, etc. If you want unnumbered sections, use the \section*{...} command.

  4. Font Formatting: Some common font formatting commands:
    \underline{this text will be underlined}
    \textbf{this text will be bold}
    \textit{this text will be italicized}
    \texttt{this text will be typewriter text}
    \textsc{this text will be small caps}

  5. Escaping: Many characters in LaTeX have special markup meaning. If you want to include these in your document, you will need to precede them with a "\". For example:
    \#    \&    \$    \%    \@    \_    \{    \}    \^   
    LaTeX also includes two "verbatim" commands: "\begin{verbatim} ... \end{verbatim}" (to set off text that displays exactly as entered in the source code) and "\verb|...|" (to get inline verbatim text).

  6. References: Any part of your document can be given a label: "\label{myLabel}" and then referred back (or forward) to using "\ref{myLabel}" or "\pageref{myLabel}".

  7. Hard-Coded White Space: The text "\ " (note the space after the \) can be used to insert a space in the output. You can insert however much space you'd like using the "\hspace*{...}" and "\vspace*{...}" commands. Replace the "..." with a measurement, such as "2cm", "1in", or "3mm".

Formulas

  1. Equation Environments: equations can be set off from the text using "\begin{equation}...\end{equation}", or can be inline set off by "$...$". The following LaTeX markup will produce what you want only inside an equation environment.

  2. Sub-Scripts: write x_y to get xy. If you want more than a single character in the subscript, enclose it with { and }: for example x_{135} produces x135.

  3. Super-Scripts: write x^y to get xy. If you want more than a single character in the superscript, enclose it with { and }: for example x^{135} produces x135.
    Note: super- and sub-scripts can be arbitrarily nested as long as you use { and } to disambiguate properly.

  4. Greek Letters: Just write the English word for the Greek letter. For example: \alpha, \beta, \gamma, etc. To get the capitalized Greek letters, capitalize the first letter of the English: for example, \Gamma, \Delta, etc.

  5. Fractions: The command \frac{...}{...} produces nicely formatted fractions. The numerator should replace the first "...", the denominator should replace the second "...".

  6. Tuple Calculus Symbols: Here are the LaTeX markup codes for the symbols of the Tuple Calculus:
    LaTeXProduces
    \rightarrowlogical "implies" symbol
    \veelogical "or" symbol
    \wedgelogical "and" symbol
    \existslogical "there exists" symbol
    \foralllogical "for all" symbol
    \in"is element of" symbol
    \neglogical "not" symbol
    \botlogical "false" symbol
    \toplogical "true" symbol

  7. Relational Algebra Symbols: Here are the LaTeX markup codes for the symbols of the Relational Algebra:
    \times"Cartesian product" symbol
    \rhorenaming symbol
    \cupset union symbol
    \capset intersection symbol
    -set difference symbol

  8. Set Comparison
    LaTeXProduces
    \subset"is subset of"
    \subseteq"is subset of or equal to"

  9. Bold Symbols: Use \boldsymbol{...} enclosing a symbol command to make that symbol appear bold.

Figures

  1. Figure Environment: Use the following LaTeX markup to produce a captioned-figure environment setting off an external EPS figure:
    \begin{figure}
    \epsfig{file=myFig.eps, height=...}
    \caption{Insert caption here}
    \end{figure}

  2. Creating EPS Figures

LaTeX References

Books

L. Lamport. LaTeX: A Document Preparation System User's Guide and Reference Manual. (Addison-Wesley, 1994.)
Goosens, Mittelback & Samarin. The LaTeX Companion (Addison-Wesley, 1994.)

Online References