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

I'm trying to do this picture :

I have a problem to draw the curved paths.




       rounded corners=2ex,
       minimum height=0.2cm,
       minimum width=1in,
      rounded corners=2ex,
      minimum height=0.5in,
      minimum width=2in,
      rounded corners=2ex,
   myarrow/.style args={#1 colored by #2 and #3}{
      line width=#1,
      postaction={draw,-stealth,#3,line width=(#1)/3,
      shorten <=(#1)/3,
      shorten >=2*(#1)/3}, 
   toptext/.style={    % <-- New
      text width=6cm,

\node (string) [b] {string};
\node (number) [b, below=0.3 cm of string] {number};
\node (object) [b, below=0.3 cm of number] {object};
\node (array) [b, below=0.3 cm of object] {array};
\node (true) [b, below=0.3 cm of array] {true};
\node (false) [b, below=0.3 cm of true] {false};
\node (null) [b, below=0.3 cm of false] {null};

\draw  (string.west) -- ++(-70pt,0pt);
\draw  (string.east) -- ++(70pt,0pt);


share|improve this question
Yeah I will look at it. We should change it's title to that question! I haven't found that question when asked mine. – Hunsu May 25 '14 at 17:17
The answer here use pst-node. I use tikz. – Hunsu May 25 '14 at 17:21
up vote 3 down vote accepted

Some ideas:

  1. Define coordinates named left and right (for example) which contain the coordinate at which the curve starts and ends at the sides of (string) node. For example:

    \coordinate (left) at ($(string.west)+(-20pt,0pt)$);
    \coordinate (right) at ($(string.east)+(20pt,0pt)$);
  2. Use the syntax (left) -- +(2ex,0) |- (number) for example, to draw a polygonal line between the point named left, another point 2ex to its right, and a L shaped line descending up to the level of node named number, and finally to that node. The trick is to use rounded corners=2ex for this polygonal, so that the radius is equal to the distance to the second point.

  3. Similarly, the curve at the right side is drawn with (number) -| ($(right)+(-2ex,0)$) -- +(right)

  4. In fact, both parts can be combined in a single \draw command, unless you want arrows for the first half but not for the second half, for example.

  5. All the above has to be done for each node below (string), so it can be easily iterated in a loop.

So the code will be:

\coordinate (left) at ($(string.west)+(-20pt,0pt)$);
\coordinate (right) at ($(string.east)+(20pt,0pt)$);

\draw  ($(left) +(-30pt, 0)$) -- (string);
\draw  (string.east) -- ($(right) + (30pt,0)$);

\foreach \token in {number, object, array, true, false, null} {
    \draw[rounded corners=2ex] (left) -- +(2ex,0) |- (\token) -| ($(right)+(-2ex,0)$) -- (right);    



Note: the rest of the code is not shown because is identical to the one you provided, except that I changed rounded corners=1ex (instead of 2ex) for the b/.style. Using 2ex caused some artifacts because this radius is greater than half the height of the boxes.

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.