\documentclass{amsart}

\title{The Dynkin diagrams package}
\author{Ben McKay}
\date{\today}
 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{array}
\usepackage{xstring}
\usepackage{etoolbox} 
\usepackage{longtable}
\usepackage{showexpl} 
\usepackage{booktabs}
\usepackage{dynkin-diagrams}
\usetikzlibrary{backgrounds}
\usetikzlibrary{decorations.markings}

\newcommand{\C}[1]{\mathbb{C}^{#1}}
\renewcommand*{\arraystretch}{1.5}
\renewcommand\ResultBox{\fcolorbox{gray!50}{gray!30}}


\begin{document}

\maketitle
\tableofcontents


\section{Quick introduction}
This is a test of the Dynkin diagram package.
Load the package via
\begin{verbatim}
\usepackage{dynkin-diagrams} 
\end{verbatim}
(see below for options) and invoke it directly:

\begin{LTXexample}
The flag variety of pointed lines in 
projective 3-space is associated to 
the Dynkin diagram \dynkin[parabolic=3]{A}{3}.
\end{LTXexample}

or use the long form inside a \verb!\tikz! statement:
\begin{LTXexample}
\tikz \dynkin[parabolic=3]{A}{3};
\end{LTXexample}

or a TikZ environment:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin[parabolic=3,label]{A}{3}
\end{tikzpicture}
\end{LTXexample}
With labels for the roots:
\begin{LTXexample}
\dynkin[parabolic=3,label]{A}{3}
\end{LTXexample}
\newpage\noindent%
Make up your own labels for the roots:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin[parabolic=3]{A}{3}
\rootlabel{2}{\alpha_2}
\end{tikzpicture}
\end{LTXexample}
Use any text scale you like:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin[parabolic=3,textscale=1.2]{A}{3};
\rootlabel{2}{\alpha_2}
\end{tikzpicture}
\end{LTXexample}
and access root labels via TikZ:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin[parabolic=3]{A}{3};
\node at (root label 2) {\(\alpha_2\)};
\end{tikzpicture}
\end{LTXexample}
The labels have default locations:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin{E}{8};
\rootlabel{1}{\alpha_1}
\rootlabel{2}{\alpha_2}
\rootlabel{3}{\alpha_3}
\end{tikzpicture}
\end{LTXexample}
You can use a starred form to flip labels to alternate locations:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin{E}{8};
\rootlabel*{1}{\alpha_1}
\rootlabel*{2}{\alpha_2}
\rootlabel*{3}{\alpha_3}
\end{tikzpicture}
\end{LTXexample}
TikZ can access the roots themselves:
\typeout{AAAAAAA}
\begin{LTXexample}
\begin{tikzpicture}
\dynkin{A}{4};
\fill[white,draw=black] (root 2) circle (.1cm);
\draw[black] (root 2) circle (.05cm);
\end{tikzpicture}
\end{LTXexample}
Some diagrams will have double edges:
\begin{LTXexample}
\dynkin{F}{4}
\end{LTXexample}
or triple edges:
\begin{LTXexample}
\dynkin{G}{2}
\end{LTXexample}
\newpage\noindent%
Draw curves between the roots:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin[parabolic=429]{E}{8}
\draw[very thick, black!50,-latex]  (root 3.south) to [out=-45, in=-135] (root 6.south); 
\end{tikzpicture}
\end{LTXexample}
Draw dots on the roots:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin[label]{C}{8}
\dynkinopendot{3}
\dynkinopendot{7}
\end{tikzpicture}
\end{LTXexample}
Colours:
\begin{LTXexample}
\dynkin[color=blue!50,backgroundcolor=red!20]{G}{2}
\end{LTXexample}
Edge lengths:
\begin{LTXexample}
\dynkin[edgelength=1.2,parabolic=3]{A}{3}
\end{LTXexample}
Sizes of dots and crosses:
\begin{LTXexample}
\dynkin[dotradius=.08cm,parabolic=3]{A}{3}
\end{LTXexample}
Edge styles:
\begin{LTXexample}
\dynkin[edge=very thick,parabolic=3]{A}{3}
\end{LTXexample}
Open circles instead of closed dots:
\begin{LTXexample}
\dynkin[open]{E}{8}
\end{LTXexample}
Add closed dots to the open circles, at roots in the current ordering:
\begin{LTXexample}
\begin{tikzpicture}
\dynkin[open]{E}{8};
\dynkincloseddot{5}
\dynkincloseddot{8}
\end{tikzpicture}
\end{LTXexample}
More colouring:
\begin{LTXexample}
\begin{tikzpicture}[show background rectangle, 
    background rectangle/.style={fill=red!10}]
\dynkin[parabolic=1,backgroundcolor=blue!20]{G}{2}
\end{tikzpicture}
\end{LTXexample}
Cross styles:
\begin{LTXexample}
\dynkin[parabolic=124,cross=thin]{E}{8}
\end{LTXexample}
\newpage\noindent{}
Suppress arrows:
\begin{LTXexample}
\dynkin[arrows=false]{F}{4}
\end{LTXexample}
\begin{LTXexample}
\dynkin[arrows=false]{G}{2}
\end{LTXexample}

\section{Syntax}

The syntax is \verb!\dynkin[<options>]{<letter>}{<rank>}! where \verb!<letter>! is \(A,B,C,D,E,F\) or \(G\), the family of root system for the Dynkin diagram, and \verb!<rank>! is an integer representing the rank, or is the symbol \verb!*! to represent an indefinite rank:
\begin{LTXexample}
\dynkin[edge=thick,edgelength=.5cm]{A}{*}
\end{LTXexample}
\begin{LTXexample}
\dynkin[edge=thick,edgelength=.5cm]{B}{*}
\end{LTXexample}
\begin{LTXexample}
\dynkin[edge=thick,edgelength=.5cm]{C}{*}
\end{LTXexample}
\begin{LTXexample}
\dynkin[edge=thick,edgelength=.5cm]{D}{*}
\end{LTXexample}
Outside a TikZ environment, the command builds its own TikZ environment.


\newcommand*{\typ}[1]{\(\left<\texttt{#1}\right>\)}
\newcommand*{\optionLabel}[3]{%%
\multicolumn{2}{l}{\(\texttt{#1}=\texttt{#2}, \texttt{default}=\texttt{#3}\)} \\
}%%

\section{Options}
\par\noindent{}All \verb!\dynkin! options (except \texttt{affine}, \texttt{folded}, \texttt{label} and \texttt{parabolic} ) can also be passed to the package to force a global default option: 
\par\noindent%
\begin{verbatim}
\usepackage[
     ordering=Kac,
     color=blue,
     open,
     dotradius=.06cm,
     backgroundcolor=red]
     {dynkin-diagrams}
\end{verbatim}
\par\noindent%
\begin{tabular}{p{1cm}p{10cm}}
\optionLabel{parabolic}{\typ{integer}}{0} 
& A parabolic subgroup with specified integer, where the integer
is computed as \(n=\sum 2^i a_i\), \(a_i=0\) or \(1\), to say that root \(i\) is crossed, i.e. a noncompact root. \\
\optionLabel{color}{\typ{color name}}{black} \\
\optionLabel{backgroundcolor}{\typ{color name}}{white}
& This only says what color you have already set for the background rectangle. It is needed precisely for the \(G_2\) root system, to draw the triple line correctly, and only when your background color is not white. \\
\optionLabel{dotradius}{\typ{number}cm}{.05cm}
&      size of the dots and of the crosses in the Dynkin diagram \\
\optionLabel{edgelength}{\typ{number}cm}{.35cm}
&      distance between nodes in the Dynkin diagram \\
\optionLabel{edge}{\typ{TikZ style data}}{thin}
&      style of edges in the Dynkin diagram \\
\optionLabel{open}{\typ{true or false}}{false}
&      use open circles rather than solid dots as default \\
\optionLabel{label}{true or false}{false}
& whether to label the roots by their root numbers. \\
\optionLabel{arrows}{\typ{true or false}}{true}
& whether to draw the arrows that arise along the edges. \\
\optionLabel{folded}{\typ{true or false}}{true}
& whether, when drawing \(A\), \(D\) or \(E_6\) diagrams, to draw them folded. \\
\optionLabel{foldarrowstyle}{\typ{TikZ style}}{stealth-stealth}
& when drawing folded diagrams, style for the fold arrows. \\
\optionLabel{foldarrowcolor}{\typ{colour}}{black!50}
& when drawing folded diagrams, colour for the fold arrows. \\
\optionLabel{Coxeter}{\typ{true or false}}{false}
& whether to draw a Coxeter diagram, rather than a Dynkin diagram. \\

\optionLabel{ordering}{\typ{Adams, Bourbaki, Carter, Dynkin, Kac}}{Bourbaki}
& which ordering of the roots to use in exceptional root systems as follows:
\end{tabular}

\newpage

\NewDocumentCommand\tablerow{mm}%
{%
\(#1_{#2}\)
&
\dynkin[label,ordering=Adams]{#1}{#2}
&
\dynkin[label]{#1}{#2}
&
\dynkin[label,ordering=Carter]{#1}{#2}
&
\dynkin[label,ordering=Dynkin]{#1}{#2}
&
\dynkin[label,ordering=Kac]{#1}{#2}
\\
}%

\begin{center}
\begin{longtable}{@{}llllll@{}}
\toprule
& Adams & Bourbaki & Carter & Dynkin & Kac \\ \midrule
\endfirsthead
\toprule
Adams & Bourbaki & Carter & Dynkin & Kac \\ \midrule
\endhead
\bottomrule
\endfoot
\bottomrule
\endlastfoot
\tablerow{E}{6}
\tablerow{E}{7}
\tablerow{E}{8}
\tablerow{F}{4}
\tablerow{G}{2}
\end{longtable}
\end{center}


\par\noindent{}All other options are passed to TikZ.

\section{Finding the roots}
The roots are labelled from \(1\) to \(r\), where \(r\) is the rank.
The command sets up TikZ nodes \texttt{(root 1)}, \texttt{(root 2)}, and so on. 
Affine extended Dynkin diagrams have affine root are at \texttt{(root 0)}.
Use these tikz nodes to draw on the Dynkin diagram, as above.
It also sets up TikZ nodes \texttt{(root label 0)}, \texttt{(root label 1)}, and so on for the labels, and TikZ nodes \texttt{(root label swap 0)}, \texttt{(root label swap 1)}, and so on as alternative label locations, in case you want two labels on the same root, or the default choice doesn't look the way you like.
\begin{LTXexample}
\begin{tikzpicture}
\dynkin{E}{6};
\rootlabel{2}{\alpha_2}
\rootlabel{5}{\alpha_5}
\end{tikzpicture}
\end{LTXexample}

\section{Example: some parabolic subgroups}

\newcommand{\drawparabolic}[3]{#1_{#2,#3} & \tikz \dynkin[parabolic=#3]{#1}{#2}; \\}

\begin{center}
\begin{longtable}{@{}>{$}r<{$}m{2cm}m{2cm}@{}}
\endfirsthead
\endhead
\endfoot
\endlastfoot
\drawparabolic{A}{1}{0}
\drawparabolic{A}{1}{2}
\drawparabolic{A}{2}{0}
\drawparabolic{A}{2}{2}
\drawparabolic{A}{2}{4}
\drawparabolic{A}{2}{6}
\drawparabolic{B}{2}{6}
\drawparabolic{C}{3}{10}
\drawparabolic{D}{5}{8}
\drawparabolic{E}{6}{10}
\drawparabolic{E}{7}{202}
\drawparabolic{E}{8}{246}
\drawparabolic{F}{4}{26}
\drawparabolic{G}{2}{0}
\drawparabolic{G}{2}{2}
\drawparabolic{G}{2}{4}
\drawparabolic{G}{2}{6}
\end{longtable}
\end{center}



\section{Example: the Hermitian symmetric spaces}

 \renewcommand*{\arraystretch}{1.5}
\begin{center}
\begin{longtable}{@{}>{$}r<{$}m{2.2cm}m{5cm}@{}}
\endfirsthead
\endhead
\endfoot
\endlastfoot
  A_n &
  \dynkin[parabolic=16]{A}{*} & 
  Grassmannian of $k$-planes in $\C{n+1}$ 
  \\
  B_n &
  \dynkin[parabolic=2]{B}{*} & 
  $(2n-1)$-dimensional hyperquadric, i.e. the variety of null lines in $\C{2n+1}$
  \\
  C_n &
  \dynkin[parabolic=32]{C}{*} & 
  space of Lagrangian $n$-planes in $\C{2n}$
  \\
  D_n &
  \dynkin[parabolic=2]{D}{*} & 
  $(2n-2)$-dimensional hyperquadric, i.e. the variety of null lines in $\C{2n}$
  \\
  D_n &
  \dynkin[parabolic=64]{D}{*} & 
  one component of the variety of maximal dimension null subspaces of $\C{2n}$ \\
  D_n &
  \dynkin[parabolic=32]{D}{*} & 
  the other component\\
  E_6 &
  \dynkin[parabolic=2]{E}{6} &
  complexified octave projective plane\\
  E_6 & 
  \dynkin[parabolic=64]{E}{6}&its dual plane\\ 
  E_7 &
  \dynkin[parabolic=128]{E}{7}& the space of null octave 3-planes in octave 6-space
\end{longtable}
\end{center}


\section{Affine extended Dynkin diagrams}

\begin{LTXexample}
\dynkin[affine,edge=thick]{A}{*}
\end{LTXexample}

\begin{LTXexample}
\dynkin[edgelength=1cm,edge=thick,affine]{A}{*}
\end{LTXexample}

\begin{LTXexample}
\dynkin[scale=1.5,edge=thick,affine]{A}{*}
\end{LTXexample}


\begin{LTXexample}
\begin{tikzpicture}
\dynkin[affine,label]{A}{8};
\end{tikzpicture}
\end{LTXexample}


\begin{LTXexample}
\begin{tikzpicture}
\dynkin[affine]{A}{*};
\node at (root label 0) {\(\alpha_0\)};
\end{tikzpicture}
\end{LTXexample}

\begin{LTXexample}
\begin{tikzpicture}
\dynkin[affine]{A}{9}
\node at (root label 0) {\(\alpha_0\)};
\end{tikzpicture}
\end{LTXexample}

You can use TikZ to put in labels:

\begin{LTXexample}
\begin{tikzpicture}
\dynkin[affine]{A}{9};
\node at (root label 0) {\(\alpha_0\)};
\node at (root label 1) {\(\alpha_1\)};
\node at (root label 2) {\(\alpha_2\)};
\node at (root label 3) {\(\alpha_3\)};
\end{tikzpicture}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{A}{1}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{B}{8}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{B}{*}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{C}{8}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{C}{*}
\end{LTXexample} 

\begin{LTXexample}
\dynkin[affine,label]{D}{8}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{D}{*}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{E}{6}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{E}{7}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{E}{8}
\end{LTXexample}

Open circles instead of closed dots:
\begin{LTXexample}
\dynkin[affine,open,label]{E}{8}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{F}{4}
\end{LTXexample}

\begin{LTXexample}
\dynkin[affine,label]{G}{2}
\end{LTXexample}


\section{Coxeter diagrams}

\begin{LTXexample}
\dynkin[Coxeter]{B}{7}
\end{LTXexample}

\begin{LTXexample}
\dynkin[Coxeter]{F}{4}
\end{LTXexample}

\begin{LTXexample}
\dynkin[Coxeter]{G}{2}
\end{LTXexample}

\begin{LTXexample}
\dynkin[Coxeter]{H}{7}
\end{LTXexample}

\begin{LTXexample}
\dynkin[Coxeter]{I}{7}
\end{LTXexample}


\section{Folded Dynkin diagrams}

\begin{LTXexample}
\dynkin[folded]{E}{6}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{E}{6}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded]{A}{*}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{A}{1}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{A}{2}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{A}{3}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{A}{4}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{A}{10}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{A}{11}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label,arrows=false]{A}{11}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded]{D}{*}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{D}{1}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{D}{2}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{D}{3}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{D}{4}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{D}{10}
\end{LTXexample}

\begin{LTXexample}
\dynkin[folded,label]{D}{11}
\end{LTXexample}



\section{Satake diagrams}

We have incomplete support for Satake diagrams as yet, following the conventions of \cite{Helgason:2001}.

\begin{LTXexample}
\dynkin{A}{I}
\end{LTXexample}

\begin{LTXexample}
\dynkin{A}{II}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{I}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{II}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{III}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{IV}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{V}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{VI}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{VII}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{VIII}
\end{LTXexample}

\begin{LTXexample}
\dynkin{E}{XI}
\end{LTXexample}

\begin{LTXexample}
\dynkin{F}{I}
\end{LTXexample}

\begin{LTXexample}
\dynkin{F}{II}
\end{LTXexample}

\begin{LTXexample}
\dynkin{G}{I}
\end{LTXexample}

\begin{LTXexample}
\begin{tikzpicture}
\dynkin[open]{E}{6}
\draw[\dynkinfoldarrowstyle,\dynkinfoldarrowcolor]  
	(root 1.south) to [out=-45, in=-135] (root 6.south); 
\draw[\dynkinfoldarrowstyle,\dynkinfoldarrowcolor]  
	(root 3.south) to [out=-45, in=-135] (root 5.south); 
\end{tikzpicture}
\end{LTXexample}

\begin{LTXexample}
\begin{tikzpicture}
\dynkin[open]{E}{6}
\dynkincloseddot{3}
\dynkincloseddot{4}
\dynkincloseddot{5}
\draw[\dynkinfoldarrowstyle,\dynkinfoldarrowcolor] 
	(root 1.south) to [out=-45, in=-135] (root 6.south); 
\end{tikzpicture}
\end{LTXexample}

\section{Other stuff}

Some sophisticated diagrams:
\begin{center}
\begin{tikzpicture}
\dynkin[folded]{D}{9}
\foreach \i in {2,6,8,9} {
	\dynkinopendot{\i}
}
\dynkinline[white]{4}{5}
\dynkindots{4}{5}
\dynkinopendot{4}
\dynkincloseddot{5}
\end{tikzpicture}
\end{center}
can be drawn using sending TikZ options to \verb!\dynkinline! to erase the old edge, \verb!\dynkindots! to make indefinite edges, and then redrawing the roots next to any edge we draw:
\begin{LTXexample}
\begin{tikzpicture}[show background rectangle, 
    background rectangle/.style={fill=red!10}]
\dynkin[folded]{D}{9};
\foreach \i in {2,6,8,9} {
	\dynkinopendot{\i}
}
\dynkinline[red!10]{4}{5}
\dynkindots{4}{5}
\dynkinopendot{4}
\dynkincloseddot{5}
\end{tikzpicture}
\end{LTXexample}

Always draw roots after edges.

\nocite{*}
\bibliographystyle{amsplain}
\bibliography{dynkin-diagrams}
\end{document}
