0

My goal is to have the minipage of the second column vertically centered but I could not manage do do it. I tried the array package with the 'm' option : \tabular{c|m} but it did not worked, I also tried to set the [t] option both to the minipage and to the tabular but with no success.

Do you know a way to make it works?

Here is a minimal exemple:

\documentclass[10pt,mathserif,smaller,fleqn]{beamer}
\usepackage{tikz}
\usepackage{multicol}
\usepackage[utf8]{inputenc}
\usetheme{Antibes}
\setbeamertemplate{navigation symbols}{}

\begin{document}
    \frame{
        \begin{center}
            \begin{tabular}[t]{c|c}
                \multicolumn{2}{c}{Une architecture hybride}\\[0.4em]
            \hline~\\[0.4em]
                \begin{tikzpicture}[scale=.5]
                    \input{hybride.tikz}
                \end{tikzpicture}
            &
                \begin{minipage}[t]{0.4\textwidth}
                    \begin{itemize}
                        \item bla
                        \item bla
                        \item bla
                    \end{itemize}
                \end{minipage}
            \end{tabular}
       \end{center}
    }
\end{document}

And here is the file hybride.tikz

\tikzset{client/.style={draw,rectangle,rounded corners=3pt,color=blue},
     server/.style={draw,rectangle,color=red}};

\node[client] (A) at (0,0) {Pair};
\node[client] (B) at (8,0) {Pair};
\node[client] (C) at (4,6.92) {Pair};
\node[server] (D) at (4,2.31) {Oracle};

\draw[->, >=latex, color=blue] (A) to[bend left=10] (B);
\draw[->, >=latex, color=blue] (A) to[bend left=10] (C);
\draw[->, >=latex, color=blue] (B) to[bend left=10] (A);
\draw[->, >=latex, color=blue] (B) to[bend left=10] (C);
\draw[->, >=latex, color=blue] (C) to[bend left=10] (A);
\draw[->, >=latex, color=blue] (C) to[bend left=10] (B);
\draw[->, >=latex, thick, color=red, dashed] (D) -- (A);
\draw[->, >=latex, thick, color=red, dashed] (D) -- (B);
\draw[->, >=latex, thick, color=red, dashed] (D) -- (C);
3
  • 1
    This one might be relevant tex.stackexchange.com/q/154401/3929
    – daleif
    Jul 1, 2014 at 12:46
  • 1
    A fast ugly hack could be \begin{tikzpicture}[scale=.5,baseline=25mm]. BTW: using frame as an environment may make your code a lot easier to read.
    – daleif
    Jul 1, 2014 at 12:48
  • 1
    Thanks, I finally opted for the ugly hack with baseline=36mm. It's not perfect but it's still better than before. BTW, I take into account your other piece of advice. Jul 1, 2014 at 13:14

2 Answers 2

1

If the second column should be vertically centered to the picture you can use two m columns

\begin{tabular}{>{\centering}m{0.5\textwidth}|m{0.4\textwidth}}

enter image description here

Code:

\documentclass[10pt,mathserif,smaller,fleqn]{beamer}
\usepackage{tikz}
\usepackage{multicol}
\usepackage[utf8]{inputenc}
\usetheme{Antibes}
\setbeamertemplate{navigation symbols}{}

\usepackage{array}

\begin{document}
\begin{frame}
  \begin{center}
    \begin{tabular}{>{\centering}m{0.5\textwidth}|m{0.4\textwidth}}
      \multicolumn{2}{c}{Une architecture hybride}\\[0.4em]
      \hline~\\[0.4em]
      \begin{tikzpicture}[scale=.5]
        \tikzset{
          client/.style={draw,rounded corners=3pt,color=blue},
          server/.style={draw,color=red},
        }
          \foreach \n/\p in {A/{0,0},B/{8,0},C/{4,6.92}}
            \node[client](\n) at (\p) {Pair};
          \node[server] (D) at (4,2.31) {Oracle};
          \foreach \x/\y/\z in {A/B/C,B/A/C,C/A/B}
            \path[-latex,blue,bend left=10](\x) edge (\y)edge (\z);
          \foreach \x in {A,B,C}
            \draw[-latex,thick,red,dashed] (D) -- (\x);
      \end{tikzpicture}
      &
      \begin{minipage}{\linewidth}
        \begin{itemize}
            \item bla
            \item bla
            \item bla
        \end{itemize}
      \end{minipage}\\[0.8em]
      ~
    \end{tabular}
  \end{center}
\end{frame}
\end{document}
1
  • Thank you very much for your answer. Thanks to you I learnt that it is possible to refactor tikz code. Jul 1, 2014 at 14:35
1

Another alternative is use of package adjustbox with export option. Here valign=t,c,b can go with the minipage location specifiers t,c,b

enter image description here

Code

\documentclass[10pt,mathserif,smaller,fleqn]{beamer}
\usepackage{tikz}
\usepackage[export]{adjustbox}
\usepackage{multicol}
\usepackage[utf8]{inputenc}
\usetheme{Antibes}
\setbeamertemplate{navigation symbols}{}

\begin{document}
    \frame{
        \begin{center}
            \begin{tabular}[t]{c|c}
                \multicolumn{2}{c}{Une architecture hybride}\\[0.4em]
            \hline~\\[0.4em]
\begin{adjustbox}{valign=c}
\begin{tikzpicture}[scale=.5]
\tikzset{client/.style={draw,rectangle,rounded corners=3pt,color=blue},
     server/.style={draw,rectangle,color=red}};
\node[client] (A) at (0,0) {Pair};
\node[client] (B) at (8,0) {Pair};
\node[client] (C) at (4,6.92) {Pair};
\node[server] (D) at (4,2.31) {Oracle};
\draw[->, >=latex, color=blue] (A) to[bend left=10] (B);
\draw[->, >=latex, color=blue] (A) to[bend left=10] (C);
\draw[->, >=latex, color=blue] (B) to[bend left=10] (A);
\draw[->, >=latex, color=blue] (B) to[bend left=10] (C);
\draw[->, >=latex, color=blue] (C) to[bend left=10] (A);
\draw[->, >=latex, color=blue] (C) to[bend left=10] (B);
\draw[->, >=latex, thick, color=red, dashed] (D) -- (A);
\draw[->, >=latex, thick, color=red, dashed] (D) -- (B);
\draw[->, >=latex, thick, color=red, dashed] (D) -- (C);
\end{tikzpicture}
\end{adjustbox}
            &
\begin{minipage}[c]{0.4\textwidth}
\begin{itemize}
    \item bla
    \item bla
    \item bla
\end{itemize}
\end{minipage}
\end{tabular}
\end{center}
    }
\end{document}

You must log in to answer this question.

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