1

I am trying to draw the diagram as shown in the Figure. enter image description here

I want to position the nodes B and C, just 1.5 cm above the arrow connecting to node 1 and 2. In case of node A I used the following code to define the midpoint and then connected the node A to mid point of the line

\path [line] (One) -- (Two)coordinate[midway] (aux1);
\path [line] (A) -- (aux1);

Now, I want to define the one third points from start and end of the line aux1 to connect nodes B and C. Can you please help me out defining the coordinates of those two points on the line named aux1?

1 Answer 1

2

It is not clear, where is start for arrows to node B and C. At 1/ and 2/3 of pathe from node 1 to node 2? If it is, than see, if the following solution works for you:

\documentclass[tikz, border=3.141592]{standalone}
\usetikzlibrary{arrows.meta,
                positioning}

\begin{document}
    \begin{tikzpicture}[
every node/.style = {draw, minimum size=8mm}
                        ]
\node (n1)  {1};
\node (n2)  [right=3cm of n1]   {2};
%
\draw(n1) -- coordinate[pos=1/3] (b) 
             coordinate[pos=1/2] (a)
             coordinate[pos=2/3] (c) (n2); 
\draw[Stealth-, blue] (b) --++ (0, 1.5) node[above] {B};
\draw[Stealth-, red]  (a) --++ (0,-1.5) node[below] {A};
\draw[Stealth-, blue] (c) --++ (0, 1.5) node[above] {C};
    \end{tikzpicture}
\end{document}

enter image description here

1
  • Thank you. Yes, that is what I needed.
    – LarCos
    Commented Jan 13, 2021 at 17:39

You must log in to answer this question.

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