5

I want to place a node in a tikzpicture in relation to the coordinates of a node in a previous tikzpicture.

MWE:

\documentclass[a7paper]{scrartcl}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\centering
\begin{tikzpicture}
\node (a) {a};
\node[below left=of a] (b) {b};
\end{tikzpicture}

\newpage

\begin{tikzpicture}
\node[below=of b] (c) {c};
\end{tikzpicture}
\captionof{figure}{test}

\end{document}

I read the answers of a transforming coordinates question and to this coordinate extraction question, but I don’t think they work for me here.—Using an overlay also causes problems to the position of the caption.

user1
  • 2,196

1 Answers1

4

If you add remember picture and overlay,remember picture

\documentclass[a7paper]{scrartcl}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\centering
\begin{tikzpicture}[remember picture]
\node (a) {a};
\node[below left=of a] (b) {b};
\end{tikzpicture}

\newpage

\begin{tikzpicture}[overlay,remember picture]
\node[below=of b] (c) {c};
\end{tikzpicture}
\end{document}

you get

enter image description here

Is that what you are looking for or go at least in the right direction?

From the title of the question I am more thinking you may be looking for something like this:

\documentclass[a7paper]{scrartcl}

\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{positioning}
\usepackage{caption}
\begin{document}

\centering
\begin{tikzpicture}[remember picture]
\node (a) {a};
\node[below left=of a] (b) {b};
\end{tikzpicture}

\newpage

\begin{tikzpicture}[overlay,remember picture]
\path (b|-current page text area.north) coordinate (bshiftedup);
\node[below=0pt of bshiftedup] (c) {c};
\node[anchor=north,align=center,text width=0.9\textwidth] at 
(c.south-|current page text area.center) {\captionof{figure}{test}};
\end{tikzpicture}

\end{document}

enter image description here

That way the continuation really starts at the top of the page, which might be useful if the picture doesn't fit on a page.

  • @Ben This caption is a caption made with \captionof and it is wherever you put it. This has nothing to do with overlay but only with node distance and the like. –  Apr 22 '19 at 22:22
  • 1
    Adding yshift=4pt to the last "caption"-node and changing the text width to \textwidth results in a perfect match for other captionskips/captionwidths – user1 Apr 22 '19 at 22:35