Mathematical notation
When writing equations, it is helpful to have a coherent and consistent way of writing variables, vectors, matrices, etc. It helps the reader identifying what you are talking about and remembering the semantics of each symbol.
Notation
We propose the following rules for writing math:
- uppercase italic for constants: (
N = 5
) - lowercase italic for the corresponding index: (
1 \leq n \leq N
) - lowercase italic for variables: (
x
) - lowercase italic bold for vectors: (
\mathbold{x}
) - uppercase italic bold for matrices: (
\mathbold{X}
) - uppercase italic for random variables: (
X
) - uppercase callygraphy for sets: (
\mathcal{X} = \{1,2,3\}
)
The \mathbold
command comes from the fixmath
package and is similar to \boldmath
or \bm
, except that all symbols are in italics, event greek letters (other packages do not italicize greek letters).
When adding indices or exponents to variables, make sure that you add them outside of the styling of the variable, i.e., write \mathbold{x}_i
and not \mathbold{x_i}
.
Define custom commands
Because we often refer to variables, we suggest defining the following two commands:
\renewcommand{\vec}[1]{\mathbold{#1}}
\newcommand{\mat}[1]{\mathbold{#1}}
You can then use \vec{x}
and \mat{X}
in your document.
If you decide to change the way you want to format matrices, you simply have to change the \mat
command, and it will update the whole document.
We also suggest defining commands for the variables you use the most.
For example, if you use \vec{x}
and \mat{X}
a lot, consider defining these commands:
\newcommand{\vx}{\vec{x}}
\newcommand{\vX}{\mat{X}}
You can then write more compact equations: \vx \vy^T = \vZ
is really close to .
Use the correct notation for columns et elements
Note that you should always style the variables with respect to their type. For example, the ith element of a vector is and not (it is a number). Similarly, if you have a matrix , its th column is , and not (it is a vector, thus in bold), and one of its element is , and not .
Environments
Use \(...\)
to write inline equations.
You can also use $...$
, but it is a TeX command and gives more obscure error messages.
To write centered equations on their own lines, do not $$...$$
(it is one of the deadly sins of LaTeX use).
It works, but gives wrong spacing.
Use \begin{equation}
or \begin{align}
instead.