LaTeX notes

Contents

Useful references

Making nice PDFs without pdflatex

I now mainly use pdflatex. Below is the set of switches I use if going via dvi from normal latex. These avoid bitmap fonts, ensure ligatures don’t turn into pound-sterling symbols and force the page size to a4. I find that this basically always works as long as tetex and ghostscript are not ancient.

#!/bin/sh
dvips -Ppdf -G0 -o "${1%.dvi}"_pdf.ps "$1" ;
ps2pdf -sPAPERSIZE=a4 "${1%.dvi}"_pdf.ps "${1%.dvi}".pdf;

You may find that the above mangles some of your colour figures, as it jpeg compresses them (sometimes very aggressively). The following switches to ps2pdf:

-dAutoFilterColorImages=false -sColorImageFilter=FlateEncode

losslessly compresses your images. You may experience an increase in file size.

Spacing issues

Somehow I missed out on knowing this stuff for a long time. lacheck and chktex are programs that will point out problems in your LaTeX markup (possibly with a load of false positives). Those tools know about these issues.

More spacing issues — hitting page limits

Here are some notes on tricks for squeezing a paper to within conference page limits. There’s always PSSQ, but I like to stay more within the rules than that. Many “9 page” papers can be squashed into 8 pages without changing the font size or main spacing parameters.

Recommended packages

The following are packages I use regularly, some of which I didn’t discover for a long time:

hyperref problems

I have wasted a lot of time pinning down problems with the hyperref package. Partly because I didn’t RTFM, which it turns out is more important than normal for this package.

If you have problems with a particular package see if hyperref’s README file says how to deal with it.

Upside-down slides

If dvips produces upside-down slides, put this in your document’s preamble:

% This for broken installs that flip page wrong way
\special{! TeXDict begin /landplus90{true}store end }

Doesn’t seem to do any harm in general.

pspresent

If you want to do fullscreen postscript instead of pdf—which is easy to fullscreen with xpdf or acroread—I’ve found pspresent to be a neat and tiny utility, which compiled and worked first time for me.

Centering stuff vertically within a line

I currently use:

\newcommand{\myvcenter}[1]{\ensuremath{\vcenter{\hbox{#1}}}}

when I want graphics or other over-sized oddities to be vertically centered. Normally all objects have their baselines at the same height. Alternatives include fiddling with the baseline or using \raisebox.

I still haven’t got around to working out why plain \vcenter doesn’t work in LaTeX.

Gaps to match

To create an empty box with the same size as some particular text use the \phantom command. Horizontal or vertical struts of the same width or height are made with \hphantom and \vphantom. See p178 of the TeXbook and more help on alignment with boxes.

Fonts

It’s easiest to stick with using Computer Modern. For information on using other fonts and making mathematics still look reasonable see this useful survey. \usepackage{palatino} is quite nice.