3

I want to write one line of text in a booktabs table containing a TikZ drawing that is higher than the line-height. Per default the text is vertically aligned with the baseline of the TikZ drawing. I want it to be vertically aligned with the middle of the TikZ drawing.

Here is my code:

\documentclass[a4paper,11pt]{scrartcl}

\usepackage{xcolor}
\definecolor{HighlightColor}{RGB}{255,173,97}

\usepackage{booktabs}
\usepackage[radius=.09cm,edgeLength=1.5cm]{dynkin-diagrams}
\usepackage[left=3cm, right=3cm, top=4cm]{geometry}
\usepackage{mathtools}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz-cd}


\newcommand{\R}{\mathbb{R}}
\newcommand{\SL}{\operatorname{SL}}
\newcommand{\SO}{\operatorname{SO}}

\usepackage{graphbox}

\begin{document}


\begin{center}
\begin{tabular}[c]{p{1cm}cp{3cm}}
\toprule
$\Phi$  & 
Dynkin diagram & 
Symmetric space 
\\
\midrule
$\Phi_3$ & \vspace{1cm}
\begin{tikzpicture}
\draw[HighlightColor,densely dotted,thick] (0,0.5) arc (90:270:0.5);
\draw[HighlightColor,densely dotted,thick] (1.5,-0.5) arc (270:450:0.5);
\draw[HighlightColor,densely dotted,thick] (0,0.5) -- (1.5,0.5);
\draw[HighlightColor,densely dotted,thick] (0,-0.5) -- (1.5,-0.5);
\dynkin[mark=o,text/.style={scale=1.2}]{B}{3};
\end{tikzpicture}
$\rightarrow$
\begin{tikzpicture}
\dynkin[mark=o,text/.style={scale=1.2}]{A}{2};
\end{tikzpicture}
&
$\SL(3,\R)/\SO(3)$
\\
\bottomrule
\end{tabular}
\end{center}

\end{document}

What I have:

Unsatisfactory alignment in a table

What I want:

Desired alignment in a table

dynkin-diagrams.sty found here.

7

You can vertically center any picture without guessing values by a simple macro: \newcommand{\ctikz}[1]{$\vcenter{\hbox{#1}}$}. Just use \ctikz{<your picture>}. Also, no need for manual \vspace{1cm}.

\newcommand{\ctikz}[1]{$\vcenter{\hbox{#1}}$}

\begin{center}
\begin{tabular}{p{1cm} c p{3cm}}
\toprule
$\Phi$   & Dynkin diagram & Symmetric space \\
\midrule
$\Phi_3$ & %\vspace{1cm}
\ctikz{%
\begin{tikzpicture}
\draw[HighlightColor,densely dotted,thick] (0,0.5) arc (90:270:0.5);
\draw[HighlightColor,densely dotted,thick] (1.5,-0.5) arc (270:450:0.5);
\draw[HighlightColor,densely dotted,thick] (0,0.5) -- (1.5,0.5);
\draw[HighlightColor,densely dotted,thick] (0,-0.5) -- (1.5,-0.5);
\dynkin[mark=o,text/.style={scale=1.2}]{B}{3};
\end{tikzpicture}
}
$\rightarrow$
\ctikz{%
\begin{tikzpicture}
\dynkin[mark=o,text/.style={scale=1.2}]{A}{2};
\end{tikzpicture}
}
&
$\SL(3,\R)/\SO(3)$
\\
\bottomrule
\end{tabular}
\end{center}

enter image description here

5

Use the baseline option for the first picture, as described here:

\begin{tikzpicture}[baseline=-0.7ex] %<--- adjust as desired
\draw[HighlightColor,densely dotted,thick] (0,0.5) arc (90:270:0.5);
\draw[HighlightColor,densely dotted,thick] (1.5,-0.5) arc (270:450:0.5);
\draw[HighlightColor,densely dotted,thick] (0,0.5) -- (1.5,0.5);
\draw[HighlightColor,densely dotted,thick] (0,-0.5) -- (1.5,-0.5);
\dynkin[mark=o,text/.style={scale=1.2}]{B}{3};
\end{tikzpicture}

enter image description here

Remove (or adjust) the \vspace{1cm} that you added if you want to get rid of the extra space below the picture.

enter image description here

  • 1
    baseline=(current bounding box.center) might work. – Torbjørn T. May 31 '18 at 13:42
  • @TorbjørnT. Thanks for the suggestion; the left picture goes lower than the arrow when you do that. – AML May 31 '18 at 13:55
  • I accepted the other answer because it's a bit more convenient to use. But thank you very much for your answer too, which also would've solved my problem. – user538044 Jun 2 '18 at 12:38
2

an alternative, as exercise of use dynkin package:

\documentclass[a4paper,11pt]{scrartcl}
\usepackage[hmargin=3cm, top=4cm]{geometry}

\usepackage{xcolor}
\definecolor{HighlightColor}{RGB}{255,173,97}
\usepackage{booktabs}
\usepackage[radius=.09cm,edgeLength=1.5cm]{dynkin-diagrams}
\usepackage{mathtools}  % it also loads amsmath
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}


\newcommand{\R}{\mathbb{R}}
\newcommand{\SL}{\operatorname{SL}}
\newcommand{\SO}{\operatorname{SO}}

\usepackage{graphbox}

\begin{document}
    \begin{center}
\begin{tabular}{p{1cm}cp{3cm}}
    \toprule
$\Phi$      &   Dynkin diagram  &   Symmetric space     \\
\midrule
$\Phi_3$    &   \begin{tikzpicture}[baseline=-0.75ex]
                \draw[HighlightColor,densely dotted,thick]  (0.0,-0.5) arc (270:90:0.5) --
                                                            (1.5, 0.5) arc (90:-90:0.5) -- cycle;
                \dynkin[mark=o,text/.style={scale=1.2}] {B}{3};
                \draw[->] (3.3,0) -- + (0.5,0);
                \scoped[xshift=41mm]\dynkin[mark=o,text/.style={scale=1.2}]{A}{2};
                \end{tikzpicture}
                                &   $\SL(3,\R)/\SO(3)$  \\
    \bottomrule
\end{tabular}
    \end{center}
\end{document}

enter image description here

1

I made a few changes to the dynkin-diagrams package recently, which sadly mess up Zarko's code above. Here are the little changes you need to make to get it working again.

enter image description here

\documentclass[a4paper,11pt]{scrartcl}
\usepackage{xcolor}
\definecolor{HighlightColor}{RGB}{255,173,97}
\usepackage{booktabs}
\usepackage[radius=.09cm,edge-length=1.5cm,mark=o]{dynkin-diagrams}
\newcommand{\R}{\mathbb{R}}
\newcommand{\SL}[1]{\operatorname{SL}(#1,\R{})}
\newcommand{\SO}[1]{\operatorname{SO}(#1)}
\begin{document}
\begin{center}
\begin{tabular}{p{1cm}cp{3cm}}
\toprule
$\Phi$      &   Dynkin diagram  &   Symmetric space     \\
\midrule
$\Phi_3$    &   
                \begin{dynkinDiagram}{B}{3}
                \draw[HighlightColor,densely dotted,thick]  
                (0.0,-0.4) arc (270:90:0.5) --
                (1.5, 0.6) arc (90:-90:0.5) -- cycle;
                \end{dynkinDiagram}
                \tikz[baseline=-0.5ex] \draw[->] (3.3,0) -- + (0.5,0);
                \dynkin{A}{2}
                                &   $\SL{3}/\SO{3}$  \\
\bottomrule
\end{tabular}
\end{center}
\end{document}
  • your changes will impact all old use of dykin diagrams. is not possible to add old name for edge lenght for compatibility reasons? one question: if i include for example \dynkin{B}{3} in tikz node with dotted border, how to convinced that it wouldn't overtake node's option for dotted line? if you prefer, i can ask this as new question. – Zarko Jan 15 at 14:52
  • @Zarko: are you thinking of something like this: \tikz[dotted] \dynkin{B}{2} \draw (0,0) rectangle (1,1); seems ok, a dotted border around the rectangle, with no dots inside. – Benjamin McKay Jan 15 at 15:31
  • no. i did some experimets with something like this: \tikz \node[draw, dotted] {\dynkin{B}{2}};. is in this example possible to preserve solid lines in Dynkin's diagram? – Zarko Jan 15 at 15:54
  • Try \tikz \node[draw, dotted] {\dynkin[edge/.style={solid}]{B}{2}}; – Benjamin McKay Jan 15 at 15:56
  • this solve half of the problem, but circle is still not drawn in solid line ;-(. – Zarko Jan 15 at 16:02
0

considering Benjamin McKay's answer above package, where he inform us (at least me), that new version of this package have changes which hasn't back compatibility ... and some possibilities of use of this package, the new solution can be:

\documentclass[a4paper,11pt]{scrartcl}
\usepackage[hmargin=3cm, top=4cm]{geometry}

\usepackage{xcolor}
\definecolor{HighlightColor}{RGB}{255,173,97}
\usepackage{booktabs}
\usepackage[radius=.09cm,
            edge-length=1.5cm,    % <--- new syntax for edge lengths
            mark=o]{dynkin-diagrams}
\usetikzlibrary{fit, shapes.misc}

\newcommand{\R}{\mathbb{R}}
\newcommand{\SL}{\operatorname{SL}}
\newcommand{\SO}{\operatorname{SO}}

\begin{document}
    \begin{center}
\begin{tabular}{p{1cm}cp{3cm}}
    \toprule
$\Phi$      &   Dynkin diagram  &   Symmetric space     \\
\midrule
$\Phi_3$    &   \begin{tikzpicture}[baseline]
                \dynkin{B}{3}
                \node[rounded rectangle, draw=HighlightColor,
                     densely dotted, thick, fit=(root 1) (root 2)] {};
                \draw[->] (root 3) ++ (4mm,0) -- ++ (0.5,0) node[-,right]{\dynkin{A}{2}};
                \end{tikzpicture}
                                &   $\SL(3,\R)/\SO(3)$  \\
    \bottomrule
\end{tabular}
    \end{center}
\end{document}

which gives almost the same result as is obtained in other answers:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.