The following example redefines \vdots
and \ddots
to get a resizable version according to the current math style. The vertical space between the dots is taken from the horizontal dots. Also the dots in \ddots
match the vertical spacing of \vdots
and the horizontal spacing of the horizontal dots in \cdots
. \cdots
adds a thin space at the right side. For a better alignment in matrices, the redefined \ddots
also adds this space.
The space above \vdots
and \ddots
is not fixed, the space between the dots is used for the additional vertical space above the symbol. It's a tiny bit smaller in \textstyle
and \displaystyle
than the original symbols, but the resizing in \scriptstyle
and \scriptscriptstyle
is much better as the bsmallmatrix
example shows.
The following example shows the bsmallmatrix
with the resizable dots.
Then a normal bmatrix
follows to show the symbols in the normal larger style. Then the bmatrix
follows with the original \vdots
and \ddots
, saved in \orgvdots
and \orgddots
.
At the end of the example, the bounding boxes for the symbols in the different math styles are shown, first the original symbols, then the redefined symbols.
\documentclass{article}
\usepackage{mathtools}
\usepackage{letltxmacro}
\LetLtxMacro\orgvdots\vdots
\LetLtxMacro\orgddots\ddots
\makeatletter
\DeclareRobustCommand\vdots{%
\mathpalette\@vdots{}%
}
\newcommand*{\@vdots}[2]{%
% #1: math style
% #2: unused
\sbox0{$#1\cdotp\cdotp\cdotp\m@th$}%
\sbox2{$#1.\m@th$}%
\vbox{%
\dimen@=\wd0 %
\advance\dimen@ -3\ht2 %
\kern.5\dimen@
% remove side bearings
\dimen@=\wd2 %
\advance\dimen@ -\ht2 %
\dimen2=\wd0 %
\advance\dimen2 -\dimen@
\vbox to \dimen2{%
\offinterlineskip
\copy2 \vfill\copy2 \vfill\copy2 %
}%
}%
}
\DeclareRobustCommand\ddots{%
\mathinner{%
\mathpalette\@ddots{}%
\mkern\thinmuskip
}%
}
\newcommand*{\@ddots}[2]{%
% #1: math style
% #2: unused
\sbox0{$#1\cdotp\cdotp\cdotp\m@th$}%
\sbox2{$#1.\m@th$}%
\vbox{%
\dimen@=\wd0 %
\advance\dimen@ -3\ht2 %
\kern.5\dimen@
% remove side bearings
\dimen@=\wd2 %
\advance\dimen@ -\ht2 %
\dimen2=\wd0 %
\advance\dimen2 -\dimen@
\vbox to \dimen2{%
\offinterlineskip
\hbox{$#1\mathpunct{.}\m@th$}%
\vfill
\hbox{$#1\mathpunct{\kern\wd2}\mathpunct{.}\m@th$}%
\vfill
\hbox{$#1\mathpunct{\kern\wd2}\mathpunct{\kern\wd2}\mathpunct{.}\m@th$}%
}%
}%
}
\makeatother
\begin{document}
\begin{gather*}
\begin{bsmallmatrix}
a_{11} & a_{12} & \cdots & a_{1m} \\
a_{21} & a_{22} & \cdots & a_{2m} \\
\vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & \cdots & a_{nm}
\end{bsmallmatrix}
\\
\begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1m} \\
a_{21} & a_{22} & \cdots & a_{2m} \\
\vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & \cdots & a_{nm}
\end{bmatrix}
\\
\begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1m} \\
a_{21} & a_{22} & \cdots & a_{2m} \\
\orgvdots & \orgvdots & \orgddots & \orgvdots \\
a_{n1} & a_{n2} & \cdots & a_{nm}
\end{bmatrix}
\end{gather*}
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\newcommand*{\test}[1]{%
\fbox{$#1\orgvdots$}%
\fbox{$#1\orgddots$}%
\fbox{$#1\vdots$}%
\fbox{$#1\ddots$}%
\fbox{$#1\dots$}%
\fbox{$#1\cdots$}%
\fbox{$#1\cdotp\cdotp\cdotp$}%
}
\begin{gather*}
\test{}\\
\test{\scriptstyle}\\
\test{\scriptscriptstyle}
\end{gather*}
\end{document}

$
to put the dots in math mode but you have omitted them here.\scalebox
makes no difference.\svdots
still works fine, but\sddots
does not.\scalebox{.75}{$\ddots$}
; it's not really needed for\vdots
, but it's better to add$
also around it, for consistency.