0

I am trying to get the node \node[below = 3 cm of OPC] (NCM) {No match}; aligned so it is directly below the node above, and exactly on the same line as the node to the right. If I do a simple below specification (code not commented out) then it's too low compared to the one on the right, even though I thought they should be the same vertical height as everything is one line. I want to keep the relative positioning.

I know how to position the nodes equidistant when the nodes are on the same vertical level, but I can't work out how to do this when one node is above and the other is on the same line. My attempt is shown commented out. The key problem is that it puts a ) in the Couples node, otherwise it looks good. When I did a toy example, all the nodes were only one line, and there was no problem just using the below = of method. Maybe this problem here is due to the multi-line nodes?

Also, is there an easy way to a little arc on the OPC to PCM nodes? There are some answers using a matrix layout and this uses circles, but is there an easier way? The line where I would like to show as an overlap is \draw[arrow] (node cs:name=RPIC) -- (node cs:name=NCM)

Code

\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}

Michelle
  • 519
  • 1
  • 4
  • 15
  • add (OPC|-PCM) is the intersection of the vertical line down from OPC and horizontal line from PCM – js bibra Oct 16 '21 at 23:48
  • for the problem of different height of node CPl and node Ch due to descenders like p use minimum height in the definition of the node -- this can be also used for multi line nodes to give consistent shapes – js bibra Oct 17 '21 at 00:00
  • for the problem of an arrow from node RPIC to NCM you could use a different colored arrow such as -- \draw[arrow, blue] (RPIC) -- (NCM); – js bibra Oct 17 '21 at 00:04
  • 1
    Thanks, just changed the name of the nodes there, forgot I had started writing the question with the toy example (which didn't have the problem!) in mind. – Michelle Oct 17 '21 at 00:08

1 Answers1

1

enter image description here

\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}

js bibra
  • 21,280