CSUMS, Tuesday, May. 19

More LaTeX, a continuation of these exercises.

Macros

Although there is a built-in LaTeX command to type almost anything you can imagine, these commands can sometimes be lengthy. It is therefore many times useful to write macros to make your life easier. The most common macros will probably be to make typing a long command easier, or to define new commands. For this, you can use the def or newcommand commands anywhere in the preamble.

Example. For many math papers, you will need to use blackboard bold letters to represent the integers, the complex numbers, etc. Typing \mathbb{} every time can get tedious, so it is useful to write a macro like this.

\def\C{\mathbb{C}}
The complex numbers, $\C$.
Note. newcommand will not work if the new command you create is already defined.

Exercise 5. Using newcommand, write macros for your own commands that will display the following when given the argument A. Here is a hint for number 2.

Citations and Labels in LaTeX

While writing any article, it will be necessary to reference both sources outside of your paper, as well as figures and equations within your paper. These type of references are very easy in LaTeX, which has a variety of built-in environments and commands for this purpose.

Example. In-text references are use with the label and ref commands. In short, ref is used to refer to an object that is labeled with label, as shown.

\begin{equation} \label{TriIneq}
\|x+y\| \leq \|x\| + \|y\|
\end{equation}
The triangle inequality is given
in equation \ref{TriIneq}.

Citations of other articles is a little (not much) more complicated. LaTeX has an environment called thebibliography for your list of references. Within this environment, you can list your references using the bibitem command, and then refer to them in your text with the command cite.

Exercise 6. Reproduce this paper, using the above commands. Here is a tex document to get you started, which requires this image in either pdf or jpg form.

Note.This figure is from Dr. Edward N. Lorenz's '63 paper, which is available in full here.

Exercise 7. This is not really an exercise, but I would strongly recommend that you keep a running bibliography of all the interesting papers you read while doing research. Since you will probably need to write your CSUMS thesis/presentation/journal article in LaTeX, it is easiest just to write this bibliography in LaTeX as well. Here is a blank template that you can use for a full-length journal article, and there is a spot at the end to keep your bibliography.

Beamer

It is also easy to create presentations and slide shows in LaTeX, with a LaTeX class known as Beamer. These pdf presentations are very useful, since they are much easier to transport that PowerPoint or Impress presentations. This is important, since you may not always have access to your own laptop while giving presentations at out-of-state math conferences. As many (including myself) have learned the hard way, never trust anything but pdf presentations to work on someone else's computer! Since Beamer is a class of LaTeX document, and not a different program, all of the commands, packages, and so forth are exactly the same, with a few important additions.

First, new slides are called 'frames,' and each slide is generated with the following commands.

\begin{frame}
...
Frame content here
...
\end{frame}

Next, the command \pause is used to add 'effects,' by pausing the next item displayed until the mouse is clicked. For example, the following text displays a list one item at a time, pausing between each item until the mouse is clicked.

\begin{itemize}
\item A
\pause
\item B
\pause
\item C
\pause
\end{itemize}

For more information about Beamer, see the user guide here.

Exercise 8. Create a short (5-6 frame) presentation in Beamer about anything. Here is a blank template that you can use to get started.

Note 1. In order to get this template to compile, you will need the associated style and image files, available in a zipped package here.
Note 2. For some reason, I can only get Beamer presentations to work with the pdflatex compiler, so be warned.

Cleanup

As you have probably noticed, TeX compilers output more than just a single pdf or dvi file. Although it is usually faster and easier to save these other files while developing a document, it is also handy to have some kind of utility that will clean up these 'auxiliary' files when you are done writing. This is a perfect job for a short shell script.

Exercise 9. Create a Bash script that removes all unwanted AUX files. Here is a skeleton to get started.

Created in 2009 by Taylor Hines. Not for general distribution; some of this content is borrowed from other sources.