Simplifying and automating LaTeX with shortex.sty

Using LaTeX has a number of big benefits when writing papers:

  • it separates content (your words) and format (how they are laid out on a page)
  • it is stored in plaintext, which is useful for version control
  • it is extendable, a huge base of helpful packages exists
  • it keeps track of references, bibliography citations, links
  • it is currently the only decent option for typesetting math
  • it makes professional-looking papers by default
  • it is basically required by every conference/journal in ML/stats

But it also has a number of drawbacks. The shortex.sty style file is designed to help make typesetting a little less painful and LaTeX code a little easier to read. It provides:

  • automatic reference typing using cleveref
  • automatic equation numbering using autonum
  • a few nice commands for adding comments inline or in the margins
  • shortened commands for align environments
  • short commands for commonly used math symbols
  • a collection of oft-imported packages

For example, standard LaTeX math syntax can be quite painful to read and type:

See Equation \ref{eq:foo}.
\begin{align}
X_n &\in \mathcal{X} \notag\\
X_n &\overset{\text{p}}{\to} X \label{eq:foo}\\
\mathbb{E}\left[X\right] &= \int_0^1 6\frac{\mathrm{d} 4y^2}{\mathrm{d} y}\mathrm{d}y \notag\\
\mathbb{P}\left(X_n \in \mathcal{A}\right) &= \hat{\mathbb{C}} \notag\\
X_n &\sim \mathcal{N}(\hat{\mu}, \hat{\Sigma}). \notag
\end{align}

The shortex.sty style file includes a number of packages and macros to help make typesetting mathematical documents in LaTeX less painful and LaTeX code easier to read. Here is the same expression as above in shortex.sty syntax:

See \cref{eq:foo}.
\[
X_n &\in \fcX\\
X_n &\convp X \label{eq:foo}\\
\ex\lt[X\rt] &= \int_0^1 6\der{4y^2}{y}\dee y\\
\pr\lt(X_n \in \fcA\rt) &= \fbhC\\
X_n &\dist \distNorm(\fhmu, \fhSigma)
\]