6

I'm trying to typeset some multiline TikZ nodes inside a tabular environment. Somehow, the space between lines gets considerably shortened.

Here's my code:

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
    \node [align=center] {
    \underline{$(\alpha \land \beta)$}\\
    $\alpha$\\
    $\beta$
    };
\end{tikzpicture}

\begin{tabular}{c}
    \begin{tikzpicture}
        \node [align=center] {
    \underline{$(\alpha \land \beta)$}\\
        $\alpha$\\
        $\beta$
        };
 \end{tikzpicture}
\end{tabular}

\end{document}

Can someone explain what is happening and how can I prevent it?

4
  • 1
    A manual solution: Add \strut to every line. Commented Jul 18, 2013 at 2:08
  • Welcome to the site, Jerzy. For future reference, it's better to provide small, complete .tex documents rather than just snippets. Otherwise I have to type out \documentclass{article}, \end{document} etc., and work out which packages you've used, all before I can reproduce your situation on my machine and start thinking about a situation. Commented Jul 18, 2013 at 6:14
  • Qrrbrbirlbel, that didn't seem to work. Should I add \strut to the first or to the last cell in the row? Commented Jul 18, 2013 at 11:51
  • 1
    John, I'll remember that next time! Already edited the question to include document header, etc. Commented Jul 18, 2013 at 11:59

1 Answer 1

2

You could save the tikzpicture in a box, outside of the tabular, and then use it once you're inside the tabular. What I mean is...

\documentclass{article}
\usepackage{tikz}
\begin{document}
\newsavebox\john
\sbox\john{
\begin{tikzpicture}
    \node [align=center] {
    \underline{$(\alpha \land \beta)$}\\
    $\alpha$\\
    $\beta$
    };
\end{tikzpicture}
}

\begin{tabular}{c}
\usebox\john
\end{tabular}
\end{document}

enter image description here


By the way, if you're drawing proof trees, you might find the bussproofs or mathpartir packages helpful.

2
  • Thanks, that worked! I'm just drawing basic tableaux-style proofs in propositional logic. So far, Tikz trees are enough for my needs, but I'll have a look at those packages! Commented Jul 18, 2013 at 12:02
  • @JerzyBrzozowski Another package for proof trees is prooftrees.
    – Ignasi
    Commented Jun 9, 2017 at 6:57

You must log in to answer this question.

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