3

Please, I'm struggling to draw the follow picture for my master's dissertation:

transmission line taxonomy

Once I reproduce it on Tikz I'm able to translate to my own language.

1
  • If nobody come up with the exactly solution it would be an alternative
    – Victor
    Commented Dec 14, 2019 at 20:31

1 Answer 1

4

With forest. See the answers to this question.

\documentclass{article}
\usepackage{geometry}
\usepackage[edges]{forest}
\makeatletter
% remove the stray space https://tex.stackexchange.com/a/513549
% won't be needed for pgf version 3.1.5 and later
\patchcmd{\pgfutilsolvetwotwoleqfloat}
  { \noexpand\pgfmathfloatdivide@}
  {\noexpand\pgfmathfloatdivide@}
  {}{}
\makeatother

\forestset{% https://tex.stackexchange.com/a/442495
  declare dimen={my fork sep}{1em},
  my forked edge'/.style={
    edge={rotate/.option=!parent.grow},
    edge path'={let \noexpand\p1=($(.child anchor)-(!u.parent anchor)$) in 
    (!u.parent anchor) -- ++(\noexpand\x1-\forestoption{my fork sep},0) |- (.child anchor)},
  },
  my forked edge/.style={
    on invalid={fake}{!parent.parent anchor=children},
    child anchor=parent,
    my forked edge',
  },
  my forked edges/.style={for nodewalk={#1}{my forked edge}},
  my forked edges/.default=tree,
}
\begin{document}
\noindent
\begin{forest}
my forked edges, 
for tree={grow'=0,   edge=thick,tier/.option=level,  
l sep+=2em,anchor=base west,s sep=1ex,  font=\strut\sffamily,
alias/.wrap pgfmath arg={l-#1}{level}}
[TRANSMISSION \\LINE
 [Supports
  [{Steel sections, woord, etc}]
  [Bolts]
  [Guys and their fittings]
 ] 
 [Foundations 
 ] 
 [Conductors
  [Joints]
 ]
 [Insulator strings 
  [Conectors]
  [Insulators]
  [Fittings]
 ]
]
\path ([yshift=1em]current bounding box.north) coordinate (N);
% 0.5ex can be changed to increase/decreas the vertical distance between the
% level indicators and the tree
\foreach \X  [count=\Y starting from 0] in {SYSTEM,COMPONENTS,ELEMENTS}
{\node[anchor=south west,font=\strut\small\sffamily] (aux-\Y) at 
(l-\Y.west|-N){\X};}
\node[draw,fit=(aux-0)(aux-1)(aux-2)
(current bounding box.west|-aux-1)
(current bounding box.east|-aux-1),inner xsep=\forestoption{my fork sep}] (F){};
\foreach \X in {0,1,2}
{\draw ([xshift=-\forestoption{my fork sep}]aux-\X.west|-F.south)
-- ([xshift=-\forestoption{my fork sep}]aux-\X.west|-F.north); }
\end{forest}

\bigskip

\noindent% cf. https://tex.stackexchange.com/a/515604/194703
\begin{forest}
my forked edges, 
for tree={grow'=0,   edge=thick,tier/.option=level,  
l sep+=2em,anchor=base west,s sep=1ex,  font=\strut\sffamily,
alias/.wrap pgfmath arg={l-#1}{level}}
[,phantom
 [SYSTEM,alias=T1,for tree={no edge}
  [COMPONENTS,alias=T2
   [ELEMENTS,alias=T3]
  ]
 ]
 [TRANSMISSION \\LINE
  [Supports
   [{Steel sections, woord, etc}]
   [Bolts]
   [Guys and their fittings]
  ] 
  [Foundations 
  ] 
  [Conductors
   [Joints]
  ]
  [Insulator strings 
   [Conectors]
   [Insulators]
   [Fittings]
  ]
 ]
] 
\node[draw,fit=(T1)(T3)(T3-|current bounding box.east),
inner xsep=\forestoption{my fork sep}/2,
xshift=-\forestoption{my fork sep}/2] (F){};
\foreach \X in {1,2,3}
{\draw ([xshift=-\forestoption{my fork sep}]T\X.west|-F.south)
-- ([xshift=-\forestoption{my fork sep}]T\X.west|-F.north); }
\end{forest}
\end{document}

enter image description here

As for the extra request in the comments:

\documentclass{article}
\usepackage{geometry}
\usepackage[edges]{forest}
\makeatletter
% remove the stray space https://tex.stackexchange.com/a/513549
% won't be needed for pgf version 3.1.5 and later
\patchcmd{\pgfutilsolvetwotwoleqfloat}
  { \noexpand\pgfmathfloatdivide@}
  {\noexpand\pgfmathfloatdivide@}
  {}{}
\makeatother

\forestset{% https://tex.stackexchange.com/a/442495
  declare dimen={my fork sep}{1em},
  my forked edge'/.style={
    edge={rotate/.option=!parent.grow},
    edge path'={let \noexpand\p1=($(.child anchor)-(!u.parent anchor)$) in 
    (!u.parent anchor) -- ++(\noexpand\x1-\forestoption{my fork sep},0) |- (.child anchor)},
  },
  my forked edge/.style={
    on invalid={fake}{!parent.parent anchor=children},
    child anchor=parent,
    my forked edge',
  },
  my forked edges/.style={for nodewalk={#1}{my forked edge}},
  my forked edges/.default=tree,
}
\begin{document}
\noindent
\begin{forest}
my forked edges, 
for tree={grow'=0,   edge=thick,tier/.option=level,  
l sep+=2em,anchor=base west,s sep=1ex,  font=\strut\sffamily,
alias/.wrap pgfmath arg={l-#1}{level}}
[TRANSMISSION \\LINE
 [Supports
  [{Steel sections, woord, etc}]
  [Bolts]
  [Guys and their fittings]
 ] 
 [Foundations 
 ] 
 [Conductors
  [Joints]
 ]
 [Insulator strings 
  [Conectors]
  [Insulators]
  [Fittings]
 ]
]
\path ([yshift=1em]current bounding box.north) coordinate (N);
% 0.5ex can be changed to increase/decreas the vertical distance between the
% level indicators and the tree
\foreach \X  [count=\Y starting from 0] in {SYSTEM,COMPONENTS,ELEMENTS}
{\node[anchor=south west,font=\strut\small\sffamily,opacity=0] (aux-\Y) at 
(l-\Y.west|-N){\X};} % <- to be sure everything fits
\node[draw,fit=(aux-0)(aux-1)(aux-2)
(current bounding box.west|-aux-1)
(current bounding box.east|-aux-1),inner xsep=\forestoption{my fork sep}] (F){};
\foreach \X in {0,1,2}
{\draw ([xshift=-\forestoption{my fork sep}]aux-\X.west|-F.south)
--  coordinate (paux-\X) ([xshift=-\forestoption{my fork sep}]aux-\X.west|-F.north); }
\path (F.east) coordinate (paux-3);
\foreach \X  [count=\Y starting from 0] in {SYSTEM,COMPONENTS,ELEMENTS}
{\path (paux-\Y) -- node[font=\strut\small\sffamily]{\X}  (paux-\the\numexpr\Y+1);}
\end{forest}
\end{document}

enter image description here

For additional requests please ask a new question, which is free of charge.

13
  • I would like to have the same vertical alignment, which is the tricky part
    – Victor
    Commented Dec 14, 2019 at 20:35
  • @VictorVerga Sorry, I do not understand what you mean by "same vertical alignment".
    – user194703
    Commented Dec 14, 2019 at 20:37
  • @Schrondinger The red vertical lines should match all together at the same alignment: imgur.com/a/wvB39Cr
    – Victor
    Commented Dec 14, 2019 at 20:43
  • @Schrondinger the same idea applies to the blue lines
    – Victor
    Commented Dec 14, 2019 at 20:43
  • @VictorVerga I updated the answer accordingly.
    – user194703
    Commented Dec 14, 2019 at 21:01

You must log in to answer this question.

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