Wiki » Histórico » Versão 4
« Anterior -
Versão 4/5
(diferença) -
Próximo » -
Versão atual
Cristovao Andre Antunes Cruz, 17/10/2013 18:59
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¶
listings¶
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¶
Enhances the quality of tables in LaTeX, providing extra commands as well as behind-the-scenes optimisation. Guidelines are given as to what constitutes a good table in this context.
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.
titlesec¶
Manipulate the table of contents look, among other things.
siunitx¶
To type SI units.
numprint¶
Format numbers nicely (locale-specific, with commas as thousands separator, etc.).
todonotes¶
The package lets the user mark things to do later, in a simple and visually appealing way. The package takes several options to enable customization/finetuning of the visual appearance.
tikz¶
pgf/tikz produces very high quality images that fit perfectly with the whole document and workflow. Challenging to master, but the results are very good and platform independent since the images are just tikz code and are interpreted by the latex engine.
pgfplots¶
Produce high quality plots with very little effor. Supports many sorts of plots, including logarithmic and smith charts. The end result fits very nicely with a latex document.
tikz-timing¶
Produce simple timing diagrams. Requires knowledge of pgf/tikz to customize diagrams and include, for example, arrows pointing to transitions. Must be included after pgfplots if both are in use.
Tools That Help¶
latexmk¶
http://ctan.tug.org/tex-archive/support/latexmk/
latexdiff¶
Useful Links¶
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes
http://stackoverflow.com/questions/193298/best-practices-in-latex