17

I would like to typeset the following set of equations: enter image description here

... but with contiguous, vertical dotted lines in the column vectors, such that the top and bottom rows of the matrix and of the vectors are well aligned.

\vdots doesn't seem to be the right choice here, as I used it to produce the graphic above. The code is the following:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{equation}
  \begin{pmatrix}
    a_1 & b_1 &     &     &     &\\
    c_2 & a_2 & b_2 &     &     &\\
        & c_3 & a_3 & b_3 &     &\\
        &     & c_4 & a_4 & b_4 &\\
        &     &     & c_5 & a_5 & b_5\\
        &     &     &     & c_6 & a_6
  \end{pmatrix}
  \begin{pmatrix}
    T_1\\
    \vdots\\
    \vdots\\
    \vdots\\
    \vdots\\
    T_6
  \end{pmatrix}=
  \begin{pmatrix}
    d_1\\
    \vdots\\
    \vdots\\
    \vdots\\
    \vdots\\
    d_6
  \end{pmatrix}
\end{equation}
\end{document} 

If this isn't good style in terms of mathematical notation conventions (which I don't know), then, of course, I would write out the elements of the vectors. Clarification would be welcome.

3 Answers 3

14

You can do it like this, provided your main matrix has no unusually big objects (otherwise you can play with the first argument to \dottedcolumn that also accepts decimal numbers).

\documentclass{article}
\usepackage{amsmath}

\newcommand{\dottedcolumn}[3]{%
  \settowidth{\dimen0}{$#1$}
  \settowidth{\dimen2}{$#2$}
  \ifdim\dimen2>\dimen0 \dimen0=\dimen2 \fi
  \begin{pmatrix}\,
    \vcenter{
      \kern.6ex
      \vbox to \dimexpr#1\normalbaselineskip-1.2ex{
        \hbox{$#2$}
    \kern3pt
    \xleaders\vbox{\hbox to \dimen0{\hss.\hss}\vskip4pt}\vfill
    \kern1pt
    \hbox{$#3$}
  }\kern.6ex}\,
  \end{pmatrix}
}

\begin{document}
\begin{equation}
  \begin{pmatrix}
    a_1 & b_1 &     &     &     &\\
    c_2 & a_2 & b_2 &     &     &\\
        & c_3 & a_3 & b_3 &     &\\
        &     & c_4 & a_4 & b_4 &\\
        &     &     & c_5 & a_5 & b_5\\
        &     &     &     & c_6 & a_6
  \end{pmatrix}
  \dottedcolumn{6}{T_1}{T_6}=\dottedcolumn{6}{d_1}{d_6}
\end{equation}
\end{document} 

enter image description here

9

Taking some code from How to get a good "divisible by" symbol?, you can create your own \vdots that has any number of predefined dots. Here I've defined \sixvdots:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\sixvdots}{%
  \vbox{\baselineskip1ex\lineskiplimit0pt%
  \hbox{.}\hbox{.}\hbox{.}\hbox{.}\hbox{.}\hbox{.}}}
\begin{document}
\begin{equation}
  \begin{pmatrix}
    a_1 & b_1 &     &     &     &\\
    c_2 & a_2 & b_2 &     &     &\\
        & c_3 & a_3 & b_3 &     &\\
        &     & c_4 & a_4 & b_4 &\\
        &     &     & c_5 & a_5 & b_5\\
        &     &     &     & c_6 & a_6
  \end{pmatrix}
  \begin{pmatrix}
    T_1\\
    \sixvdots\\
    T_6
  \end{pmatrix}=
  \begin{pmatrix}
    d_1\\
    \sixvdots\\
    d_6
  \end{pmatrix}
\end{equation}
\end{document}

Increasing the value of \baselineskip stretches out the dots.

4
  • 4
    Lesser artists borrow, great artists steal. ;-)
    – egreg
    May 17, 2013 at 15:28
  • I will have to play with the \baselineskip value? Isn't there some automatic way to ensure exactly equal heights of all matrices + vectors?
    – AlexG
    May 17, 2013 at 15:28
  • 1
    nice, but i think a bit more space between the top line and the dots would be an improvement. maybe the same amount of space that separates rows of the matrix would look best. May 17, 2013 at 15:29
  • @AlexG: egreg seems to have delivered with a rough estimate, as expected... Since the context is not fully known, there is some user-intervention required to optimize the result. You want to avoid cluttering the interface with box measurements (to extract the height, say) if it is not really needed.
    – Werner
    May 17, 2013 at 16:32
4

I suggest using the package nicematrix which has functionalities dedicated to this problem.

Just with adding in the preamble:

\usepackage{nicematrix}
\NiceMatrixOptions{renew-dots,renew-matrix,nullify-dots}

we obtain: enter image description here

Here is the complete code.

 \documentclass{article}
 \usepackage{amsmath}

 \usepackage{nicematrix}
 \NiceMatrixOptions{renew-dots,renew-matrix,nullify-dots}

 \begin{document}
 \begin{equation}
   \begin{pmatrix}
     a_1 & b_1 &     &     &     &\\
     c_2 & a_2 & b_2 &     &     &\\
         & c_3 & a_3 & b_3 &     &\\
         &     & c_4 & a_4 & b_4 &\\
         &     &     & c_5 & a_5 & b_5\\
         &     &     &     & c_6 & a_6
   \end{pmatrix}
   \begin{pmatrix}
     T_1\\
     \vdots\\
     \vdots\\
     \vdots\\
     \vdots\\
     T_6
   \end{pmatrix}=
   \begin{pmatrix}
     d_1\\
     \vdots\\
     \vdots\\
     \vdots\\
     \vdots\\
     d_6
   \end{pmatrix}
 \end{equation}
 \end{document} 

You must log in to answer this question.

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