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

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

1 Answer 1

1

You can draw all in a single tikz environment, without any need to do the hard work of connecting different environments. The option to position the label will help here. This is an example.

The only problem is with the size of the drawing and label, which may be handled by means of text scaling. (maybe)

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

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .