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

After some trial and error, and a little help from this stack overflow question I was able to put together this code:



    \item one length
    \tikz[remember picture] \node[coordinate, yshift=0.7em] (n1) {};
    \item another length
    \tikz[remember picture] \node[coordinate, yshift=-0.2em] (n2) {};
    \item the longest length
    \tikz[remember picture] \node[coordinate, yshift=-0.2em] (n3) {};
    \item short
    \tikz[remember picture] \node[coordinate, yshift=-0.2em] (n4) {};

\begin{tikzpicture}[overlay,remember picture]
    \path (n4) -| node[coordinate] (n5) {} (n3);
    \path (n1) -| node[coordinate] (n6) {} (n3);
    \draw[thick,decorate,decoration={brace, amplitude=4pt}] 
        (n6) -- (n5) node[midway, right=3pt]{brace text};


which produces

side brace example

as desired. I am, however, a little unsure of why it works.

Do the path lines like \path (n4) -| node[coordinate] (n5) {} (n3); read like “make a node in the rectangular coordinate system that lines up with n4 in x and n3 in y”?

share|improve this question
Yes, you read that correctly. – Caramdir Oct 6 '11 at 3:55
Instead of node [coordinate], you can just use coordinate. – Jake Oct 6 '11 at 4:29
@Jake i knew node[coordinate] looked funny! – aeroNotAuto Oct 6 '11 at 16:16
up vote 5 down vote accepted

You're basically correct, but I usually think of this slightly differently: I would say the line reads like "Make a node at the halfway position of the rectangular path that goes from n4 to n5". The result is almost the same, but the distinction is that you're not just specifying a coordinate, but actually a full path, and you position a node on it.

The expressions

\path (0,0) -| node {X} (3,1);


\path (0,0) -| (3,1) node [pos=0.5] {X};

are equivalent, they both position a node at the coordinate (3,0). The position 0.5 is defined as the halfway point on linear paths, and as the corner in rectangular paths. Using the node keyword between the line type (--, |- or -|) and the second coordinate will place the node at position 0.5, using it between the first coordinate and the line type will place the node at position 0, and using it after the second coordinate will place the node at position 1.

The above expressions also both set the bounding box (and therefore the size of your picture) to include the points (0,0) and (3,1), because you defined the whole path from (0,0) to (3,1).

If you just want to position the node without altering the bounding box, you should use the syntax

\node at (0,0 -| 3,1) {X};

which specifies a coordinate in terms of the rectangular coordinate system between (0,0) and (3,1) without specifying the whole path.

share|improve this answer
ohhh, placement of the node keyword must be the reason it appeared to behave funny when i was setting it up. thanks. – aeroNotAuto Oct 6 '11 at 16:18

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.