Matrices (\mat
)
Shortcut for inserting block matrices with an option for adjusting the vertical scale.
Definition
% Insert a matrix. Usage: \mat{a & b \\ c & d} or \mat[<vertical spacing>]{a & b \\ c & d}
\newcommand{\mat}[2][1]{\begingroup
\renewcommand*{\arraystretch}{#1}
\begin{bmatrix}#2\end{bmatrix}
\endgroup}
Examples
Code | Output |
---|---|
\mat{1 \\ 2} |
$$\begin{bmatrix} 1 \\ 2 \end{bmatrix} $$ |
\mat[3]{1 \\ 2} |
$$\begin{bmatrix} \\ 1\\ \\ 2 \\ \ \end{bmatrix} $$ |