# Rob's LaTeX Page

Rob's favorite links to all things LaTeX.

## Getting the Software

There are many sources for LaTeX, almost all of them free. Here are some I, or people I respect, have used:

## Support tools for LaTeX

### PdfLaTeX

I have not used classix LateX in years but rather pdfLaTeX. The advantages include:
• Output is directly in pdf.
• Included graphics can be in pdf, tiff, jpg, or png formats.
• Never have to deal with postscript again!!!!
• Everything that worked in regular LaTeX (except including postscript files) will work in PdfLaTeX.

### Change marking

Resubmitting documents like papers and grant applications often requires the authors to mark those sections that have changed since a previous version. LaTeX has support for this through the changebar package, typically part of a standard installation of LaTeX but also available via a Google search.

Once you have installed the package, perform the following steps to create a vertical bar in the right margin of the page next to sections that you have changed.

  \usepackage{changebar}

2. Then around every piece of the text that has changed, place these two commands:
  \cbstart
\cbend

3. For example,
  \cbstart
Each year, there are changes in the Handbook and we mark such changes from
the previous edition with a vertical bar in the right margin, as with this
paragraph.   Such markings may not be visible in the HTML version of the
handbook---please see the pdf edition for clarification.
\cbend


### Citation commands

Things have changed recently so that it is now easier to control how citations appear in the document. To get some control over citations, use the cite.sty package (i.e.,

    \usepackage{cite}

To have citation numbers appear as superscripts, change this to be
    \usepackage[super]{cite}

and that may be all you ever need to know. For more info, read the cite.sty file.

### San Serrif fonts for grant applications

With the requirement of many granting agencies to submit applications using a san serrif font like Helvetica or Arial, there are several tricks in LaTeX.

Mine looks like this and gives an 11-point like font that NIH has accepted without problem on several occasions.

    \usepackage{times}
% This command somehow makes Helvetica fonts
\renewcommand\rmdefault{phv}


### Typsetting Units

To get complex units to look good needs some math mode but without the math fonts, which requires the use of
    \mathrm

for example
   $\mathrm{\mu A / cm ^ 2}$

creates "micro-Amps per cm squared" with the correct fonts.

### Wrapping Text around figures and other space saving tricks

LaTeX is not always efficient in the way it uses space on a page, sometimes leaving large white spaces and big gaps between elements of the document. There are several packages that support text wrapping and other tricks to getting better use of page space in LaTeX. Here are some pointers to a few.
• Tricks on saving space and text from a Cambride University site
• PDF desciption of the floatflt package that allows text to wrap around figures.
• Wrapfig my current favorite system for text wrapping.
• Picinpar is a standard package, part of most standard releases. The key usage information (that is not well documented) is to bracket a region containing the figure with \begin{figwindow} and \end{figwindow}. The regular figure description has to be embedded into the \begin{figwindow} command with the arguments that indicate the number of line of paragraph above the figure and then a letter to place the figure on the page, e.g.,
      \usepackage{graphicx}
\usepackage{picinpar}
\begin{figwindow}[3,l,%
in the student lab for Bioengineering 6000 class.}]

In this lab, you will record the standard limb leads in sequence,
according to the diagram below:

The goal for the Frank electrode system is to capture the
three-dimensional extent of the heart dipole.  For this, it is
necessary to measure potential differences not just in the frontal
plane, as in the limb leads, but along the antero-posterior
(front-to-back) axis of the body.  The diagram below illustrates the
original Frank lead system \cite{RSM:Fra56} and we will use a
simplified version of this.

\end{figwindow}

Note that despite what the documentation says, this does not work for centering a figure and having text wrap around both sides.
• You can use either floatflt package or wrapfig package.

For example:

	\begin{floatingfigure}[r]{0.4\textwidth}
\centering
\includegraphics[width=0.4\textwidth]{lake1}
\caption{Text wrap around figure}
\noindent \hrulefill
\label{test}
\end{floatingfigure}

and
	\begin{wrapfigure}{r}{0.4\textwidth}
\centering
\includegraphics[width=0.4\textwidth]{lake1}
\caption{Text wrap around figure}
\noindent \hrulefill
\label{test}
\end{wrapfigure}


The difference between floatingfigure and wrapfigure is that the text typed after \end{floatingfigure} will be forced to be a new paragraph.

### Underlining

LaTeX folks (at least Leslie Lamport) seem to frown on the use of underlining but if you do like to use it, the package ulem.sty is your friend. With \usepackage{ulem}, you have the following new commands:
• \uline{important} underlined text
• \uuline{urgent} double-underlined text
• \uwave{boat} wavy underline
• \sout{wrong} line drawn through word
• \xout{removed} marked over with //////.
• {\em phasized\/} and \emph{asized} In LaTeX, by default, these are underlined; use \normalem or [normalem] to restore italics
• \useunder{\uwave}{\bfseries}{\textbf} use wavy underline in place of bold face
Note that this package changes \em and \emph to be underline. To change this behavior back to normal, use the \normalem command, for example
    \usepackage{ulem}
\normalem


### LaTeX for thesis writing

The thesis is often one of the first major projects for a student in LaTeX (it sure was for me) and there are some nice tools specific to that task.

### Setting up Auctex

Getting and setting up Auctex is easy, either for a sysadmin type or a mere mortal. If you do not have local support, here are the steps:

1. Go to here and get the latest stable version (who needs to live dangerously when writing is already hard enough)
2. Put the folder in your local emacs lisp folder, typically something like ~/emacs/lisp
3. Read the INSTALLATION file, where you will find the commands
 make make lispdir=\$HOME/emacs/lisp install 
4. The nasty part of installing this yourself is the need to put the info files somewhere and set up your own info directory. You can ignore this and just read the PDF version of the manual I have prepared.
 (setq load-path (cons "~/emacs/lisp" load-path)) (require 'tex-site) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil) (setq LaTeX-indent-level 4) (setq LaTeX-item-indent -2) 

Note: the first 2 lines are required; the rest are some useful settings you can alter at will.

6. Run emacs on your latest LaTeX document and have a real blast!

### Colourization of Emacs text

One of the mysteries of Emacs version 21 is how to set up colors for the different elements of a document. This used to happen with highlight packages but now it is built in and hence more powerful and sometimes more difficult to use. Here are some points to note in fumbling around with this feature.

• You must enable font lock to have any highlighting. To do this on a global basis, put this command in your .emacs file.
 (global-font-lock-mode t) 
• To customize the faces (colors, fonts, etc.) used by Font Lock for fontifying different parts of buffer text, use the command
M-x customize-face
You will then have a funky UI that will allow you to make changes in color for any type of element in the LaTeX file. Read the instructions at the top of the page and play around until you get the hang of it.
• Changes you make permanent in the UI above appear at the end of the .emacs file looking something like this:
 (custom-set-faces '(font-lock-comment-face ((t (:foreground "pink"))))) 
• If you want to really get fancy, you can look at the set of keywords that highlighting uses to set color and font. For this, go to the mode you like (or dislike) most and enter
 C-h v font-lock-keywords  Then read the documentation at the top or jump to the encoded list of keywords at the bottom.