LaTeX Best Practices

Academic

Equations and Numbering

Simply speaking:

Environments align and aligned are defined in package amsmath.

Examples:

  1. A single equation
\begin{align}
\label{eq:massEnergyRelation}
E=mc^2
\end{align}
  1. multiple equations
\begin{align}
    E=&\hbar\Omega\\
    \vec p =& \hbar\vec k
\end{align}
  1. multiple equations with subnumbers
\begin{subequations}
\begin{align}
    \nonumber\dod{p_j}{t}&=-\dpd{\mathcal H}{q_j}\\
    \dod{q_j}{t}&=+\dpd{\mathcal H}{p_j}
\end{align}
\end{subequations}
  1. A long equation broken into two lines
\begin{align}
\begin{aligned}
  M = &\sum_n e^{in\theta}\ket{N-n, n}\bra{N-n, n} = \\
      &\sum_l e^{i (N/2-l)\theta}\ket{l}\bar{l}
\end{aligned}
\end{align}

Derivatives

Use packages physics and esdiff.

% those commands are from package physics
\dd x % differential
\dd[n] x % higher order differential
\dv{f}{x} % derivative df/dx
\dv[n]{f}{x} % higher order derivative
\pdv{f}{x} % partial derivative
\pdv[n]{f}{x} % higher order partial derivative
\pdf{f}{x}{y} % mixed partial  derivative
% the command below is from package esdiff
\diffp*{p}{V}{T} % partial derivative of p relative to V with T fixed.

Figures

  1. Insert a single figure
\usepackage{graphicx} % should be put in the preamble
\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{{y=x+0.1}.pdf} % pay attention to the filename
    \caption{$U/t=0.1$}
    \label{fig:y=x+0.1}
\end{figure}
  1. Insert multiple figures with subcaptions respectively
\usepackage{graphicx} % should be put in the preamble
\usepackage{subcaption} % should be put in the preamble
\begin{figure}
    \centering
    \begin{subfigure}[b]{0.48\textwidth}
        \centering
        \includegraphics[width=\textwidth]{{analyticalResults}.pdf}
        \caption{Analytical Results}
        \label{fig:analyticalResults}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.48\textwidth}
        \centering
        \includegraphics[width=\textwidth]{{imageFromExperiments}.eps}
        \caption{Image From Experiments}
        \label{fig:experimentalFigure}
    \end{subfigure}
    \caption{Analytical and experimental results.}
    \label{fig:analyticalAndExperimental}
\end{figure}

File names of images should be written as {filename}.eps in case there are some special characaters, like ., in the filename part.