A latex package to generate (anti)-diagonal matrices easily. Based on Enrico Gregorio's answer on tex.stackexchange.com
\documentclass{article}
\usepackage{diagmat}
\begin{document}
$\diagmat{1,2,3,4}$
$\diagmat[fences=b]{1,2,3,4}$
$\diagmat[mask=0]{1,2,3,4}$
$\diagmat[fences=v,mask=\cdot]{1,2,3,4}$
$\antidiagmat{1,2,3,4}$
$\antidiagmat[fences=b]{1,2,3,4}$
$\antidiagmat[mask=0]{1,2,3,4}$
$\antidiagmat[fences=v,mask=\cdot]{1,2,3,4}$
\end{document}
fences
: accept one of the following value:p
,b
,v
,B
, which corresponds topmatrix
,bmatrix
,vmatrix
,Bmatrix
inamsmath
. Default:p
.mask
: entries which are not on the (anti-)diagonal line. Default: empty.
All credits are Enrico Gregorio's. All bugs are mine.