# Text in Tikz node not respecting baselineskip

I'm trying to include a few lines of text in a Tikz drawing, using a custom font size. However, when defining a font size, the baselineskip is only respected for the first line. See the minimal working example, below.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[text width=4cm] {\fontsize{14pt}{20pt}\selectfont Foo\\Bar\\Baz};
\end{tikzpicture}

\end{document}


This results in:

I would like to have the lines evenly spaced out. Should I approach this differently?

• Give an option [,font=\fontsize{14pt}{20pt}\selectfont] instead – percusse Mar 1 '15 at 11:49
• That's not an option, really. I'm switching multiple font sizes in some of the nodes. – Joost Mar 1 '15 at 16:39

Hmm Tikz ought to fix that, but meanwhile make sure you have a \par or blank line in the scope of any font size change,

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[text width=4cm] {\fontsize{14pt}{20pt}\selectfont Foo\\Bar\\Baz\par};
\end{tikzpicture}

\end{document}

• Hmm, additionaly context is relevant here; it's taking place inside a fancyhf header element, and that does not accept ending paragraphs. Anything I can do in that case? – Joost Mar 1 '15 at 11:56
• @Joost use \endgraf instead of \par (but Tikz ought to have done it for you:-) – David Carlisle Mar 1 '15 at 11:58
• TikZ does it if you provide the option in the appropriate option. – percusse Mar 1 '15 at 12:14
• @percusse it should do it anyway I think. a node with a width is in all other respects a \parbox and parboxes (or even a primitive \vbox) always have an implied end of para at the end. Tikz nodes not doing that is mightily odd, if not absolutely a bug. – David Carlisle Mar 1 '15 at 12:16
• @percusse sure but I can see no case where putting the users text in vmode without ending the paragraph is ever the right thing to do. Certainly no standard latex command ever does that. Picture mode never does that (I knew there was a reason I stuck with that:-) – David Carlisle Mar 1 '15 at 12:23