How can I make a chart like this in LaTeX?

Chart with lines between boxes

  • 2
    Please include title or class of diagram's in the Q Title instead of this for easy traceability/searchable for future users – texenthusiast Oct 20 '13 at 4:08

One possible solution is using tikz package. Minimal introduction can be found here. Another solution is MetaPost which may be though as prototype of tikz, they have much in common. But MetaPost is not package for TeX-file, it's external tool for creation of eps-images with back connection to TeX of LaTeX. It is included particularly in MiKTeX. Read manual here.

|improve this answer|||||

Here is a solution using Tikz matrix node

enter image description here



        boxes/.style={draw, rectangle,%
                thick,minimum height=6mm,%
                text width=6mm, 

    \matrix (A) [matrix of nodes, nodes=boxes,
             row sep=1cm,column sep=1cm]
   |(A-3-1)|  & |(A-3-2)|   & |(A-3-3)|   & |(A-3-4)|  & |(A-3-5)| \\                              
   |(A-2-1)|  & |(A-2-2)|   & |(A-2-3)|   & |(A-2-4)|  & |(A-2-5)| \\                              
   |(A-1-1)|  & |(A-1-2)|   & |(A-1-3)|   & |(A-1-4)|  & |(A-1-5)| \\                                             
    \foreach \i/\j in {3/2,2/1}
        \draw  (A-\i-1)--(A-\j-1);        \draw  (A-\i-2)--(A-\j-2);
        \draw  (A-\i-3)--(A-\j-3);        \draw  (A-\i-5)--(A-\j-5);
    \draw  (A-1-3)--(A-1-4)--(A-1-5);
    \draw  (A-3-3)--(A-3-4)--(A-3-5);
    \draw  (A-3-1.south east) -- (A-2-2.north west)      
       (A-2-2.south east) -- (A-1-3.north west);
    \draw  (A-3-2.south east) -- (A-2-3.north west)      
       (A-2-3.south east) -- (A-1-4.north west);
    \draw  (A-3-3.south east) -- (A-2-4.north west)      
       (A-2-4.south east) -- (A-1-5.north west);
    \node [red] at (A-3-5) {9}; 
    \node [red] at (A-1-3) {4}; 
|improve this answer|||||

An example of similar diagram (with TikZ)


|improve this answer|||||
  • Thanks, though I already figured it out. – Jakob Weisblat Oct 20 '13 at 2:42
  • 1
    This is an interesting link. However, a link only "Answer" is usually better as a comment. Alternatively, you can expand your "Answer" to explain how to work with the code. – Andrew Swann Oct 20 '13 at 19:22

Just for fun, I did it with a stack...

\usepackage{graphicx, xcolor}
  \stackinset{c}{}{c}{}{\tiny #1}{%
\nnrl\nhrl\nnrl\nhrl\nnrl\hrl \nnrl\hrl\nnrl\\
\vrl \drl \vrl \drl \vrl \drl \nvrl\nhrl\vrl\\
\vrl \nhrl\vrl \drl \vrl \drl \nvrl\drl\vrl\\
\nnrl\nhrl\nnrl\nhrl\nnrl\hrl \nnrl\hrl\nnrl}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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