0

enter image description here

How to create a moderator part of the figure (arrows pointing other arrows, spacing, all X arrowheads on left of Y)?

Thanking you.

js bibra
  • 21,280

1 Answers1

0

Welcome! I'd recommend forest for that.

\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
for tree={grow=180,
  edge={semithick,stealth-},math content,l sep=10em,draw}
 [y,minimum width=1.2cm,minimum height=0.8cm
  [x_1,edge label={coordinate[pos=0.8](a)}]
  [x_2]
  [x_3]
  [x_4]
  [x_5]
  [x_6,edge label={coordinate[pos=0.2](b)}]
 ]
\path (a) -- (b) coordinate[midway] (c);
\node[draw] at ([yshift=1em]current bounding box.north-|c) (m) {Moderator};
\draw[semithick,-stealth] (m) -- (a);
\draw[semithick,-stealth] (m) -- (b);
\end{forest}
\end{document}

enter image description here

And here is a possible way to add one normal text to the tree.

\documentclass{article}
\usepackage[edges]{forest}
\usepackage{amsmath}
\begin{document}
\begin{forest}
for tree={grow=180,
  edge={semithick,stealth-},math content,l sep=10em,draw,
  where n children=0{anchor=east}{},child anchor=east}
 [y,minimum width=1.2cm,minimum height=0.8cm
  [\text{Gym instructor},edge label={coordinate[pos=0.8](a)}]
  [x_2]
  [x_3]
  [x_4]
  [x_5]
  [x_6,edge label={coordinate[pos=0.2](b)}]
 ]
\path (a) -- (b) coordinate[midway] (c);
\node[draw] at ([yshift=1em]current bounding box.north-|c) (m) {Moderator};
\draw[semithick,-stealth] (m) -- (a);
\draw[semithick,-stealth] (m) -- (b);
\end{forest}
\end{document}

enter image description here

If the tree has predominantly nonmath content, remove math content from the for tree options, and add $ signs where appropriate.

  • Instead of "x1" how can I place "Gym instruction" with this code (it does not allow spacing eg. it prints Gyminstruction)? similarly, I would like to do for all x's. Thanks @Schrödinger's cat – user201275 Nov 13 '19 at 02:02
  • @user201275 Remove math content from the for tree options. This option wraps the content of all nodes in $...$. You will then have to add $ signs where appropriate, in particular wherever the content contains a _. –  Nov 13 '19 at 02:05
  • @user201275 Alternatively, you could load amsmath and replace [x_1,edge label={coordinate[pos=0.8](a)}] by [\text{Gym instructor},edge label={coordinate[pos=0.8](a)}]. And you may add where n children=0{anchor=east}{},child anchor=east to the `for tree. I added this option to the answer. –  Nov 13 '19 at 02:11
  • That works too, thanks @Schrödinger's cat – user201275 Nov 13 '19 at 02:14