3

is any pre-difined shapes to draw such chart, or I have to use line by line for it? Thanks in advance.enter image description here

1
  • Looks a good candidate for tikz using foreach loops and pgf arrays.
    – JLDiaz
    Jun 24 '14 at 7:13
6

EDIT: Adding the latest writing

\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}

\begin{document}

    \begin{tikzpicture}[thick]
        % Draw 1st order
        \draw (0,0) to node [pos=0.5, above] {100 C} ++ (4,0);

        % Draw 2nd order
        \foreach \j in {8.1,2.7,-2.7,-8.1}
        {
            \draw [-stealth] (4,0) --++ (1,\j) --++ (4,0);
        }
        \node [above right, align=left] at (6,8.1) {Text 1\\text 2};
        \node [above right, align=left] at (6,2.7) {Text 3\\text 4};
        \node [above right, align=left] at (6,-2.7) {Text 5\\text 6};
        \node [above right, align=left] at (6,-8.1) {Text 7\\text 8};

        % Draw 3rd and 4th orders
        \foreach \j in {8.1,2.7,-2.7,-8.1}
        {
            \draw (9,\j) --++ (4,0);
            \draw (9,\j+2.7) rectangle ++ (6,-5.4);
            \foreach \k in {2,1,-1,-2}
            {
                \draw [-stealth] (13,\j) --++ (1,\k) --++ (6,0);
            }
            % Fatest writing
            \node [right] at (20,\j+2) {Condensate};
            \node [right] at (20,\j+1) {NGL};
            \node [right] at (20,\j-1) {Sales Gas};
            \node [right] at (20,\j-2) {Sour Gas};
        }
        \node [above right] at (15,10.1) {Text 9};
        \node [above right] at (15,9.1) {Text 10};
    \end{tikzpicture}

\end{document}

enter image description here

5

Based on the idea I gave in my comment, here is an implementation using pgf arrays and nested loops. It requires PGF 3.0.0, and can serve as a somewhat complex example of use for this new feature.

\documentclass[landscape,a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
% The following array defines the numbers and labels
% to appear at each final branch (at the right)
% Note the funny syntax with braces and quotes...
\def\myarray{{
{"foo/Condensate, 
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"},
{"foo/Condensate, 
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"},
{"foo/Condensate,
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"},
{"foo/Condensate, 
  bar/NGL, 
  numbers/Sales gas, 
  foobar/Sour gas"}
}}

% This is the style to format the numbers which appear
% above each branch
\tikzset{
   numbers/.style = {above right, font=\small, text width=4cm}
}

\begin{tikzpicture}[>=latex]
\draw (0,0) -- (3,0) node[above, midway] {100C,};

% Four main branches
\foreach [count=\i from 0] \label   in
  {{M-C-P\\some numbers}, 
   {Benzene\\more numbers},
   {CycC,\\even more numbers}, 
   {C,\\and final numbers}} {
  % Coordinate at which each one of main branches start
  \coordinate (aux) at ($(3,6)+(1,-4*\i)$);
  \draw[->] (3,0) -- (aux) node[numbers] {\label}
        -- +(4,0);
  % Rectangle at the end of each branch
  \draw (aux) ++(4,2) rectangle +(5,-4);
  \draw (aux) ++(4,0) -- +(3,0);

  % Inside the rectangle, four new branches
  \pgfmathsetmacro{\labels}{\myarray[\i]}
  \foreach [count=\j from 0] \n/\l in \labels {
    \draw[->] (aux) ++(7,0) -- ++(1,1.5-\j) 
        -- ++(1,0) node[numbers] {\n} -- ++(4,0)
       node[right] {\l};
  }
}
\end{tikzpicture}
\end{document}

Result:

Result

2
  • I have error: "line 59 error Missing number, treated as zero }"
    – Alex
    Jun 24 '14 at 8:39
  • 1
    @Alex This code uses some features that require PGF 3.0.0 Your error happens when you are using PGF 2.10. Latest texlive comes with PGF 3.0.0 if you are interested.
    – JLDiaz
    Jun 24 '14 at 8:58

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.