1

I would like to define the node distance so that this distance is between the south and north of the nodes and not with respect to the center. More precisely

enter image description here

Image generated from

\documentclass{standalone}
\usepackage{tikz}
\begin{document}    
\begin{tikzpicture}

    \node[text width=16cm] (A) at (0,0) {some text, some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text};     

\node[below of=A, node distance=8cm, text width=16cm] (B) {some text, some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text};

\node[below of=B, node distance=8cm, text width=16cm] (C) {some text, some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text, some text, some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text,some text};

\draw[red, very thick] (0,0)--(0,-8);
\draw[blue, very thick] (1,-1)--(1,-7);
\node [anchor=east, text width=6cm, red] at (-1.5,-4) {Distance between nodes is defined by the center, in this example it is 8cm\\ \verb|\node (A) at (0,0) {some text ...};|\\\verb|\node[below of=A,|\\ \verb|node distace=8cm,...] (B) {some text ...};|};
\draw[red, very thick] (-1,-8)--(-1,-16);
\node [anchor=west, text width=6cm, blue] at (1.5,-4) {I would like to set the node distance value as the value between the distance from the south of node A to the north of node B};
\draw[blue, very thick] (1,-9)--(1,-14);
\node [anchor=west, text width=6cm, blue] at (1.5,-11) {So that it is possible to make the next nodes have the same distance between the south and north pole, even if the text increases or decreases in size. In this example, the distance has decreased};
\end{tikzpicture}
\end{document}    

1 Answers1

1

This is the default behaviour if you add \usetikzlibrary{positioning} and use below=of A. Note of after =, see also Difference between "right of=" and "right=of" in PGF/TikZ

Note also that you need to set node distance before the below key, i.e. instead of below=of A,node distance=8cm, you need

node distance=8cm,below=of A

Or you can use the shorter version,

below=8cm of A

If the same distance should apply in all cases, add node distance as an option to the tikzpicture environment, as in the code below.

\documentclass{standalone}
\usepackage{tikz,lipsum} % the latter for dummy text
\usetikzlibrary{positioning}
\begin{document}    
\begin{tikzpicture}[node distance=8cm]

\node[text width=16cm] (A) at (0,0) {\lipsum*[1]};     

\node[below=of A, text width=16cm] (B) {\lipsum*[2]};

\node[below=of B, text width=16cm] (C) {\lipsum*[3]};

\draw[red, very thick] (A.south)--(B.north) 
node [pos=0.5,anchor=east, text width=6cm, red] at (-1.5,-4) {This line goes from A.south to B.north};

\draw[red, very thick] (B.south)--++(0,-8)
node [pos=0.5,anchor=west, text width=6cm, blue] at (1.5,-11) {This line starts at B.south and goes 8cm down};

\draw[blue, very thick] ([xshift=1cm]A.south)--++(0,-8)
node [midway,anchor=west, text width=6cm, blue] at (1.5,-4) {This line starts 1cm right of A.south and goes 8cm down};
\end{tikzpicture}
\end{document}  

enter image description here

Torbjørn T.
  • 206,688