User:Gwh2/LaTeX Best Practices

From Cyber-Physical Systems Laboratory
Revision as of 23:04, 8 April 2009 by Gwh2 (talk | contribs)
Jump to navigationJump to search

General

Add a line break after each sentence. This makes it much easier to deal with version control, since CVS and SVN can automatically merge changes iff they happen on different lines.

Citation Formatting

Add \usepackage{cite} to your preamble to get nicer formatting for multiple-key citations.

Use text~\cite{key} rather than text \cite{key} to keep LaTeX from breaking sentences like

blah blah blah text
[1]

Image Formatting

The One True Template for inserting images is:

\begin{figure}[htbp]
    \centering
    \includegraphics[width=\columnwidth]{filename-no-extension}
    \caption{Figure caption}
    \label{fig:section:filename-no-extension}
\end{figure}
  • LaTeX is incredibly whiny about having the image, caption, and label in that order. Get it wrong, and parts of your paper may have funny references.
  • Be sure to exclude the filename extension. That way, when a conference changes its mind and demands an .EPS rather than a .PDF, you can just convert all of your .PDF/.PNG images to .EPS, run latex instead of pdflatex, and not have to change any of your LaTeX code.
  • Starting the label with "fig:section:" helps for code completion. (You are using an editor with code completion, right?)