我试图让节点\node[below = 3 cm of OPC] (NCM) {No match};
对齐,使其位于上方节点的正下方,并与右侧节点完全位于同一行。如果我执行简单的下方规范(代码未注释掉),那么它与右侧的节点相比太低了,尽管我认为它们应该具有相同的垂直高度,因为所有内容都是一行。我想保持相对定位。
我知道当节点在同一垂直水平时如何等距放置节点,但当一个节点在上面而另一个节点在同一行时,我不知道如何做到这一点。我的尝试被注释掉了。关键问题是它)
在Couples
节点中放置了一个,否则看起来不错。当我做一个玩具示例时,所有节点都只有一行,使用该方法没有问题below = of
。也许这里的问题是由于多行节点造成的?
另外,有没有一种简单的方法可以在节点上画一条小弧OPC
?PCM
有些答案是使用矩阵布局和这使用圆圈,但有没有更简单的方法?我想显示的重叠线是\draw[arrow] (node cs:name=RPIC) -- (node cs:name=NCM)
代码
\usepackage[english]{babel}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{amsfonts}
\usepackage[a4paper,layout=a4paper,
bindingoffset=4cm,left=0cm,right=2cm,
head=2.5cm, bmargin=2cm]{geometry} %get the page layout right
%\usepackage[none]{hyphenat} %turn off hypenation globally
\usepackage{microtype} %better typesetting, affects justification and punctuation
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{url} % typeset URL's reasonably
\usepackage[round]{natbib} % default bracket type is round
\usepackage{listings}
\usepackage{booktabs} %typeset tables better
\usepackage{multirow} %allow merge look across table rows
%\usepackage{placeins} %fix table floats!
\RequirePackage[l2tabu, orthodox]{nag}
\usepackage[table]{xcolor} % must be imported BEFORE tikz
\usepackage{tikz} %write flowcharts etc
\usetikzlibrary{arrows, shapes, chains, fit, backgrounds, calc, decorations.pathreplacing, matrix, calligraphy, positioning}
\usepackage{hyperref}
\usepackage[flushleft]{threeparttable}
\usepackage[inline, shortlabels]{enumitem}
\usepackage{tikzlings}
\usepackage{array}
\usepackage{rotating}
\usepackage{subcaption}
\usepackage{cleveref}
\begin{document}
\begin{tikzpicture}[
every node/.style= {draw, rounded corners, font=\footnotesize, align=center},
arrow/.style={thick, -stealth}]
\node (CPL) {Couples};
\node[right = 6cm of CPL] (Ch) {Children};
\node[below left = 3cm and 0cm of CPL] (OPC) {Other person\\in couple};
\node[below right = 3cm and 0cm of CPL] (RPIC) {Reference person\\in couple} ;
\node[below left = 3cm and 0cm of Ch] (CFC) {Children\\for couples};
\node[below right = 3cm and 0cm of Ch] (CFSP) {Children for\\sole-parents};
% \node[below = 3 cm of $(OPC)(RPIC)$] (NCM) {No child match};
\node[below = 3 cm of OPC] (NCM) {No child match};
\node[below = 3 cm of $(RPIC)!0.5!(CFC)$] (PCM) {Parent-child match};
% \node[below = 3 cm of $(CFSP)(PCM)$] (TNF) {\Cref{fig:SPWC}};
\draw[arrow] (node cs:name=CPL) -- (node cs:name=OPC);
\draw[arrow] (node cs:name=CPL) -- (node cs:name=RPIC);
\draw[arrow] (node cs:name=Ch) -- (node cs:name=CFC);
\draw[arrow] (node cs:name=Ch) -- (node cs:name=CFSP);
% \draw[arrow] (node cs:name=OPC) -- (node cs:name=NCM);
% \draw[arrow] (node cs:name=RPIC) -- (node cs:name=NCM);
\draw[arrow] (node cs:name=OPC) -- (node cs:name=PCM);
\draw[arrow] (node cs:name=RPIC) -- (node cs:name=PCM);
\draw[arrow] (node cs:name=CFC) -- (node cs:name=PCM);
% \draw[arrow] (node cs:name=CFSP) -- (node cs:name=TNF);
\end{tikzpicture}
\end{figure}
\end{document}
答案1
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{amsfonts}
\usepackage[a4paper,layout=a4paper,
bindingoffset=4cm,left=0cm,right=2cm,
head=2.5cm, bmargin=2cm]{geometry} %get the page layout right
%\usepackage[none]{hyphenat} %turn off hypenation globally
\usepackage{microtype} %better typesetting, affects justification and punctuation
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{url} % typeset URL's reasonably
\usepackage[round]{natbib} % default bracket type is round
\usepackage{listings}
\usepackage{booktabs} %typeset tables better
\usepackage{multirow} %allow merge look across table rows
%\usepackage{placeins} %fix table floats!
\RequirePackage[l2tabu, orthodox]{nag}
\usepackage[table]{xcolor} % must be imported BEFORE tikz
\usepackage{tikz} %write flowcharts etc
\usetikzlibrary{arrows, shapes, chains, fit, backgrounds, calc, decorations.pathreplacing, matrix, calligraphy, positioning}
\usepackage{hyperref}
\usepackage[flushleft]{threeparttable}
\usepackage[inline, shortlabels]{enumitem}
\usepackage{tikzlings}
\usepackage{array}
\usepackage{rotating}
\usepackage{subcaption}
\usepackage{cleveref}
\begin{document}
\begin{tikzpicture}[
every node/.style= {draw, rounded corners, font=\footnotesize, align=center, minimum height=0.8cm},
arrow/.style={thick, -stealth}]
\node (CPL) {Couples};
\node[right = 6cm of CPL] (Ch) {Children};
\node[below left = 2cm and 0cm of CPL] (OPC) {Other person\\in couple};
\node[below left = 2cm and 0cm of Ch] (CFC) {Children\\for couples};
\node[below right = 2cm and 0cm of Ch] (CFSP) {Children for\\sole-parents};
\node[below right = 2cm and 0cm of CPL] (RPIC) {Reference person\\in couple} ;
% \node[below = 3 cm of $(OPC)(RPIC)$] (NCM) {No child match};
\node[below = 2 cm of $(RPIC)!0.5!(CFC)$] (PCM) {Parent-child match};
\node at (OPC|-PCM) (NCM) {No child match};
\draw [red] (NCM.south) -- (PCM.south);
% \node[below = 3 cm of $(CFSP)(PCM)$] (TNF) {\Cref{fig:SPWC}};
\draw[arrow] (CPL) -- (OPC);
\draw[arrow] (CPL) -- (RPIC);
\draw[arrow] (Ch) -- (CFC);
\draw[arrow] (Ch) -- (CFSP);
% \draw[arrow] (node cs:name=OPC) -- (node cs:name=NCM);
% \draw[arrow] (node cs:name=RPIC) -- (node cs:name=NCM);
\draw[arrow] (OPC) -- (PCM);
\draw[arrow] (RPIC) -- (PCM);
\draw[arrow] (CFC) -- (PCM);
% \draw[arrow] (node cs:name=CFSP) -- (node cs:name=TNF);
\end{tikzpicture}
\end{document}