21

I'd like the \vdots in this chain to have the same distance to both of the arrows. I know that I could manually shift the node so that it looks right, but there must be a better solution. How?

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{chains}
\begin{document}
\begin{tikzpicture}[start chain=going below,every join/.style={->}]
    \node [on chain, join] {A};
    \node [on chain, join] {$\vdots$};
    \node [on chain, join] {B};
\end{tikzpicture}
\end{document}

enter image description here

0

2 Answers 2

34

\vdots has been designed for matrices. You can use a modified version that doesn't add space at its top:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{chains}

\makeatletter
\DeclareRobustCommand{\rvdots}{%
  \vbox{
    \baselineskip4\p@\lineskiplimit\z@
    \kern-\p@
    \hbox{.}\hbox{.}\hbox{.}
  }}
\makeatother


\begin{document}
\begin{tikzpicture}[start chain=going below,every join/.style={->}]
    \node [on chain, join] {A};
    \node [on chain, join] {\rvdots};
    \node [on chain, join] {B};
\end{tikzpicture}
\end{document}

enter image description here

3
  • this is brilliant! Would it be possible to do something similar for \ddots ?
    – Ted Black
    Commented Nov 15, 2021 at 12:15
  • @TedBlack Copy the definition of \ddots and remove \kern 7\p@
    – egreg
    Commented Nov 15, 2021 at 13:10
  • Thanks @egreg this is great help. By the way, there is a way of defining custom diagonal dots with tikz (for people like me who struggle understanding TeX code :-) )
    – Ted Black
    Commented Nov 17, 2021 at 11:31
2

Try rotating the \cdots.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{chains}
\begin{document}
\begin{tikzpicture}[start chain=going below,every join/.style={->}]
    \node [on chain, join] {A};
    \node [on chain, join] {\rotatebox{90}{$\cdots$}};
    \node [on chain, join] {B};
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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