How to write off diagonal matrix in latex?
I tried this
\begin{align*}
\left[
\begin{array}{ccccc}
& & & & 1 \\
& & & \ldots \\
1 & & & &
\end{array}
\right]
\end{align*}
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYou can use the bmatrix
environment from amsmath
to typeset the matrix, and the command \iddots
from the package mathdots
for the dots.
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathdots}
\begin{document}
\[
R_n = \begin{bmatrix}
& & 1 \\
& \iddots & \\
1 & &
\end{bmatrix}
\]
\end{document}
This could be a solution with less code and beauty:
\documentclass{article}
\usepackage{mathdots} % http://ctan.org/pkg/mathdots
\begin{document}
\[
R_n = \left[
\begin{array}{ccccc}
& & & & 1 \\
& & \iddots & & \\
1 & & & &
\end{array}
\right]
\]
\end{document}
Output:
Similar types of dots can be found: \iddots
from mathdots
, \adots
from yhmath
or \reflectbox{$\ddots$}
from the graphicx
package.
Check this out:
\documentclass{article}
\usepackage{mathdots}
\usepackage{yhmath}
\usepackage{graphicx}
\usepackage{MnSymbol}
\begin{document}
Different types of diagonal dots:
\[
\begin{array}{ll}
\verb!\ddots! & \ddots \\
\verb!\udots! & \udots \\
\verb!\iddots! & \iddots \\
\verb!\adots! & \adots \\
\verb!\reflectbox{$\ddots$}! & \reflectbox{$\ddots$}
\end{array}
\]
\end{document}
Snippet:
This could be more nicer using nicematrix
.
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{equation*}
R_n =\begin{bNiceMatrix}
& & & 1 \\
& & \Iddots & \\
& & & \\
1 & & &
\end{bNiceMatrix}
\end{equation*}
\end{document}
Output:
Here is what you can do with {bNiceArray}
of nicematrix
.
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{align*}
\begin{bNiceArray}{cccc}
& & & 1 \\
& & \Iddots \\
\\
1 \\
\end{bNiceArray}
\end{align*}
\end{document}
You need several compilations (because nicematrix
uses PGF/Tikz nodes under the hood).