User:Gwh2/LaTeX Best Practices

From Cyber-Physical Systems Laboratory
Revision as of 22:30, 8 April 2010 by Gwh2 (talk | contribs) (→‎Citation Formatting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

Hyphens vs. Dashes

Complex words use a single hyphen (-): standards-based, state-of-the-art. Ranges use an en dash (--): 1981--2009, 1--5. Parentheticals use an em dash (---): the total energy consumption --- comprised of the network, sensing, and computation costs --- at each node.

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]

The same rules holds for Figures (Figure~\ref{key}), Sections (Section~\ref{key}), etc.

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?)