What techniques and packages are there to keep up with good practices?

What I already know

I already know of the following packages for this kind of purpose:

\RequirePackage[l2tabu,orthodox]{nag}% Old habits die hard. All the same, there are
                                     % commands, classes and packages which are 
                                     % outdated and superseded. nag provides routines
                                     % to warn the user about the use of those.
\usepackage[all,error]{onlyamsmath}  % Error on deprecated math commands like $$ $$.

I also know to use \( \) instead of $ $ and \[ \] instead of $$ $$ (as discussed in Are \( and \) preferable to $?). And that csquotes has a strict mode to turn warnings into errors:


And I am aware of the fact that mostly the content is more important than appearance and technicalities. Thus it is mostly a good practice to use packages and tools that lets you focus on content and to automate as much as possible, e.g. to automate compilation with latexmk.

  • Wait, what is wrong with $ $? I've not seen that listed in any of the best practice documents before and that is my standard way of doing math inline.
    – Canageek
    Sep 29, 2011 at 22:09
  • @Canageek See the link in parentheses.
    – N.N.
    Sep 30, 2011 at 6:39
  • Am I missing something or is it just less obscure error messages and easier parsing? I once saw a comment about AMSmath and it, but I don't see that mentioned their.
    – Canageek
    Sep 30, 2011 at 21:33

4 Answers 4


General tips

  1. Use as few packages as possible,
  2. Call the packages in particular order,
  3. Use many small documents instead of one big one,
  4. Comment your code,
  5. Write readable code,
  6. Concentrate on the content, not on the appearance.

General tips somewhat explained

  1. That's because packages tend to conflict and go obsolete. (See How to keep up with packages and know which ones are obsolete?)
  2. Some packages require (or are recommended) to be called before/after other packages. Some must be called among the last, some among the first. (See Packages that need to be included in a specific order)
  3. This means using \include{} and/or \input{} commands to compose all the small pieces (chapters, sections, etc.) into one continuous document. (See When should I use \input vs. \include?). [The rationale in this point is to keep the code clean and short (rule 5) in your master document. Then you can focus on content of each piece of the document (rule 6).] A benefit of this point is that you can get to set shortcut commands to use in all documents in a .tex file in your path, and then \input it in the preamble of any/all documents. This can make for a very large document to keep short at the eye at an initial stage of reading the master document pretty much like a short mwe.

  4. If one forgets what particular block of code does, reading the comments will help by the fastest possible way.

  5. This means short lines, appropriate line indentation, using \newcommand to define (mnemonic) commands for repetitive math expressions, etc.
  6. Hack little, think more, write on the subject. Appearance without content is nothing.

And probably other things ...

  • On general tips point 2. Any particular packages that are good to know about? I know about hyperref easily conflicting and the need for it to load late.
    – N.N.
    Jun 8, 2011 at 8:56
  • 1
    @N.N. One reason is that some packages load other packages. Other reason is that some packages make things that depend on previously loaded packages. Particular example other than hyperref - babel. It's loaded among the last. It's usually written in the documentation, but for big packages it's not that easy to find it. I mean it takes time. And the other way is to experiment, which is even more time consuming. But the results received by an experiment are proven. At last to the next package update. Jun 8, 2011 at 20:09
  • 1
    @N.N.: A couple of questions on this: tex.stackexchange.com/questions/3090/… and tex.stackexchange.com/questions/1863/…
    – doncherry
    Jun 11, 2011 at 11:08
  • 1
    "Concentrate on the content, not on the appearance." and "Appearance without content is nothing" are very narrow point of view and misleading. In my opinion, we must consider both because they are provided with cost, not free! Jul 20, 2011 at 16:10
  • 6
    What's the rationale behind (3)? Aug 11, 2011 at 20:48
  • Programing
    • fixltx2e is essential
    • etoolbox provides some functionality that one can only get from hacking LaTeX kernel or using the internal macros otherwise. Also it provides some useful document and environment hooks
    • xspace is a tiny but useful macro for defining text oriented macros
    • geometry, typearea, etc, use one and only one of them. The same principle apply for titlesec, fancyhdr, etc. In principle, avoid using packages provide similar functionality at the same time, especially when one of them hack the LaTeX kernel. Use the best of them only ("best" for you anyway).
  • Typography
    • booktabs is essential for professional look tables. Also avoid using vertical lines. In fact you should never use vertical lines and limit the use of horizontal lines
    • for typographical consideration, consistency is far more important than details. For example if you use \begin{tabularx}{\textwidth}{...}..., use it everywhere. Make all tales have the same feel.
    • figures, either from external software of using packages like tikz, produce them with the size they are meant to be. Try to avoid using \includegraphics[scale=...], etc
    • use \DeclareMathOperator, don't use \mathrm whenever suitable
    • use colors carefully, again, consistency is better than fancy. Define a few colors and stick with them only.
    • Use different weight, different size, different shapes, different font families, to present different things. But use one and only one of them. For example, don't use a bold large sans serif for heading, just bold, or just large, or just sans serif, or simple capitals of the body fonts.
    • Last not least, "every typographical rules can be broken, as long as you know the rule".
  • 1
    Thanks. I think I get most of your points but I'm curious about two of them. Why is scaling of graphics bad? Why \DeclareMathOperator instead of \mathrm?
    – N.N.
    Jun 7, 2011 at 12:13
  • 1
    @N.N. Scaling of graphics is very bad if they contain non vector elements. And scaling a pure vector graphic is bad, because line thickness also changes. If you have 1 pt coordinate axis line, scaling it to 50% will make it 0.5 pt. Jun 7, 2011 at 13:33
  • @Karl Karlsson That makes sense. The options xscale and yscale of tikzpicture are not bad though? They seem essential for many pictures, especially diagrams.
    – N.N.
    Jun 7, 2011 at 13:41
  • 2
    @N.N For tikzpicture, change the unit if you want to get the diagrams into a reasonable size. For example, say you prefer to write \draw (0,0) -- (100,0) for some reason (e.g., such that you don't have to calculate things like 0.0356 or whatever for a small part inside the diagram), change the unit by [x=1pt] or whatever suitable. This won't change thickness. \mathrm is just roman fonts in math mode, but \DeclareMathOperator declares, well, a math operator, which has the proper spacing for an operator. Of cause, anything not a operator shall just go with mathrm
    – Yan Zhou
    Jun 7, 2011 at 13:46
  • Just added fixltx2e and got a notification that this is now included by default since 2015...
    – LShaver
    May 11, 2017 at 4:28
  • Loading the strict package prevents using LaTeX's declarations as environments.

  • Loading the fixltx2e package fixes some LaTeX2e errors.

  • fixmath changes LaTeX's default math style to comply with some international standards, specifically regarding Greek letters, see package description.

  • There are many packages improving LaTeX's standard behavior, for example setspace and booktabs, and packages supporting typographic requirements/ styles and quality, such as siunitx and microtype, so preferring them over LaTeX standard features would be best practice. Recommended packages can be found here: What packages do people load by default in LaTeX.

  • 5
    isomath is better than fixmath. Jun 7, 2011 at 13:35

Also refcheck for checking "references in a document, looking for numbered but unlabelled equations, for labels which are not used in the text, for unused bibliography references."

NOTE: refcheck is currently not compatible with cleveref. See this question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .