0

I am try achieve something along the lines of this:

HTA example

I cannot however figure out how to make these arrows. I have some code that gives me something that is almost right but it is messed up in some places and it fails to automatically pick the path I want (overlapping nodes or such)

\path [draw, -latex'] (START) |- (DUMMY) |- (DUMMY2) |- (GOAL);

I made two dummy nodes in my attempt to get this thing to follow a path I wanted, which would be DOWN, LEFT, DOWN, as for the "Warm up furnace" -> "Prepare plant and services" step in the picture above.

Can somebody give me a little aid on how to direct these paths better and if possible, without the clutter of extra nodes? I am currently stuck on this and have no idea what to do. Have googled a lot but only get partial answers (like the one above).

3

2 Answers 2

7

Next time, please provide a Minimum Working Example so that people don't have to copy every word from an image but can cut-and-paste at least the basic structure of the document and textual content of the diagram.

This solution uses forest and constructs and adds the labels at the beginning of the nodes automatically. For this, I got very fast, accurate help from Sašo Živanović's answer to my question about avoiding multiple labels.

furnace forest

\documentclass[tikz, border=5pt]{standalone}
\usepackage{forest}
\usepackage[T1]{fontenc}
\usepackage{textcomp,fixltx2e}
\usetikzlibrary{arrows.meta,shadows}
\begin{document}

\forestset{
  tree node/.style = {inner sep=2pt, rounded corners = 2pt, font=\sffamily, rectangle, draw, thick, fill=white, align=center, drop shadow},
  placing node/.style={inner sep=0pt, outer sep=0pt, draw=none, skipping path},
  skipping path/.style={
    edge path={
      \noexpand\path [\forestoption{edge}, thick]
        (!u.parent anchor) -- (.south)\forestoption{edge label};
    },
  },
  /tikz/plan label/.style={font=\sffamily\scriptsize},
}
\begin{forest}
  for tree={
    parent anchor=south,
    child anchor=north,
    l sep+=5pt,
    edge path={
      \noexpand\path [-{Stealth[]}, \forestoption{edge}, thick]
        (!u.parent anchor) -- +(0,-5pt) -| (.child anchor)\forestoption{edge label};
    },
  },
  set root label/.style={
    content/.wrap 2 pgfmath args={##1. ##2}{n()}{content()},
    tree node
  },
  set node label/.style={
    content/.wrap 3 pgfmath args={##1.##2 ##3}{n("!r")}{n()}{content()},
    tree node
  },
  set node super label/.style={
    content/.wrap 4 pgfmath args={##1.##2.##3 ##4}{n("!r")}{n("!uu")}{n()}{content()},
    tree node
  },
  before typesetting nodes={% where contains implicit for tree loop: https://tex.stackexchange.com/a/218995/: Sašo Živanović
    for tree={
      if level=0{
        set root label,
%       content={O. #1},
      }{
        if level=1{
          set node label,
        }{
          if level=3{
            set node super label,
          }{
          },
        },
      },
    },
  }
  [Warm\\up furnace
    [Prepare\\plant and\\services
    [, placing node, label={[plan label]right:Plan 0.1: Do in any order}
        [Ensure\\plant is\\ready, calign with current
          [,phantom, tier=bottom]
        ]
        [Ensure\\gas-oil is\\available
        ]
        [Ensure O\textsubscript{2}\\analysis system\\is working
        ]
      ]
    ]
    [\\Start air\\blower, edge label={node [plan label, anchor=south east, above left, midway] {Plan 0: Do in order};}
    ]
    [\\Start oil\\pump
    ]
    [Head\\oil to\\800\textcelsius
      [, placing node, tier=bottom, label={[plan label]left:Plan 0.4: Raise temperature to 800\textcelsius{} while monitoring O\textsubscript{2} and $\triangle$T}
        [Increase\\temperature controller\\as per chart
        ]
        [\\Monitor\\O\textsubscript{2}
        ]
        [\\Monitor\\temperature
        ]
        [Switch\\furnace to\\automatic, calign with current
        ]
      ]
    ]
  ]
  ;
\end{forest}
\end{document}
2

A pstricks solution with a psmatrix environment and a relatively short code:

\documentclass[12pt, a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[pdf, x11names]{pstricks}%
\usepackage{pst-node, pst-blur}

\usepackage{siunitx}
\sisetup{detect-family, mode=text}

\usepackage{twoopt}
\newcommandtwoopt\mybox[3][1.6cm][2.5cm]{\psframebox[shadow=true, blur=true, framearc=0.05]{\parbox[t][#1][c]{#2}{\centering#3}}}

 \begin{document}
 \psset{nodesep=0pt, arrows=->, angleA=-90,angleB=90, armA = 1.5cm, armB=0.5cm, colsep=0.5cm, rowsep=2cm, linearc=0.05}%

 \sffamily
\begin{psmatrix}
%%% nodes
 & \mybox[1.2cm]{0. Warm up \\ furnace}\psspan{2}\\
\mybox{0.1 Prepare \\ plant and \\ services} & \mybox{0.2 Start \\ air blower} & \mybox{0.3 Start \\ oil pump} & \mybox{0.4 Heat \\ oil to \\ \SI{800}{\celsius}} \\
\mybox{0.1.1 Ensure \\ plant is \\ ready} & \mybox{0.1.2 Ensure \\ gas-oil is \\ avalaible} & \mybox[1.6cm][3.2cm]{0.1.3 Ensure O\textsuperscript2 \\ analysis system \\ is working}\\
\mybox[1.6cm][4cm]{0.4.1 Increase \\ temperature controller \\ as per chart} & \mybox{0.4.2 \\ Monitor \\ O\textsuperscript2} & \mybox{0.4.3 \\ Monitor \\ temperature} & \mybox{0.4.4 Switch \\ furnace to \\ automatic}
%%% arrows
\ncangle{1,2}{2,1}\nbput[npos=1.72]{Plan 0: Do in order}\ncangle{1,2}{2,2}\ncangle{1,2}{2,3}\ncangle{1,2}{2,4}
\ncangle{2,1}{3,1}\ncangle{2,1}{3,2}\ncangle{2,1}{3,3}\naput[npos=1.32]{Plan 0.1: Do in any order}
\psset{armA=5.4cm}
\ncangle{2,4}{4,1}\nbput[npos=0.92 ]{Plan 0.4: Raise temperature to \SI{800}{\celsius} while monitoring O\textsuperscript{2} and $\Delta$T}\ncangle{2,4}{4,2}\ncangle{2,4}{4,3}\ncangle{2,4}{4,4}
\end{psmatrix}

    \end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .