6

This question already has an answer here:

A question similar to How can I construct a page layout with framed boxes?

I need to construct a very simple flow chart with a few vertically and horizontally aligned boxes with arrows betweem them.

As I'm not very experienced with LaTeX assistance I'd love some help!

What I'm after is something like this:

      +-----------------------------------------+
      | A few lines of text in a block,         |
      | centered would be nice but not required |
      +-----------------------------------------+
                         |
                         v
           o---------------------------o
           | A double box here perhaps?|
           o---------------------------o
                         |
            +------------+-------------+
            |                          |
            v                          v
   +------------------+   +--------------------------+
   |More words here   |   |     More words here      |
   +------------------+   +--------------------------+

marked as duplicate by bloodworks, Thorsten, Werner, Martin Schröder, mafp Apr 24 '13 at 7:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Could you please post a picture of what exactly you'd like? (even something hand drawn would suffice) See also: tex.stackexchange.com/questions/723/… – kan Apr 24 '13 at 4:51
  • Welcome to TeX.sx! – hpesoj626 Apr 24 '13 at 4:55
  • Could you please also look at pp.210-212 of the pgf manual. I will adapt that for this and post an answer. Please also clarify what a double box is? Its frame is doubled? – kan Apr 24 '13 at 5:46
  • Link to Manual: texdoc.net/texmf-dist/doc/generic/pgf/pgfmanual.pdf – kan Apr 24 '13 at 5:47
  • @Kan Thank you for the suggestion. The picture on page 211 is a complex version of what I'm trying to do. By 'double box' I did mean a box with a double frame to differentiate it from the other boxes. – SubOptimal Apr 24 '13 at 6:22
6

Here is my first attempt, there are several places to polish and I'd do them as I figure out how to do:-)

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{arrows, shapes}
\newlength{\mytw}
\settowidth{\mytw}{A few lines of text in a block}
\begin{document}
\begin{center}
\begin{tikzpicture}
[> = latex', auto,
block/.style ={rectangle,draw=black, thick,
align=flush center, rounded corners,
minimum height=4em},
]
\matrix [column sep=5mm,row sep=7mm]
{
% row 1
&
\node [block, text width=\mytw] (firstbox) {A few lines of text in a block, centered would be nice but not required}; &
 \\
% row 2
& \node [block, double, double distance=1pt] (dbox) {A double box here perhaps?!}; & \\
% row 3
 & \node[inner sep = 0pt] (dummy) {}; & \\
%row 4
\node [block] (b1) {More text goes here};&
&\node [block] (b2) {more text goes here};\\
};

 \draw[->] (firstbox) -- (dbox);
 \draw[-] (dbox) -- (dummy); 
 \draw[->]    (dummy) -| (b1); 
 \draw[->]    (dummy) -| (b2);

\end{tikzpicture}
\end{center}

flow2e.png

  • @erik Thank you very much. Unfortunately my installation doesn't have the flowchart package and I'm not permitted to install it. – SubOptimal Apr 24 '13 at 8:13
  • I'll take the code provided by @kan and play with it. Thanks heaps for the assistance. – SubOptimal Apr 24 '13 at 8:13
  • I was absolutely unable to make this one compile, kept getting missing } inserted and missing \cr inserted errors. I used the solution from below, but if anyone could shed light on this, then it might help future help-seekers. – wanaryytel Mar 7 '17 at 22:31
4

Here's a solution using the flowchart package (which is based on TikZ). See package documentation for details.

\documentclass[11pt]{standalone}
\usepackage{flowchart}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}[>=stealth, thick]

\node (A) at (0,0) [draw, process, text width=5cm, minimum height=0.5cm, align=flush center] 
{A few lines of text in a block, centered would be nice but not required};

\node (B) at (0,-2) [draw, double, double distance=1pt, process, minimum height=0.5cm, align=flush center] 
{A double box here perhaps?};

\node (C) at (-3,-4) [draw, process, minimum height=0.5cm, align=flush center] 
{Some words here};

\node (D) at (3,-4) [draw, process, minimum height=0.5cm, align=flush center] 
{More words here};

\coordinate (z) at (0,-3);

\draw[->] (A) -- (B);
\draw[->] (B) -- (z) -| node[above] {NO} (C);
\draw[->] (B) -- (z) -| node[above] {YES} (D);

\end{tikzpicture}
\end{document}

enter image description here

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