4

I tried to find something as identical as possible to this question but did not find it. If so, please let me know. I want to connect two nodes that are in different tikzpicture environments through circle connection bar. By default the connection bar code should be close to the tikzpicture environment of the last declared node or isolated to a single tikzpicture but never to the tikzpicture environment of the first declared node, see case 1 and 2. Everything seems (optical illusion?) To work well, but in both cases the nodes do not remain in their original position at either end of the circle connection bar edge, and that is the main issue. Also, if there was a solution it would work for case 3 when using \newpage ?

Case 1:

enter image description here

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{mindmap,quotes}
\begin{document}
\begin{tikzpicture}
\node (energy1) at (30:10cm){motorcycle.1};
\end{tikzpicture}
\begin{tikzpicture}
\node (energy2) at (90:10cm) {motorcycle.2};
\draw[circle connection bar]
(energy1)
  edge["USA" {orange ,sloped,above=.5cm,align=center,text width=8cm}]
  (energy2)
  ;
\end{tikzpicture}
\end{document}

Case 2:

enter image description here

\documentclass{article} 
\usepackage{tikz}
\usetikzlibrary{mindmap,quotes}
\begin{document}
\begin{tikzpicture}
\node (energy1) at (30:10cm){motorcycle.1};
\end{tikzpicture}
\begin{tikzpicture}
\node (energy2) at (90:10cm) {motorcycle.2};
\end{tikzpicture}
\begin{tikzpicture}
\draw[circle connection bar]
(energy1)
  edge["USA" {orange ,sloped,above=.5cm,align=center,text width=8cm}]
  (energy2)
  ;
\end{tikzpicture}
\end{document}

Case 3 (with \newpage):

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap,quotes}
\begin{document}
\begin{tikzpicture}
\node (energy1) at (30:10cm){motorcycle.1};
\end{tikzpicture}
\newpage
\begin{tikzpicture}
\node (energy2) at (90:10cm) {motorcycle.2};
\end{tikzpicture}
\newpage
\begin{tikzpicture}
\draw[circle connection bar]
(energy1)
  edge["USA" {orange ,sloped,above=.5cm,align=center,text width=8cm}]
  (energy2)
  ;
\end{tikzpicture}
\end{document}

As pointed out by @Henri Menke, I present an attempt to use remember pictureand overlay. I'm not sure exactly how to use these arguments, but after all, I couldn't keep the nodes at either end of it either edges from the circle connection bar. Am I doing something incorrectly when using these arguments?

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap,quotes}
\begin{document}
\begin{tikzpicture}
\node [remember picture,overlay]
(energy1) at (30:10cm){motorcycle.1};
\end{tikzpicture}
\begin{tikzpicture}[remember picture,overlay]
\node (energy2) at (90:10cm) {motorcycle.2};
\end{tikzpicture}
\begin{tikzpicture}
\draw[circle connection bar]
(energy1)
  edge["USA" {orange ,sloped,above=.5cm,align=center,text width=8cm}]
  (energy2)
  ;
\end{tikzpicture}
\end{document}

Following @Henrique Menke's note about the above attempt, I have been able to place the nodes at the end circle connection barbut have not been able to maintain their initial positions, although I have tried to change the coordinates of both nodes to be further and further apart. to check if it was really working or was an "optical illusion".

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap,quotes}
\begin{document}
\begin{tikzpicture}[remember picture]

        \node [remember picture] (energy1) at (30:30cm){motorcycle.1};
\end{tikzpicture}
\begin{tikzpicture}[remember picture]
        \node [remember picture] (energy2) at (90:10cm) {motorcycle.2};
\end{tikzpicture}
\begin{tikzpicture}[remember picture,overlay]

\draw[circle connection bar,remember picture, overlay]
(energy1)
  edge["USA" {orange ,sloped,above=.5cm,align=center,text width=8cm}]
  (energy2)
  ;
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    You need at least remember picture for position-tracking. – Henri Menke Aug 19 '19 at 4:30
  • 1
    And you probably want to draw the connection bar in an overlay – Henri Menke Aug 19 '19 at 4:30
  • 1
    Also position-tracking does not work across pages. – Henri Menke Aug 19 '19 at 4:30
  • Thank. I didn't remember that command. I'll run some tests and see how it works. – Diego Bnei Noah Aug 19 '19 at 18:52
  • 1
    The tikzpicture containing (energy1) and (energy2) need remember picture, the tikzpicture with the connection bar needs remember picture, overlay. – Henri Menke Aug 19 '19 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.