10

How to write off diagonal matrix in latex? off Diagonal matrix
I tried this

 \begin{align*}
   \left[
     \begin{array}{ccccc}
        &  &  &  & 1 \\
        &  &  & \ldots  \\
       1 &  &  &  &
     \end{array}
   \right]
  \end{align*}
1
  • 1
    Welcometo TeX.SE.
    – mmr
    Dec 8, 2021 at 5:05

3 Answers 3

11

You 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}
9

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:

enter image description here

Update

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:

enter image description here

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:

enter image description here

9
  • In LaTeX document don't use TeX syntax $$ .
    – Zarko
    Dec 8, 2021 at 6:03
  • @Zarko Corrected.
    – mmr
    Dec 8, 2021 at 6:06
  • 1
    @zarko you can use nicematrix😃
    – Sebastiano
    Dec 8, 2021 at 6:43
  • 2
    @Sebastiano, this cross my mind, but today is not my day :-(. Please be so kind and wrote an answer with nicematrix
    – Zarko
    Dec 8, 2021 at 8:30
  • 1
    @mmr, no, it is OK. On the same way as you write answer author of the package.
    – Zarko
    Dec 8, 2021 at 16:24
5

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).

Output of the above code

1
  • Great prof. You have a good day
    – Sebastiano
    Dec 8, 2021 at 12:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .