I'd like to increase the line spacing inside a tikz node. I've tried
doing this by increasing \baselineskip and changing the fontsize
(\fontsize{12pt}{20pt}\selectfont) but neither works.
What is the proper way to do this?
Thanks in advance.
Regards,
Marc van Dongen
Please post an example !
A tikz node can contains so many different things
(\hbox, \vbox, \halign) and the options to format it
are numerous !
If you use [text width=...] there is
\tikz{\node [text width=4cm] {coucou les amies \\[3mm] et les autres
aussi };}
> Please post an example !
\tikz\draw\node{some text which is really an argument of a macro!};
\tikz\node{As I wrote, I'd like to control the line spacing. I've
solved the problem by putting the text in a minipage and increase
\baselineskip in the minipage. This looks like a bit of overhead to
me.};
> A tikz node can contains so many different things
> (\hbox, \vbox, \halign) and the options to format it
> are numerous !
\tikz\node{And even more!};
> If you use [text width=...] there is
>
> \tikz{\node [text width=4cm] {coucou les amies \\[3mm] et les autres
> aussi };}
\tikz\node{Your solution assumes you know the text and uses hardcoded
linebreaks.
In my case, I'm dealing with the argument of a macro.
I think tikz does its own linebreaking.
It's also impossible to disable hyphenation in the box,
except if you
use the following, which I found online: \newlanguage
\nohyphens\language=\nohyphens.};
\tikz\node{Regards,\\[2\baselineskip]Marc van Dongen};
No in fact this is possible, but the material of the node is printed
inside a simple group. Thus like for \centering, changing \baselineskip
has no effect if \par is not executed, and if \par is executed after
the end of the group, the previous value of \baselineskip is used by TeX.
A solution:
\documentclass{article}
\usepackage [T1]{fontenc}
\usepackage {tikz,setspace}
\begin{document}\makeatletter
\tikz{\node [text width=5cm,draw]{\doublespacing
Is it possible to change the line stretching inside tikz
node?\endgraf};
\node [yshift=20mm,draw,text width=5cm]{\onehalfspacing
Is it possible to change the line stretching inside tikz
node?\endgraf};
\node [yshift=40mm,draw,text width=5cm]{\singlespacing
Is it possible to change the line stretching inside tikz
node?\endgraf};
}
\end{document}\endinput