## LaTeX and friends for OS X

February 11, 2006

I switched to Mac OS X in 2003. As a graduate student, I use LaTeX a lot. Setting up and using LaTeX on OS X is easy, even for an OS X newbie. But, there are some OS X-specific applications that can work together with LaTeX, which I found to be of great help in putting together my papers, reports and presentations. I describe them here. (Note: All software mentioned below (except Omnigraffle) are free, most of them open source.)

#### Installing TeX

Download the i-Installer and follow the instructions on the i-installer page to install TeX, Ghostscript, and Freetype 2.

#### TeX directories

• TeX is installed in /usr/local/teTeX/.
• The binaries like latex and bibtex are in /usr/local/teTeX/bin/powerpc-apple-darwin-current/.
• Put your LaTeX packages and class files (.cls) under ~/Library/texmf/tex/latex. These will then become available to latex, pdflatex when you use those packages in your LaTeX source file.
• Put your BibTeX bibliography files (.bib) under ~/Library/texmf/bibtex/bib . This directory is part of the default path that bibtex looks for .bib files.
• BibTeX bibliography style files (.bst) go in ~/Library/texmf/bibtex/bst .

#### Text editor

I use Vim to edit my LaTeX documents. Besides being a powerful editor, it also allows me to use the vim-latex plugin, which supports many time-saving macros. Besides vim, there are many other capable text editors for OS X. Look for them here [osx.hyperjeff.net].

#### PDF Previewer

Each time LaTeX compiles the source code with pdflatex, the PDF needs to be refreshed, and the PDF display must remain at the same page that was being viewed before. I use TeXniscope to do this. It also works with latex/DVI.

#### latexmk

Earlier, I used to compile my LaTeX code by typing keyboard shortcuts for pdflatex and bibtex multiple times, using a frontend like TeXshop. Then, I discovered latexmk. All you do is save your LaTeX source in your editor and latexmk automatically runs latex and bibtex the correct number of times, and refreshes your PDF previewer. Instructions to install and set up latexmk with TeXniscope can be found here [hublog.hubmed.org].

#### Bibliography Management

If you use bibtex to manage your bibliographies, you need Bibdesk. It is more than a mere front-end to bibtex. I’ve only used some if its many features. I extensively use the citation import feature that it provides as an OS X service.

#### Drawing figures

I’m a big fan of Omnigraffle for drawing figures. The user interface is very thoughfully designed and well integrated with OS X. Simple math symbols can be added through the “Edit–Special Characters” menu that is present in many OS X applications. For more complicated math, I first enter the LaTeX code for the math into a little tool called LaTeX equation service. This tool then renders the LaTeX code into a PDF that I can drag and drop into my Graffle drawing. (Omnigraffle is free for drawings with less than 20 objects. A free one-day license can also be obtained from their website that allows unlimited number of objects.) Before Graffle, I’d used Xfig and more recently, Inkscape, which are also available for OS X through fink.

#### Image editor

I sometimes need an image editor to modify images that were not created with Omnigraffle, or to modify a figure’s background and foreground to suit a desired presentation theme. For all these, I use Gimp.

## LaTeX tips to meet publication page limits

November 19, 2005

Any print publication will naturally have a page limit for articles it publishes. I use LaTeX for typesetting my papers, and I’ve put together here a collection of tricks I use to squeeze space out. I’ve sorted them roughly in decreasing order of effectiveness.

### Do this first

• Decrease the document’s font size to the lowest allowed size. For example, \documentclass[10pt]{article} reduces your document’s font to 10 points if you’re using the article document class.
• If you’re using the article document class, add \usepackage{fullpage} to your preamble. As its name suggests, this package shrinks the margins and uses more of each page.
• Convert display math (equation, eqnarray, etc.) to inline math (), wherever possible.

### Decrease the font size used for references

It is common for print journals to use a smaller font for references than normal text. But the default style files for conference papers (like ACM‘s sig-alternate.cls) often don’t do this. You can do this yourself by enclosing the bibliography portion of your document with a LaTeX font size environment like this:

\small{
\bibliography{mybibliographyfile.bib}
}

To make the references even smaller, use \scriptsize instead of \small, but I don’t recommend using smaller font sizes.

### Reduce spacing by changing environment variables

LaTeX uses certain default values set by the style-sheet to determine, for example, the spacing between items in a list, before and after equations, before and after figures, etc. This document on Squeezing Space in LaTeX gives a list of such variables you can manipulate. They usually involve adding a negative amount of space to an existing environment variable. For example:

The above code reduces the separation between items in a list by 0.05 inches. The right amount to add can only be found by trial and error. I’ve found that it is most effective to change the following variables: \itemsep (about 0.1 in), \topsep(about 0.07 in), \textfloatsep(about 0.05 in), \intextsep(about 0.05 in), \partopsep(about 0.03 in), \parskip(about 0.02in)

Note that sometimes, adding a more negative amount does not seem to reduce spacing, and when pushed beyond a point, the typesetting gets totally messed up. Use this technique in moderation.

### Using \vspace

This is a more direct method to cut down spacing exactly where you need it. It is best illustrated with an example:

This is the end of a paragraph.
\vspace{-0.2in}
\begin{figure}[h]

This cuts down the space between the end of a paragraph and the figure that follows it.

### Use the space meant for author information

If you are submitting a paper for a double blind-reviewed conference, you will not be revealing the author names and affiliations. But the style file often reserves a certain amount of space for it, even if you don’t specify any author information. The only way around is to edit the style file itself. This is how you can do it for ACM’s sig-alternate.cls (Note: you make such modifications at your own risk, I have only tested this for v1.6 of the class file).

• Find the line \advance\topmargin by -37 pt. Change the 37 to 47.
• Find the line %This should be the subtitle. Comment the next six lines.
• Find the line ending with % Increased space for title box -- KBT, and comment it.
• Skip the next three lines. Comment the next six lines (\begin{center} to \end{center}).
• Find the line starting with \def\@toappear{}. Comment this line, and the next six lines (up to and including the line that begins with \def\conferenceinfo.)
• Find the line starting with \newtoks\copyrtyr. Comment this line, and the next seven lines (up to and including the line that begins with \def\permission.)

### Fix paragraphs that end at the beginning of a column

In any document, it is common to have paragraphs where the last character is at the beginning of a column. Often, it is possible to shorten that paragraph just enough to make the paragraph end in the previous line instead, thus saving one entire line. Browse you entire document looking for such paragraphs, and fix as many as you can.

### Convert oversized tables into images

Sometimes, we have tables that span more than one column, but does not really need two columns. For example, the following table may not fit into a single column.

\begin{table}
\centering
\begin{tabular}{l l l l l l l}
BlahBlah & BlahBlah & BlahBlah & BlahBlah & BlahBlah & BlahBlah & BlahBlah\\
\end{tabular}
\caption{BlahBlah table}\end{table}

But, we can use the same trick we use for resizing images to make this table fit into, say 90% of the column width, like this:

\begin{table}
\centering
\resizebox{0.9\columnwidth}{!}{
\begin{tabular}{l l l l l l l}
BlahBlah & BlahBlah & BlahBlah & BlahBlah & BlahBlah & BlahBlah & BlahBlah\\
\end{tabular}
}
\caption{BlahBlah table}
\end{table}

### Shrink images

This obvious trick is, IMO, the main cause of illegible conference papers, but sometimes, there is no other choice. Shrink your images using your favorite LaTeX graphics package till the text size on the figure is about the same size as the main text.