Diagonal matrix in Latex

matrices

Does anybody know how I can get these symbols for a diagonal matrix in Latex?

enter image description here

Best Answer

I am sure there must be a better way, but you can combine a rotated rule with the brackets and a few hspaces and get kind of close. Note this won't scale vertically so don't try to put fractions (or something else tall) between the brackets. The expression with normal brackets is shown as well for comparison.

\documentclass{article}
\usepackage{rotating}
\newcommand\diagmatrix[1]{[\hspace{-1.6pt}\raisebox{7pt}{\rotatebox{-30}{\rule{1mm}{.15mm}}}\hspace{-1pt}#1\hspace{-1pt}\raisebox{-1pt}{\rotatebox{-30}{\rule{1mm}{.15mm}}}\hspace{-1.6pt}]}
\begin{document}
\[\diagmatrix{m_r}^{-1}\diagmatrix{k_r}\]
\[[m_r]^{-1}[k_r]\]
\end{document}

enter image description here

Related Question