Utilities for writing papers with LaTeX
latexie.sty
: The main style file with many custom commandslatexie-article.cls
: A plain article class with nice format settings
- Faster paper writing (especially in the computer science domain)
- Shorter commands while preserving readability (e.g.,
\bfx
rather than\mathbf{x}
) - Better maintainability by providing semantic commands (e.g.,
\T
rather than\top
for the matrix transposition)
\usepackage{/path/to/this/repository/latexie}
- Prefer
\newcommand
and\renewcommand
(LaTeX) to\def
(TeX) - Prefer
\newcommand*
to\newcommand
if it is the intention
- Prefer
\DeclareMathOperator
(fromamsmath
package) to\newcommand
- Use
\top
for the matrix and vector transpose operator- List of mathematical symbols - Wikipedia (Retrieved: 2022/04/03)
noannotation
: If this option is passed, the annotation commands do not display annotaions. More specifically,\note
and\todo
do not rendered, and\spot
displays its content without colored.
- amsmath
- amsfonts
- ifthen
- xcolor
Before:
p(\mathcal{D} \:\vert\: \boldsymbol{\theta})
After:
\cprob{ \calD }{ \bftheta }
Result:
Before:
\mathcal{N}(\mathbf{x}; \boldsymbol{\mu}, \boldsymbol{\Sigma})
=
\frac{1}{(2 \pi)^{\frac{n}{2}} \det(\boldsymbol{\Sigma})^{\frac{1}{2}}}
\exp \left\{
- \frac{1}{2} (\mathbf{x} - \boldsymbol{\mu})^{\top} \boldsymbol{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu})
\right\}
After:
\calN(\bfx; \bfmu, \bfSigma)
=
\frac{1}{(2 \pi)^{\frac{n}{2}} \det(\bfSigma)^{\frac{1}{2}}}
\exp \left\{
- \frac{1}{2} (\bfx - \bfmu)^\T \bfSigma^\inv (\bfx - \bfmu)
\right\}
Result:
Before:
\begin{bmatrix}
\mathbf{A} & \mathbf{B} \\
\mathbf{C} & \mathbf{D}
\end{bmatrix}^{-1}
=
\begin{bmatrix}
\mathbf{A}^{-1} ( \mathbf{I} + \mathbf{B} ( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1} \mathbf{C} \mathbf{A}^{-1} ) &
- \mathbf{A}^{-1} \mathbf{B} ( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1} \\
- ( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1} \mathbf{C} \mathbf{A}^{-1} &
( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1}
\end{bmatrix}
After:
\bmat{
\bfA & \bfB \\
\bfC & \bfD
}^\inv
=
\bmat{
\bfA^\inv ( \bfI + \bfB ( \bfD - \bfC \bfA^\inv \bfB )^\inv \bfC \bfA^\inv ) &
- \bfA^\inv \bfB ( \bfD - \bfC \bfA^\inv \bfB )^\inv \\
- ( \bfD - \bfC \bfA^\inv \bfB )^\inv \bfC \bfA^\inv &
( \bfD - \bfC \bfA^\inv \bfB )^\inv
}
Result:
Some commands are probably not very effective with
- code highlighting
- code completion
- code snippets
See example.tex
for a working example. It can be compiled by using pdflatex
. If you use latexmk
, then run this command:
latexmk -pdf example