Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tikz: increasing line spacing

2,334 views
Skip to first unread message

Marc van Dongen

unread,
Jun 24, 2011, 8:43:07 AM6/24/11
to
Dear all,


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

GL

unread,
Jun 24, 2011, 9:03:12 AM6/24/11
to
Le 24/06/2011 14:43, Marc van Dongen a �crit :

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 };}


Marc van Dongen

unread,
Jun 24, 2011, 10:02:44 AM6/24/11
to
On Jun 24, 2:03 pm, GL <gouail...@gmail.com> wrote:

> 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};

GL

unread,
Jun 24, 2011, 11:02:11 AM6/24/11
to
Le 24/06/2011 16:02, Marc van Dongen a �crit :

> On Jun 24, 2:03 pm, GL<gouail...@gmail.com> wrote:
>
>> 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.};

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

0 new messages