LaTeX Guidelines
This notation guide is inspired by Deep Learning by Ian Goodfellow, Yoshua Bengio and Aaron Courville (opens in a new tab) whilst trying to stay short and compatible with KaTeX (opens in a new tab) (Docusaurus support) and MathJax (opens in a new tab) (Jupyter Notebook support). This page is also meant as a cheat sheet for me on latex structures such as matrices etc.
Numbers and Arrays
If we wanted tensors to also be bold we would have to write \mathsf{\boldsymbol{A}}
which is sadly not nice and short.
Description | Code | Example |
---|---|---|
Scalar (integer or real) | a=2 | |
Vector, lowercase italic bold | \boldsymbol{a} | |
Matrix, uppercase italic bold | \boldsymbol{A} | |
Tensor, uppercase sans-serif | \mathsf{A} | |
Identity matrix with rows and columns | \boldsymbol{I}_n | |
Identity matrix with implied dimensionality | \boldsymbol{I} | |
Square diagonal matrix with elements along main diagonal given by | \text{diag}(\boldsymbol{a}) |
Indexing
Description | Code | Example |
---|---|---|
Element of vector , with indexing starting at 1 | a_i | |
All elements of vector except for element | a_{-i} | |
Element of matrix , with corresponding to the row index and the column index | A_{i,j} or a_{ij} | or |
Row of matrix | \boldsymbol{A}_{i,:} | |
Column of matrix | \boldsymbol{A}_{:,j} |
Linear Algebra Operations
Description | Code | Example |
---|---|---|
Tranpose of matrix | \boldsymbol{A}^T | |
Moore-Penrose pseudoinverse of matrix | \boldsymbol{A}^\dagger | |
Hadamard (element-wise) product of and | \boldsymbol{A} \odot boldsymbol{B} | |
Determinant of matrix | \text{det}(\boldsymbol{A}) | |
Trace of matrix | \text{tr}(\boldsymbol{A}) |
Sets and Graphs
Description | Code | Example |
---|---|---|
Set | A | |
Set of natural numbers, including | \Bbb{N}=\{0,1,2,3,...\} | |
Set of integer numbers | \Bbb{Z} | |
Set of rational numbers | \Bbb{Q} | |
Set of irrational numbers | \Bbb{I} | |
Set of real numbers | \Bbb{R} | |
Set of complex numbers | \Bbb{C} |