我有以下代码,并尝试将所有 H 移到左侧框的右侧,因为它们目前重叠。有人知道如何做到这一点吗?
谢谢!!
\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}
答案1
这里有一种方法:
\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}
答案2
- 你的问题是你之前的问题
- 所以我想知道你为什么不使用那里接受的答案中的代码......
- 相比之下,你只需要改变节点内容,使节点变窄并调整边缘标签 - 将它们移动到箭头的开头(如下面在 MWE 中所做的那样)并且由于改变的节点宽度也调整箭头末端的坐标
- new 只是在图表下方添加了节点
\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}