Graphics, Figures & TablesReconstruct figure in LaTeX - tikzpicture

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Reconstruct figure in LaTeX - tikzpicture

Post by Wooldridge1 »

Hi Forum,

I have a similar problem to this thread: http://latex-community.org/forum/viewto ... 45&t=28581

I want to reconstruct this figure:
Graphik.jpg
Graphik.jpg (27.69 KiB) Viewed 2730 times
I used Stefan's code to create such a figure in LaTeX. However, at this point I cannot get any further. Thus, I call for help!

Code: Select all

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,shapes,positioning}
\tikzset{
treenode/.style = {shape=rectangle, rounded corners, draw, anchor=center, text width=5em, align=center, top color=white, bottom color=white, inner sep=1ex, font=\sffamily\normalsize},
do/.style = {treenode, diamond, inner sep=0pt},
}

\begin{tikzpicture}[-latex,
[every edge quotes/.style={fill=white, font=\footnotesize}, auto=right]]
\node [treenode] (fe) {A};
\node [treenode, right = 3cm] (re) {B};
\node [treenode, below = 2cm]  (A) {Test};

\draw
(fe) edge [""] (A)
; 
\end{tikzpicture}
\end{document}
Best regards and many thanks in advance! :-)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Reconstruct figure in LaTeX - tikzpicture

Post by Stefan Kottwitz »

Good try and nice screenshot of the manual drawing! So I gladly make some code:

Code: Select all

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,shapes,positioning,matrix}
\begin{document}
\begin{tikzpicture}
  \matrix (m)
    [
      matrix of nodes,
      row sep    = 2em,
      column sep = 3em,
      nodes      = {font  = \sffamily,
                    shape = rectangle,
                    rounded corners, draw},
    ]
    {
      A    &         & B    \\
      Test &         & Test \\
           & C       &      \\
           & Analyse &      \\
      E    &         & F \\
    };
  \draw [every edge quotes/.append style
         = {font = \sffamily\footnotesize}, -latex]
    (m-1-1) edge                    (m-2-1)
    (m-2-1) edge ["No"]             (m-3-2)
    (m-1-3) edge                    (m-2-3)
    (m-2-3) edge ["Yes" above left] (m-3-2)
    (m-2-3) edge ["No"]             (m-5-3)
    (m-2-1) edge ["Yes" below left] (m-4-2)
    (m-4-2) edge ["No"  above left] (m-5-1)
    (m-4-2) edge ["Yes"]            (m-5-3)
  ;
\end{tikzpicture}
\end{document}
diagram.png
diagram.png (14.96 KiB) Viewed 2707 times
Stefan
LaTeX.org admin
Wooldridge1
Posts: 20
Joined: Wed Oct 19, 2016 9:21 am

Re: Reconstruct figure in LaTeX - tikzpicture

Post by Wooldridge1 »

Thank you very much, Stefan. :-) You helped me so much! :-)
Post Reply