Advanced Formulae in Latex
Remember when you couln’t think of the correct commands to write a certain formula in latex because it’s been a year since you did it the last time? This might help you find the light.
Vectors
Using
1 | \newcommand{\ve}[1]{\mbox{\bf #1}} |
in your preamble, you can easily write vectors as follows:
1 2 3 | \begin{equation} \mathscr{L}(\ve v_i) = \ve v_i - \frac{1}{\left| N_i \right|} \sum_{j\in N_i} \ve v_j \end{equation} |
Matrices
You always need matrices. Try this code:
1 2 3 4 5 6 7 8 9 10 | \begin{equation} \begin{pmatrix} A & A_k \end{pmatrix} \begin{pmatrix} D \\ D_k \end{pmatrix} = 0 \end{equation} |
Multi-case definition
This code comes in handy to define certain funtions or matrices:
1 2 3 4 5 6 7 8 | \begin{equation} A_{ij} = \left\{ \begin{array}{l l} 1 & \quad (i,j) \in K \\ 0 & \quad \text{otherwise} \\ \end{array} \right \end{equation} |
formula, Latex, matrix, vector



Why don’t you use macros also for matrices and multi-case defintions?
You could, indeed, write a macro for matrices, e.g
and then write your matrix as
2
3
4
5
d = \mymatrix{
123 & 23423 \\
34 & 343}
\end{equation}.
But in my opinion, it does not really simplify the code. And the same goes for multi-case definitions.