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

There is a comment between two child nodes down below, that if removed would cause tree to render completely wrong. Why?

\tikzstyle{every node}=[draw=black, thin, minimum height=3em]

        text centered, text width=12em,
        text centered, text width=12em,
        xshift=-3.2em, % Horizontal position of the child node
        text centered, text width=12em,
        edge from parent path={(\tikzparentnode.205) |- (\tikzchildnode.west)}
    level1/.style ={level distance=4em,anchor=west},
    level2/.style ={level distance=8em,anchor=west},
    level3/.style ={level distance=12em,anchor=west},
    level4/.style ={level distance=16em,anchor=west},
    level 1/.style={%
        edge from parent fork down,
        sibling distance=14em,
        level distance=5em
    \node[anchor=south,supervisor](super){Supervisor\\Supervisory position\\Location}[]

    child{node [teammate] {Teammate6\\Position4\\Location4}
        child[subordinate,level1] {node {Subordinate1}}
        child[subordinate,level2] {node {Subordinate2}}}
    % - why is this comment required for proper rendering of the tree???
    child{node [teammate] {Teammate7\\Position5\\Location5}
        child[subordinate,level1] {node {First\\Subordinate}}
        child[subordinate,level2] {node {Subordinate2}}
        child[subordinate,level3] {node {Third\\Teammate}}
        child[subordinate,level4] {node {Longtext-\\teammate}}};



With a comment:

enter image description here

Without a comment:

enter image description here

share|improve this question
I'm actually quite surprised that it even works. You're in general not allowed to have empty lines inside \node ... ;, since empty line is transformed into \par and that can cause troubles. – yo' Feb 14 '14 at 14:35
You can make that an answer! – ajeh Feb 14 '14 at 14:37
up vote 9 down vote accepted

Well, in general, you are not allowed to have empty lines inside \node ... ; or \coordinate ... ; or \draw ... ; or such. The reason is that empty line isn't just a whitespace that is easily trimmed, it transforms into a \par, which can cause a mess in such places.

So It's actually a bit of a surprise that the code compiles with those empty lines. It's certainly better to avoid them: either remove them completely, or at least add %, which "eats everything until the next end-of-line including this end-of-line", so no \par is generated.

share|improve this answer

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.