我想g
在节点的右侧添加一个新节点c
,见图 2。
下面的代码将此节点放在中央分支的左侧,见图 1。如何将其移动到所需位置,即节点的右侧c
?
\documentclass{article}
\usepackage[showframe,
margin=25mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc, chains, positioning}
\usepackage{lipsum}
% https://tex.stackexchange.com/a/371591/13173
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
node distance = 4mm and 0.1\textwidth,
start chain = going below,
every node/.style = {draw, fill=gray!30,
minimum width=0.5\textwidth,
text width =\pgfkeysvalueof{/pgf/minimum width}-2*\pgfkeysvalueof{/pgf/inner xsep},
on chain},
]
\node (a) {\lipsum*[11]};
\node (b) {\lipsum*[11]};
\node (c) {\lipsum*[11]};
\node (d) {\lipsum*[11]};
%
\coordinate[left=of $(a.west)!0.5!(d.west)$] (e);
\node (f) [minimum width=0.3\textwidth, left=of e] {\lipsum*[11]};
\draw (a) -| (e)
(b) -| (e)
(c) -| (e)
(d) -| (e);
\draw [->] (e) -- (f);
%% TODO my additions
\node (g) {\lipsum*[11]};
\coordinate[left=of $(c.east)$] (h);
\draw (g) -| (c);
\draw [->] (h) -- (c); % to middle of the single node
\end{tikzpicture}
\end{figure}
\end{document
图:左图1,右图2。
答案1
像这样?
\documentclass{article}
\usepackage[showframe,
margin=25mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc, chains, positioning}
\usepackage{lipsum}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
node distance = 4mm and 0.0265\textwidth,
start chain = going below,
every node/.style = {draw, fill=gray!30,
minimum width=0.305\textwidth,
text width =\pgfkeysvalueof{/pgf/minimum width}-2*\pgfkeysvalueof{/pgf/inner xsep},
font=\small\sffamily, % just for this MWE, otherwise delete this line
on chain},
]
\node (a) {\lipsum*[11]};
\node (b) {\lipsum*[11]};
\node (c) {\lipsum*[11]};
\node (d) {\lipsum*[11]};
%
\coordinate[left=of $(a.west)!0.5!(d.west)$] (e);
\node (f) [left=of e] {\lipsum*[11]};
%
\node (g) [right=of c] {\lipsum*[11]};
\draw (a) -| (e)
(b) -| (e)
(c) -| (e)
(d) -| (e);
\draw [->] (e) edge (f) (c) -- (g);
\end{tikzpicture}
\end{figure}
\end{document}