Matrices (\mat)
          
          
        Macro Code
% Insert a matrix. Usage: \mat{a & b \\ c & d} or \mat[]{a & b \\ c & d}
\newcommand{\mat}[2][1]{\begingroup
  \renewcommand*{\arraystretch}{#1}
  \begin{bmatrix}#2\end{bmatrix}
\endgroup} 
  
Shortcut for inserting block matrices with an option for adjusting the vertical scale.
Examples
| Code | Output | 
|---|---|
| \mat{1 \\ 2} | $$\begin{bmatrix} 1 \\ 2 \end{bmatrix} $$ | 
| \mat[3]{1 \\ 2} | $$\begin{bmatrix} \\ 1\\ \\ 2 \\ \ \end{bmatrix} $$ | 
  More LaTeX macros are available at paulwintz.com/latex-macros.