LaTeX Recipes

For a complete Manual of Style: The Chicago Manual of Style.

Basic

Create spaces to align in math mode:

% Create a box with same height, depth, and width as subformula.
\phantom{subformula}
% Zero witdh box with same height and depth as subformula.
\vphantom{subformula}
% Zero height and depth box, and same width as subformula.
\hphantom{subformula}

Bold vectors and matrices:

\renewcommand{\vec}[1]{\mathbold{#1}}
\newcommand{\mat}[1]{\mathbold{#1}}

booktabs for clean and nice-looking tables.

% Needs: \usepackage{booktabs}
\begin{table}
    \centering
    \begin{tabular}{lrr}
        \toprule
                   & \multicolumn{2}{c}{Data}  \\
        \cmidrule(lr){2-3}
        Name       & A Column & Another column \\
        \midrule
        Some data  &       10 &             95 \\
        Other data &       30 &             49 \\
        \addlinespace
        Different stuff & 99 & 12 \\
        \bottomrule
    \end{tabular}
    \caption{Some data.}
    \label{table:nice-label}
\end{table}

siunitx package to format numbers, currencies, units, etc:

% Needs: \usepackage{siunitx}
\sisetup{
    round-mode = places,
    round-precision = 3
}%

Cost: \SI{100}{\$}.
Display percentage: \SI{50}{\percent}.
Rounding numbers: \num{1.23456}.

Speed up compilation

The include command can be used to compile a subset of files. Cleans pages before and after including the code.

Note: It is not possible to nest includes.

\includeonly{chapter1}
% ---
\include{chapter1}
\include{chapter2}
\include{chapter3}

The input command can also be used. It is a lower-level command, but works in nested files.

Enhancing

Microtype tries to enhance the appearance and readability of the document while exhibiting a minimum degree of visual obtrusion.

\usepackage[activate={true, nocompatibility},
            final,         % Use draft to disable.
            tracking=true, % Letter-spacing.
            kerning=true,  % Adjust spacing of of scpecial characters.
            spacing=true,  % Enable spacing between characters.
            %stretch=10,   % Default stretch can blur the text.
            %shrink=10,    % Default shrink can blur the text.
            ]{microtype}
\SetTracking{encoding={*}, shape=sc}{50} % Just personal preference.

Note: It is recommended to disable protrusion in TOC, LOF and LOT.

\microtypesetup{protrusion=false} % disable protrusion
\tableofcontents % print Table of Contents
\microtypesetup{protrusion=true} % enable protrusion again

Allow equations to be copied (from StackExchange):

% Needs: \usepackage{accsupp}
\newcommand\copypastable[1]{%
    \BeginAccSupp{method=escape,ActualText={\detokenize{#1}}}%
        #1%
    \EndAccSupp{}%
}