[Tex/LaTex] Techniques and packages to keep up with good practices

best practicespackagessyntaxwarnings

Question

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{fixltx2e}
\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:

\usepackage[strict=true]{csquotes}

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.

Best Answer

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 ...

Related Question