# Vertical whitespace inside tikz node

I have a tikz node that looks like this:

It was generated using the following code:

\documentclass[a4paper,10pt]{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\node[align=center]{%
Tableau 0\\
\smallskip

\begin{tabular}{ll}TEXT\\TEXT\end{tabular}
};%
\end{tikzpicture}
\end{document}


You can see that the \smallskip was ignored. I suspect the problem was that TeX was not in the right mode -- vertical mode?

I thought I would get around the problem by wrapping the 'Tableau 0' and \\smallskip in a vertical-mode box. But unfortunately, it looks like all of those boxes require you to specify their width (cf. What are the different kinds of boxes in (La)TeX? ), and I would need something that stretches to the width of its content.

What's the easiest way to insert the whitespace here?

-
Do you need a table header inside the node? Two nodes or a matrix node would avoid this naturally. – percusse Jan 20 '13 at 20:07
I've been experimenting and two nodes worked well once I found out about 'north'. – Mohan Jan 20 '13 at 20:10
Why do you want insert a \smallkip there anyway? Do you want to fix the tight spacing between Tableau 0 and the first line in the tabular environment? Then I’d suggest you try Tableau 0\\\begin{tabular}[t]{ll}TEXT\\TEXT\end{tabular} (notice the [t]). – Qrrbrbirlbel Jan 20 '13 at 22:22
@Qrrbrbirlbel I wanted less than a full line of whitespace. – Mohan Jan 20 '13 at 22:37
@Mohan I’m just saying. The output of \\\\[\smallskipamount] and \\\begin{tabular}[t] seem very similar. I would even combine both methods if you want an additional (more than the normal baseline skip) between the caption and the first line of the tabular. – Qrrbrbirlbel Jan 20 '13 at 22:41

Instead of Tableau 0\\ \smallskip, use Tableau 0\\[1cm], or whatever distance you want.

-
Well, I’d suggest \\[\smallskipamount] to get the same skip that \smallskip produces (or \\\\[\smallskipamount to get that of \\\smallskip). – Qrrbrbirlbel Jan 20 '13 at 22:13
@Qrrbrbirlbel I didn't know that. Thanks ;) – Gutierrez PS Jan 20 '13 at 22:26

Two ways I can think of are:

1. Use a \parbox
2. Use the varwidth environment.

## Notes:

• \parbox does require a specification of the width so may not be preferable.
• Even though varwidth requires you to specify the width, that specification is the maximum width. The actual width is just the natural width of the content. So that is why in the MWE it is specified as \linewidth, some amount that you know is sufficiently large.
• A \bigskip was used in the MWE to make the spacing more obvious.

## Code:

\documentclass{article}
\usepackage{tikz}
\usepackage{varwidth}

\begin{document}
\begin{tikzpicture}
\node[align=center]{\parbox{2cm}{%
Tableau 0\\
\par\bigskip

\begin{tabular}{ll}TEXT\\TEXT\end{tabular}
}};%
\end{tikzpicture}
\begin{tikzpicture}
\node[align=center]{\begin{varwidth}{\linewidth}%
Tableau 0\\
\par\bigskip

\begin{tabular}{ll}TEXT\\TEXT\end{tabular}
\end{varwidth}};%
\end{tikzpicture}
\end{document}

-