## Wiki » History » Version 2

« Previous - Version 2/5 (diff) - Next » - Current version
Cristovao Andre Antunes Cruz, 01/04/2013 10:51 PM

# LaTeX Tips and Tricks¶

## Guidelines¶

• Put your files in source control.
• If you are typesetting any math, reading Math mode by Herbert Voß is a must.
• Typeset your document in draft mode to see how bad over- and underfull lines are, and if they are pretty bad, consider changing the wording a bit (but don't fuss too much over this, as the best wording is more important than minor typographical improvements). You can also help Latex by letting it hyphenate some words in this case.
• Use \centering instead of \begin{center} \end{center} to center things inside tables/figures etc. \centering doesn't add any additional vertical space.
• Use \newcommand to make things more logical.
• If your document has a lot of technical figures, it might be a good idea to learn PGF/Tikz, sketch 3D, and pstricks, or a combination of those.
• Select the correct size of paper (a4paper, letter, …)
• \usepackage{flafter} to make sure the float never appear before its position in the code.
• Use namespaces for labels, e.g., fig:somefigure, eq:someequation, tab:sometable, etc.
• Put all the figures in the same folder, possibly in many diferent formats, and in never use the file extension in the code, the correct format will be automatically selected. In the beginning of the file do \usepackage{graphicx} \graphicspath{{./figures/}}.
• Beware of end-of-line control characters if using multiple operating systems.
• Be careful with the encoding and do something like \usepackage[utf8]{inputenc}
• Run chktex to detect things that could be improved.

## Floats¶

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=figurehere

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=floats

## Interesting Packages¶

### biblatex¶

http://www.ctan.org/pkg/biblatex

### nag¶

Warns the user about the usage of old packages or commands (for example, using \it, \tt, etc.). nag warns about the things mentioned in l2tabu (Obsolete packages and commands).

### fixltx2e¶

Fixes some 'mistakes' in Latex. From the description:
• ensure one-column floats don't get ahead of two-column floats;
• correct page headers in twocolumn documents;
• stop spaces disappearing in moving arguments;
• allowing \fnysmbol to use text symbols;
• allow the first word after a float to hyphenate;
• \emph can produce caps/small caps text;
• bugs in \setlength and flushbottom.

### setspace¶

Use when you have to change the interline spacing instead of changing the \baselinestretch.

### booktabs¶

En­hances the qual­ity of ta­bles in LaTeX, pro­vid­ing ex­tra com­mands as well as be­hind-the-scenes op­ti­mi­sa­tion. Guide­lines are given as to what con­sti­tutes a good ta­ble in this con­text.

### microtype¶

The microtype package provides a LaTeX interface to the micro-typographic extensions of pdfTeX: most prominently, character protrusion and font expansion, furthermore the adjustment of interword spacing and additional kerning, as well as hyphenatable letterspacing (tracking) and the possibility to disable all or selected ligatures.

It allows to apply these features to customisable sets of fonts, and to configure all micro-typographic aspects of the fonts in a straightforward and flexible way. Settings for various fonts are provided.

### hyperref¶

If you're creating PDF documents, use hyperref to get hyperlinks in your document.

### geometry¶

Use geometry package to set up page geometry instead of doing it manually.

### fancyvrb¶

Use fancyvrb to get precise control in verbatim listings.

### siunitx¶

To type SI units.

### numprint¶

Format numbers nicely (locale-specific, with commas as thousands separator, etc.).

### todonotes¶

The pack­age lets the user mark things to do later, in a sim­ple and vi­su­ally ap­peal­ing way. The pack­age takes sev­eral op­tions to en­able cus­tomiza­tion/fine­tun­ing of the vi­sual ap­pear­ance.

## Tools That Help¶

### latexmk¶

http://ctan.tug.org/tex-archive/support/latexmk/