1

I like to use \vdots to obtain pictures like that (without the fbox of course):

enter image description here

The problem is that the \vdots are not vertically centered (the height is huge), and the dots are therefore not placed correctly on the picture. Ideally, I'd like a version of \vdots with the good height, and no depth (to ensure the shape is symetric), so that I can use \raisebox{-.5\height}{\cvdots} for instance to center it around baseline.

tobiasBora
  • 8,684

1 Answers1

1

Thanks to campa's comment (thanks!), I derived these many versions:

  • above baseline
  • aligned for math
  • centered on baseline
  • horizontal and centered on baseline

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{cd}
\usetikzlibrary{backgrounds,positioning}
\usetikzlibrary{shapes,shapes.geometric,shapes.misc}
\usepackage{graphicx}

\begin{document} \setlength{\fboxsep}{0pt}

\makeatletter %% https://tex.stackexchange.com/questions/528774/excess-vertical-space-in-vdots/528775#528775 \DeclareRobustCommand\cvdotsAboveBaseline{% \vbox{\baselineskip4\p@ \lineskiplimit\z@% \hbox{.}\hbox{.}\hbox{.}} } \makeatother

\DeclareRobustCommand{\cvdotsCenterMathline}{% % vcenter is used to center the argument on the 'math axis', which is at half the height of an 'x', or about the position of a minus sign. \vcenter{\cvdotsAboveBaseline}% }

\DeclareRobustCommand{\cvdotsCenterBaseline}{% \raisebox{-.5\height}{% $\cvdotsAboveBaseline$% }% }

\DeclareRobustCommand{\chdots}{% \raisebox{-.5\height}{% \rotatebox{90}{% Maybe better options than rotatebox... $\cvdotsAboveBaseline$% }% }% }

\DeclareRobustCommand{\chdotsLdots}{% Has a small space on the right and left, which chdots does not have \raisebox{\dimexpr\depth-.5\totalheight\relax}{$\ldots$}% }

\begin{tikzpicture} \node[fill=red] (A) {A}; \node[fill=blue,below=of A] (B) {B}; \path (A) -- (B) node[midway,anchor=center] {\makebox[0pt][r]{$n$ }$\cvdotsCenterMathline$}; \end{tikzpicture}

% Show baseline then vdots: Order: Original, above baseline, aligned for math, centered on baseline, horizontal and centered on baseline (2 versions):\ ABCp\rule{2cm}{0.1pt}\fbox{$\vdots$}\fbox{$\cvdotsAboveBaseline$}\fbox{$\cvdotsCenterMathline$}\fbox{$\cvdotsCenterBaseline$}\fbox{$\chdots$}\fbox{$\chdotsLdots$} \end{document}

tobiasBora
  • 8,684
  • I believe you are making stuff much more complicated that it needs to be... in particular, what's the advantage of rotating vertically stacked dots over using the good old \ldots? – campa Oct 06 '21 at 14:32
  • I guess \ldots could be fine (at least it has a symetric box, so could be centered using \raisebox{\dimexpr\depth-.5\totalheight\relax}{$\ldots$}), so I created a new version with it. However, it has a small left/right padding. – tobiasBora Oct 06 '21 at 15:11