Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to draw something like this: enter image description here

So I did the following:

\begin{tikzpicture}
\node[draw] (node1) {Long long long box};
\node[draw, below left=of node1] {short} edge[->] (node1);
\node[draw, below right=of node1] {box} edge[->] (node1);
\end{tikzpicture}

Then the result is:

enter image description here

I want to move the two short boxes just under the long box and within the length of the long box. I also like the two arrows straight vertical. How can I do this? I want to use relative positioning.

share|improve this question

1 Answer 1

up vote 9 down vote accepted

Use appropiate anchors and reference points for positioning the nodes. Use intersection coordinate system to draw the lines.

This is the MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
  \node[draw] (node1) {Long long long box};
  \node[draw, below=of node1.west, anchor=west] (this node) {short}
      edge[->] (node1.south-|this node);
  \node[draw, below=of node1.east, anchor=east] (this node) {box} 
      edge[->] (node1.south-|this node);
\end{tikzpicture}
\end{document}

Result:

Result

share|improve this answer
    
Any idea, how to place the short and box nodes above the long box? –  user4514 Jun 29 at 15:40
    
@user4514 Do you mean, changing below by above in the code? –  JLDiaz Jun 29 at 20:32
    
Yes, stupid question. Thanks! –  user4514 Jun 30 at 20:52

Your Answer

 
discard

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.