Correctly format \vdots in small matrix
I propose a \svdots
macro for “scaling” vertical dots. I've never really liked the standard definition, to be honest.
\documentclass{article}
\usepackage{amsmath}
\DeclareRobustCommand{\svdots}{% s for `scaling'
\vbox{%
\baselineskip=0.33333\normalbaselineskip
\lineskiplimit=0pt
\hbox{.}\hbox{.}\hbox{.}%
\kern-0.2\baselineskip
}%
}
\begin{document}
$S=
\begin{pmatrix}
\sigma_1 & 0 & 0\\
0 & \sigma_2 & \svdots\\
0 & \dots &
\end{pmatrix}
\begin{pmatrix}
\sigma_1 & 0 & 0\\
0 & \sigma_2 & 0\\
0 & \dots &
\end{pmatrix}$
\scriptsize
$S=\begin{pmatrix}
\sigma_1 & 0 & 0\\
0 & \sigma_2 & \svdots\\
0 & \dots &
\end{pmatrix}$
\end{document}
If you want the vertical dots centered with respect to the formula axis, you can do
\documentclass{article}
\usepackage{amsmath}
\DeclareRobustCommand{\svdots}{% s for `scaling'
\vcenter{%
\offinterlineskip
\hbox{.}
\vskip0.25\normalbaselineskip
\hbox{.}
\vskip0.25\normalbaselineskip
\hbox{.}%
}%
}
\begin{document}
$S=
\begin{pmatrix}
\sigma_1 & 0 & 0\\
0 & \sigma_2 & \svdots\\
0 & \dots &
\end{pmatrix}
\begin{pmatrix}
\sigma_1 & 0 & 0\\
0 & \sigma_2 & 0\\
0 & \dots &
\end{pmatrix}$
\scriptsize
$S=\begin{pmatrix}
\sigma_1 & 0 & 0\\
0 & \sigma_2 & \svdots\\
0 & \dots &
\end{pmatrix}$
\end{document}
I would do that with stackengine
, which has a \Vectorstack
command for math mode:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{stackengine}
\begin{document}
\scriptsize
$S=\begin{pmatrix}\sigma_1 & 0 & 0\\
0 &\sigma_2 & \Vectorstack{\vdots}\\
0 &\dots &
\end{pmatrix}$
\end{document}
For a \vdots centred w.r.t. the middle of the 0 in the row, you can try this:
$S=\begin{pmatrix}\sigma_1 & 0 & 0\\[0.5ex]
0 &\sigma_2 & \raisebox{-0.12\height}[0pt][0pt]{$\vdots$}\\[0.5ex]
0 &\dots &
\end{pmatrix}$
Using the package nicematrix
adjusting the values of \NiceMatrixOptions
to -5pt
(minimum value),
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{nicematrix}
\begin{document}
\NiceMatrixOptions{cell-space-top-limit=-5pt,cell-space-bottom-limit=-5pt}
$S=\begin{pNiceMatrix}
\sigma_{1} & 0 & 0\\
0 & \sigma_{2} & \vdots \\
0 & \ldots &
\end{pNiceMatrix}$
\end{document}
you can obtain similar output.