5

I need to typeset the following:

enter image description here

But I cannot seem to get the dotted line or the centered r_{i, j}. Can anyone show a minimal working example?

Werner
  • 603,163
Adam
  • 93
  • 3

4 Answers4

6

For the dotted line, you can use the arydshln package and set the dash length and spacing to appropriate values:

\usepackage{arydshln}    
\setlength{\dashlinedash}{0.5pt}
\setlength{\dashlinegap}{1pt}

For the centered r_{i,j}, you can nest a vertical array inside a horizontal array.

narray

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{arydshln}

\setlength{\dashlinedash}{0.5pt}
\setlength{\dashlinegap}{1pt}
\begin{document}
    \begin{equation*}
    R_{a,b}(\theta)=\left[\begin{array}{l:l}
    r_{i,j} & \begin{array}{l}
    r_{a,a}=\cos(\theta) \\
    r_{b,b}=\cos(\theta) \\
    r_{a,b}=-\sin(\theta) \\
    r_{b,a}=\sin(\theta) \\
    r_{j,j}=1,\quad j\ne a,\quad j\ne b \\
    r_{i,j}=0,\quad \mathrm{elsewhere} \\
    \end{array}
    \end{array}\right] \\
    \end{equation*}
\end{document}
wimi
  • 1,968
  • 8
  • 17
6

Another approach, a little bit simpler

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{arydshln}

\begin{document}

\[
R_{a,b}(\theta)=\left[\quad r_{i,j}\left.
\begin{array}{r;{2pt/2pt}l}
    &   r_{a,a}=\cos(\theta) \\
    &   r_{b,b}=\cos(\theta) \\
    &   r_{a,b}=-\sin(\theta) \\
    &   r_{b,a}=\sin(\theta) \\
    &   r_{j,j}=1,\quad j\ne a,\quad j\ne b \\
    &   r_{i,j}=0,\quad \mathrm{elsewhere} \\
\end{array}
\,\right.\right]
\]

\end{document}
Cragfelt
  • 4,005
3

A solution with pstricks for the dotted vertical line, and an alignedat environment inside a bmatrix, which allows for the alignment of the = signs:

\documentclass{article}

\usepackage{mathtools}
\usepackage{pst-node}
\usepackage{auto-pst-pdf} %% to compile with pdflatex

\begin{document}

\begin{equation*}
  \begin{pspicture}
    R_{a,b}(θ)=\begin{bmatrix}
      r_{i,j} & \begin{alignedat}{2}
        & \pnode[-1.3ex, 1ex]{B} & r_{a,a} & =\cos(θ) \\
        & & r_{b,b} & =\cos(θ) \\
        & & r_{a,b} & =-\sin(θ) \\
        & & r_{b,a} & =\sin(θ) \\
        & & r_{j,j} & =1,\quad j\ne a,\quad j\ne b \\
        & \pnode[-1.3ex, -0.25ex]{E} & r_{i,j} & =0,\quad \mathrm{elsewhere} \\
      \end{alignedat}
    \end{bmatrix}
    \ncline[linestyle = dotted, dotsep = 1.5pt]{B}{E}
  \end{pspicture}
\end{equation*}

\end{document}

enter image description here

Bernard
  • 271,350
3

It's easy with {bNiceArray} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

[ R_{a,b}(\theta)= \begin{bNiceArray}{c:l@{}l} \Block{*-1}{r_{i,j}} & r_{a,a} & =\cos(\theta) \ & r_{b,b} & =\cos(\theta) \ & r_{a,b} & =-\sin(\theta) \ & r_{b,a} & =\sin(\theta) \ & r_{j,j} & =1,\quad j\ne a,\quad j\ne b \ & r_{i,j} & =0,\quad \mathrm{elsewhere} \ \end{bNiceArray} ]

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250