6

I want something like this for my Dynkin diagrams:

enter image description here

What I'm not able to create is the middle arrowhead. Up until now I managed to obtain this:

\documentclass{report}
\usepackage{amsmath,amssymb,tikz-cd}
\begin{document}
\begin{tikzcd}
\underset{1}{\bullet}
\arrow[shorten <= -6pt, shorten >= -6pt, no head, r]
& \underset{2}{\bullet}
\arrow[shorten <= -6pt, shorten >= -6pt, no head, r]
& \underset{3}{\bullet}
&[-22pt] \dots
&[-25pt] \underset{n-1}{\bullet}
\arrow[shorten <= -12pt, shorten >= -7pt, shift right=0.5, no head, r]
\arrow[shorten <= -12pt, shorten >= -7pt, shift left=0.6, no head, r]
& \underset{n}{\bullet}
\end{tikzcd}
\end{document}

which gives me this: enter image description here How can I obtain (only one) arrow head in the middle of the two arrows which connect the last two nodes?

EDIT: I am really grateful to @Qrrbrbirlbel, he/she devoted a lot of time to my problem, but in the end I used the dynkin diagrams package, so I accepted the other answer.

toyr99
  • 63
  • decorations.markings library: Q3161 or a custom pic. – Qrrbrbirlbel Jul 04 '23 at 14:01
  • 2
    If you are not happy with the dynkin-diagrams package (https://ctan.org/pkg/dynkin-diagrams), please let me know what you would like to be done differently. – Benjamin McKay Jul 04 '23 at 18:07
  • @BenjaminMcKay Is there a way to reduce the angle on the last two edges of the diagram D_n? Also, are there more styles for the indefinite edges? – toyr99 Jul 06 '23 at 06:48
  • 2
    On page 4 of the dynkin-diagrams manual you can find ways to customize the indefinite edge. As for changing the angle, I can only offer a cheat: \begin{dynkinDiagram}[edge length=1cm,root radius=3pt, labels={1,2,n-1,n},/tikz/yscale=0.5,*/.append style={yscale=2}]D{**.***} \end{dynkinDiagram}. Anyway, these are just some minor remarks. –  Jul 06 '23 at 15:40

2 Answers2

7

The arrow in the middle is placed via the arrow pic, alternatively you can use the decorations.markings library.

We can setup tikzcd in a way that places a bullet at each cell. We will use labels via the quotes library to place the numbers below the bullets. The \mathstrut in the setup makes it so that all those nodes have the same height/depth which will align them better.

The dots key can be used to place dots instead of a normal line.

The dbl key uses the nfold library and the same 1.2ex as the every bullet style to draw two parallel lines.

The mid arrow uses the arrow pic to place an arrow tip halfway along the arrow. Use < to reverse the direction.

Three parallel lines are drawn by a combination of dbl and a normal arrow. (This could be improved but it's the easiest to do.)

If this is needed more and especially for curved paths, we will need another solution (nfold = 3) but we might want to make sure the middle line won't be drawn over the dots in case you want to use different colors for bullets and arrows.

Using between origins with the column and row separator helps align the dots in a properly grid without the labels messing it up.

Code

\documentclass[varwidth]{standalone}
\usepackage{tikz}
\usetikzlibrary{cd, nfold, quotes}
\tikzset{
  pics/arrow/.style={/tikz/sloped, /tikz/allow upside down,
    code=\pgfarrowdraw{#1}}, pics/arrow/.default=>}
\tikzcdset{
  dynkin/.style={
    every matrix/.append style={
      row sep={2em,between origins}, column sep={2.5em,between origins}},
    arrows={dash, thick},
    dots/.style={
      path only,
      /tikz/every to/.append style={
        edge node={node[%
          commutative diagrams/every label, font=, auto=false, sloped]{$\cdots$}}}},
    dbl/.style={
      start anchor=center, end anchor=center,
      double distance between line centers=+1.2ex, nfold=2},
    mid arrow/.default=,
    mid arrow/.style={
      /tikz/every to/.append style={edge node={
        pic[{sloped, allow upside down,</.style={xscale=-1},##1}]
          {arrow={Straight Barb[angle'=120]}}}}},
    cells={nodes={circle, inner sep=+0pt, minimum size=+1.2ex, draw, fill, thick}},
    /tikz/label position=below,
    /tikz/every label/.style={
      commutative diagrams/every label, shape=rectangle,
       execute at begin node=\mathstrut, path only}}}
\tikzcdset{label dynkin/.style 2 args={execute at end picture={
  \node[xshift=-.6666em,left,text depth=+0pt]at(\tikzcdmatrixname-#1.west){$#2$};}}}
\begin{document}
\begin{tikzcd}[dynkin, label dynkin={1-1}{A_n, n>0}]
|["1"]| \ar[r] & |["2"]| \ar[r] & |["3"]| \ar[r, dots] & |["n-1"]| \ar[r] & |["n"]|
\end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={1-1}{B_n, n>1}] |["1"]| \ar[r] & |["2"]| \ar[r] & |["3"]| \ar[r, dots] & |["n-1"]| \ar[r, dbl, mid arrow] & |["n"]| \end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={1-1}{C_n, n>2}] |["1"]| \ar[r] & |["2"]| \ar[r] & |["3"]| \ar[r, dots] & |["n-1"]| \ar[r, dbl, mid arrow=<] & |["n"]| \end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={2-1}{D_n, n>3}, row sep=tiny] & & & & & |["n'" right]| \ |["1"]| \ar[r] & |["2"]| \ar[r] & |["3"]| \ar[r, dots] & |["n-1"]| \ar[r] & |["n"]| \ar[ur] \ar[dr] \ & & & & & |["n^*" right]| \end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={2-1}{E_6}] & & |["3'" above]| \ |["1"]| \ar[r] & |["2"]| \ar[r] & |["3"]| \ar[r] \ar[u] & |["4"]| \ar[r] & |["5"]| \end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={2-1}{E_7}] & & |["3'" above]| \ |["1"]| \ar[r] & |["2"]| \ar[r] & |["3"]| \ar[r] \ar[u] & |["4"]| \ar[r] & |["5"]| \ar[r] & |["6"]| \end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={2-1}{E_8}] & & |["3'" above]| \ |["1"]| \ar[r] & |["2"]| \ar[r] & |["3"]| \ar[r] \ar[u] & |["4"]| \ar[r] & |["5"]| \ar[r] & |["6"]| \ar[r] & |["7"]| \end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={1-1}{F_4}] |["1"]| \ar[r] & |["2"]| \ar[r, dbl, mid arrow] & |["3"]| \ar[r] & |["4"]| \end{tikzcd}

\begin{tikzcd}[dynkin, label dynkin={1-1}{G_2}] |["1"]| \ar[r] \ar[r, dbl, mid arrow] & |["2"]| \end{tikzcd} \end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821
  • Thanks a lot, this is (almost) perfect. The only two things I'd like to change are: 1) I want the nodes to be full and 2) in the example with three lines the center one doesn't touch B. How can I fix this? – toyr99 Jul 04 '23 at 14:29
  • just one more thing: overleaf says that "Package tikz Error: I did not find the tikz library 'nfold'. I looked for files named tikzlibrarynfold.code.tex and pgflibrarynfold.code.tex, but neither could be found in the current texmf trees.." – toyr99 Jul 04 '23 at 15:04
  • also, I would really like the lines to be tangent to the bullets in the example with three lines. Would that be possible to implement? – toyr99 Jul 04 '23 at 16:05
  • Judging by the picture it looks like the lines connecting A and B are not touching the bullet on the "edge". I would like them to intersect opposite endpoints of a diameter. And what do you mean by implementing it myself? Can I implement it on overleaf? By the way thanks a lot, you are really helpful :) – toyr99 Jul 04 '23 at 16:30
  • ok, I found a way to add it to overleaf. Thanks a lot! Just one last thing: what if I want the arrow to point left? I tried putting "l" instead of "r" but to no avail. – toyr99 Jul 04 '23 at 17:01
  • Again a problem: when typesetting the diagrams E6, E7, E8, the number of the upper node intersects its arrow (e.g. \begin{tikzcd}[dynkin] & & 3 \ar[d] & & & \ 1 \ar[r] & 2 \ar[r] & 3 \ar[r, dots] & n-1 \ar[r, dbl, mid arrow] & n \end{tikzcd} ) – toyr99 Jul 04 '23 at 17:10
  • @toyr99 My previous attempt is much better even if it means adding |[" and "]| around the labels. But once you get the hang for it (or paste it from your clipboard) it's a much better solution without reinventing the wheel. – Qrrbrbirlbel Jul 04 '23 at 19:02
7

There is a wonderful, tizkz-based package for Dynkin diagrams: dynkin-diagrams. The diagrams are highly customizable, and the manual is very well written. The diagram you are after can be obtained very straightforwardly.

\documentclass{report}
\usepackage{amsmath,amssymb}
\usepackage{dynkin-diagrams}
\begin{document}
\begin{dynkinDiagram}[edge length=1cm,root radius=3pt,
    labels={1,2,n-1,n}]B{**.**}
\end{dynkinDiagram}
\end{document}

enter image description here