[Tex/LaTex] Tikz: How to do line spacing in a multiline node with different font sizes

tikz-pgf

I would like to create nodes in Tikz having multiple lines.

This works fine using the "align"-option.
But I also would like to use different font sizes and here my problem starts.

If I create a node like in the following code all three lines have the same spacing. This means the new smaller font size lines are having the same space as with the normal font size and this does not look nice.

How can I reduce the space for the lines with a smaller font size in the same node?

At the moment it looks a little bit like this:

Test

~

f

~

f

and it should look like this:

Test

f

f

Thank you very much 🙂

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

\begin{tikzpicture}
\node[align=center] (test) {test \\ {\tiny second line} \\ {\tiny third line}};
\end{tikzpicture}

\end{document}

Best Answer

use

\begin{tikzpicture}
\node[align=center] (test) {\shortstack{test \\ 
         \tiny second line \\ \tiny third line}};
\end{tikzpicture}