TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Inside a TikZ node, one can force line breaks using \\ providing the align option of the node is set.

I would like to increase the line spacing inside a node. This can be done in the usual way with the optional parameter of \\, e.g. \\[1em]. Doing this for every line break is tedious though. Is there a way to increase the break globally, so that any \\ inside a node acts as \\[1em]?

EDIT: Almost there!




  , align=center
  , execute at begin node=\setlength{\baselineskip}{2em}

  \node[mynode] {
    this \\
    is \\
    \tikz \node[mynode] {a \\ break};


This produces:

Node breaks

The remaining question is how to place a 2em break before the inner node.

share|improve this question
Remark: it might be better to specify vertical distances in terms of ex's, not em's. – mbork Aug 5 '11 at 18:03
up vote 6 down vote accepted

What about this?




(If it doesn't work, try ending your node text with an explicit \par.)

Now as for the second part: this is not only non-trivial, but also not well-defined. As the name suggests, \baselineskip is the distance between the baselines of consecutive lines of text (or hboxes, if you prefer). In the case of the "inner" tikz node, there's the question: where its baseline is located? This is configurable by the tikz option baseline (this was hard to guess, right;)?), but if you set it higher, then - if you add another line or whatever below - the distance there will be to small.

Probably the best answer to your problem are the \lineskip and \lineskiplimit parameters. Actually (well, AFAIR, since I've got my copy of The TeXbook at my office), the rule is (more or less) as follows:

if TeX puts two boxes on a vertical list, it puts glue between them so the distance between their baselines equals \baselineskip. But, if the distance between the bottom of the upper box and the top of the lower one would be smaller than \lineskiplimit, the glue inserted equals \lineskip.

Therefore you might want to set it up the following way:

\baselineskip=<the distance you want between the baselines>
\lineskiplimit=<the threshold distance>
\lineskip=<the distance you want between the boxes (not their baselines!) if they are close to each other>

where "close to each other" means "closer than the threshold".

share|improve this answer
length macros need \ (aka escape character) but counter macros do not. I also did the same mistake often in the past. :-) – xport Aug 5 '11 at 18:43
@xport: This is because \baselineskip is a length defined by TeX itself. On the other hand if you create a counter by \newcounter{name} (a LaTeX command) this actually to the TeX \newcounter\c@name plus initializing plus creating the \thename macro. – Caramdir Aug 5 '11 at 19:42
+2 @Caramdir: OK. thanks. :-) – xport Aug 5 '11 at 20:25
xport: thanks for correcting me! Caramdir: thanks for the explanation! – mbork Aug 5 '11 at 21:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.