0

I have the following code and try to get all H's to the right side of the left boxes since they are currently overlapping. Has anyone an idea how to do that?

Thanks!!

\documentclass{report}    
\usepackage{tikz}
\begin{document}
\begin{figure}
    
    \begin{tikzpicture}[thick]
    \tikzset{n/.style={draw,align=center,inner sep=3mm}} 
    \path[nodes={n}] 
    (0,0)     node (SP) {SP}
    (0,1.5)   node (A)  {A}
    (0,-1.5)  node (D)  {D}
    (0,-3)    node (EE) {EE}
    (7,3)     node (FS) {FS}
    (10,0)    node (FP) {F\\[3mm]P}
    +(0,-2)   node (C)  {C};
    \tikzset{n/.style={node, align=left}}
    \node [text width = 15cm]at (4.5,-5) {Notes. *derived from the comparison between firm sequence and corresponding\\
    industry sequence.};
    \begin{scope}[-stealth]
    \draw (SP)--(FP) coordinate[pos=.3] (H2);
    \draw (A)--(SP);
    \draw (D)--(SP);
    \draw (A)--(FP.165); 
    \draw (D)--(FP.190); 
    \draw (EE)--(FP.205);
    \draw (C)--(FP);
    \draw [densely dotted] (FS)--(FS|-FP) node[pos=.2,right]{$H_3 -$};
    \draw [densely dotted]  (SP) to [bend right = 90] (EE);
    \end{scope}
    
    \path 
    (H2) node[above right]{$H_{2a,b,c,g,e} +$}
    (H2) node[below right] {$H_{2d,f} -$}
    +(0,4) coordinate (H2top) +(0,-4) coordinate (H2bot)
    (intersection of H2top--H2bot and A--FP)  node[above right]{$H_{1a} -$}
    (intersection of H2top--H2bot and D--FP)  node[above right]{$H_{1b} +$}
    (intersection of H2top--H2bot and EE--FP) node[above right]{$H_4$ +}
    ;
    \end{tikzpicture}
    \caption{Conceptual Model}
    \end{figure}
\end{document}

2 Answers 2

2

Here is a way:

\documentclass{report}    
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[thick]
\tikzset{n/.style={draw,align=center,inner sep=3mm}} 
\path[nodes={n}] 
    (0,0)     node (SP) {SP}
    (0,1.5)   node (A)  {A}
    (0,-1.5)  node (D)  {D}
    (0,-3)    node (EE) {EE}
    (7,3)     node (FS) {FS}
    (10,0)    node (FP) {F\\[3mm]P}
    +(0,-2)   node (C)  {C};
\tikzset{n/.style={node, align=left}}
\node [text width = 15cm]at (4.5,-5) {Notes. *derived from the comparison between firm sequence and corresponding\\industry sequence.};
\begin{scope}[-stealth]
\draw (SP)--(FP) coordinate[pos=.3] (H2);
\draw (A)--(SP);
\draw (D)--(SP);
\draw (A)--(FP.165); 
\draw (D)--(FP.190); 
\draw (EE)--(FP.205);
\draw (C)--(FP);
\draw [densely dotted] (FS)--(FS|-FP) node[pos=.2,right]{$H_3 -$};
\draw [densely dotted]  (SP) to [bend right = 90] (EE);
\end{scope}
    
\node [right=0.5cm] at ([yshift=0.1cm]A) {$H_{1a} -$};
\node [above right] at ([xshift=0.5cm]SP) {$H_{2a,b,c,g,e} +$};
\node [below right] at ([xshift=0.5cm]SP) {$H_{2d,f} -$};
\node [right=0.5cm] at ([yshift=-0.1cm]D) {$H_{1b} +$};
\node [right=0.5cm] at (EE) {$H_4$ +};
\end{tikzpicture}
\caption{Conceptual Model}
\end{figure}
\end{document}

enter image description here

1
  • Amazing, thanks!
    – xxoptionxx
    Commented Jun 4, 2022 at 6:33
3
  • your question is follow-up question to your previous question
  • so I wonder why you not use code from there accepted answer ...
  • in comparison to it you only need to change nodes content, make nodes narrower and tweak edge labels -- move them to beginning of arrows (as is done in MWE below) and due to changed nodes widht also tweak coordinates of arrows ends
  • new is only added node below diagram
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                positioning,
                quotes}

\begin{document}
    \begin{tikzpicture}[
node distance = 4mm and 55mm,
  start chain = n going below,
     N/.style = {draw, semithick, minimum width=2em, align=center},
every edge/.style = {draw, -Stealth},
every edge quotes/.style = {auto, inner sep=2pt, font=\footnotesize, 
                            at start, anchor=north west},
    LA/.style = {anchor=south west}
                        ]
    \begin{scope}[nodes={N, on chain=n}]
\node   {A};    % n-1
\node   {SP};
\node   {D};
\node   {EE};   % n-4
    \end{scope}
\node[N, right=of n-2] (n-5)    {F\\ P};
\node[N, below=of n-5] (n-6)    {C};
%
\node [text width = 88mm, %align=flush left,
       below right=4mm and -11mm of n-4.south west] (n-7)
       {Notes: * derived from the comparison between firm and corresponding industry sequence.};
% arrows
\path   (n-1.east) edge ["$H_{1a}^-$" LA]   ([yshift=3pt] n-5.west)
        (n-1) edge  (n-2)
        (n-2.east) edge ["$H_{2a,b,c,g,e}^+$" LA, 
                         "$H_{2d,f}^+$"] 
                         coordinate[pos=0.66] (aux)     (n-5)
        (n-3.east) edge ["$H_{1b}^+$"]      ([yshift=-3pt] n-5.west)
        (n-3) edge (n-2)
        (n-4.east) edge ["$H_4^+$" ]        ([yshift=-6pt] n-5.west)
        (n-6) edge (n-5)
        (n-2.west) edge [bend right] (n-4.west)
        ;
\node[N, above=of n-1.north -| aux] (n-7) {FS};
\path   (n-7) edge ["$H3^-$" sloped=false] (aux);
    \end{tikzpicture}
\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 .