- Essential Manuals
- Latex in Powerpoint
To typeset Latex within MS
Powerpoint, use TexPoint. Note that a
grouped figure can be saved as PNG, which can be converted to
postscript using (e.g.) the Gimp.
- No page numbers
To suppress the page number on a page, use
\thispagestyle{empty}
- A basic preamble
Here's the blank document I usually start with:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{graphicx}
\newcommand{\comment}[1]{}
\newcommand{\field}[1]{\mathbb{#1}} % requires amsfonts
\newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}}
\begin{document}
\bibliographystyle{abbrv}
\bibliography{refs}
\end{document}
- An alternative to xdvi
After trying dvilx, it
didn't take me long to switch. What took me some time is figuring out
how to get Emacs/Auctex/Latex-mode to default to using dvilx for
viewing. Eventually, I figured it out. Here's the magic (add to
your ~/.emacs file):
(defcustom TeX-view-style `(("." "dvilx %d")) "")
[2/16/05] Note: this doesn't seem to work anymore...
- Postscript
Some programs create postscript files
without a bounding box. Latex doesn't like this. To fix the problem,
add a line like this to the top of the postscript file:
%%BoundingBox: 50 150 550 650
- A4 Paper
When someone sends me an A4-formatted
postscript document, it prints badly. "pstops" can be used to shift
the document down to print correctly. Here's the magic for an A4 postscript:
pstops '(0cm,-2cm)' in.ps out.ps
- Side-by-side tables
Normally a tablular
environment stretches the entire width of the text area (whether it
looks like it should or not!). You can restrict the width with a
minipage. This allows you to put two tables side-by-side:
\begin{minipage}{2in}
\begin{tabular}{c}
Table1
\end{tabular}
\end{minipage}
\begin{minipage}{2in}
\begin{tabular}{c}
Table2
\end{tabular}
\end{minipage}
- Derivatives
If you write partial derivatives a lot, it's useful to make a macro:
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
Then, writing a partial is as simple as $\pd{J}{x}$.
- Save Trees
Do you hate the fact that Latex uses
white space a little too freely sometimes? Or, do you have a
strict page limit that you have to adhear to? If so, the savetrees package is for you.
- AUC TeX
The Emacs latex mode is okay, but nowhere
near as useful as AUC TeX. AUC
TeX incorporates many useful features into the mode,
including intelligent indentation/formatting (Meta-q), inserting
environments (Ctrl-c Ctrl-e), inserting sections (Ctrl-c Ctrl-s) and
more! See the AUC TeX
documentation for the lowdown.
- The Reals
Latex doesn't have a special math symbol
for the set of reals, but the symbol that we all know and love can be
found in the AMS fonts package:
\usepackage{amsfonts}
\newcommand{\field}[1]{\mathbb{#1}}
...
A metric space is a set $S$ together with a metric
$\rho:S \times S \rightarrow \field{R}$
This works for other fields such as the integers (\field{Z}) and complex numbers (\field{C}).
- Citations
I use the named bibliography
style because it allows for more fine-tuned citing. Commands include
\cite, \citeauthor, \citeyear and \shortcite (for after you've already
used \citeauthor). You'll need named.sty and
named.bst. Use it like this:
\usepackage{named}
...
\citeauthor{Efron79t} introduced the bootstrap \shortcite{Efron79t}.
...
\bibliographystyle{named}
\bibliography{/foo/bar/baz/refs}
The above assumes that your bibliography file is "/foo/bar/baz/refs.bib".
- BibTeX
BibTeX makes citations a breeze. I keep a
local copy of the database entry types to help
remind me of the fields that go with the different types. Take a look at my refs.bib.
- Processing the Bibliography
Let "main.tex" be the name of your Latex file. Run
latex main
bibtex main
latex main
latex main
(in that order) to have Latex and Bibtex work together to process the
bibliography.
- \protect
Latex complains when you put citations in
table captions (and when you put footnotes in arguments of \section
commands). Fix this by putting a \protect command in front:
\caption{Data taken from \protect \citeauthor{Efron79t}
\protect \shortcite{Efron79t}}
In general, any fragile command that appears in a moving
argument must be preceded by a \protect command. See Help with
Latex for more information.
- xdvi
"k" or "K" (depending on your version of
xdvi) will toggle holding your scrolling position when changing pages.
This is good for reading papers with large margins.
Alternatively, add the following line to your ~/.Xresources file:
xdvi.keepPosition: true
- \rightarrow
Use \to instead of \rightarrow to save your fingers from excess typing.
- Aligning Images
By default, images align
according to their "reference point," which is never what you want it
to be. Put a minipage around an image to make it align properly
(according to its center):
\usepackage{graphicx}
\begin{minipage}{2in}
\includegraphics[width=2in,angle=-90]{foo}
\end{minipage}
- 2-Column Images
When in 2-column mode (using
either \twocolumn or the multicols environment (package multicol)),
use \begin{figure*} and \begin{table*} to create figures and tables
that span the entire width of the page. \begin{figure} and
\begin{table} span only one column.
- LaTeX->PDF
I've found that the best way to convert
from latex to PDF is to use "pdflatex." The first time that
you run it, you'll find that the produced PDF file doesn't include any
of your figures. To fix this,
- Use "epstopdf" to convert all of your EPS images to PDF
- Make sure that you are using the "graphicx" package for including images.
- Remove any .eps or .ps extensions from filenames in your LaTeX file
When you run latex, graphicx will use the dvips
driver to incorporate EPS files. When you run pdflatex,
it will pick up the pdftex driver and incorporate the PDF
files. pdflatex does not work well for slides (see DVI->PDF below).
- DVI->PDF
Another good way to produce PDF from LaTeX
is to run dvipdfm
on the DVI file that LaTeX produces. This program seems to work best
for slides.
- Comments
I use this command to let me make multi-line comments in my latex source:
\newcommand{\comment}[1]{}
- Math
The amsmath
package is a god-send. Check out "align", "multline", "bmatrix",
"binom", "text" and "xrightarrow".
- Adobe Illustrator/PowerPoint
Martin has a quick
guide to incorporating Illustrator and PowerPoint figures into
LaTeX documents.
Other LaTeX links: