4

I am following the example here to draw an arrow from one position on a picture to another. I successfully reproduce the answer, but fail to adapt it to work with the nodes I draw over graphics.

My tikz setup is

\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\tikzstyle{every picture}+=[remember picture]

The images are included and the positions are specified like this (i want to also add a few rectangles and more text on top of the image, which works fine like this):

\includegraphics[width=.45\textwidth]{./white.png}
    \hspace{-.45\textwidth}
    \resizebox{.45\textwidth}{!}{
      \tikz[baseline,remember picture]{
        \useasboundingbox (0,0) rectangle (580pt,300pt);
        \draw[color=black] (330pt,200pt) node[fill=green!20] (bad) {see how bad it is};
      }
    }

The image white.png is 580 pixels wide and 300 pixels high. (and for this minimal example just plain white)

(which i do for two separate images on the same frame. the node in the second image is then called good)

I try to draw the arrow between the two with

\begin{tikzpicture}[remember picture,overlay]
    \path[draw=magenta,thick,->] ([yshift=2mm]bad.north) to [out=0, in=0,distance=1in] (good.east);
\end{tikzpicture}

This arrow is however not drawn. I did establish that i can draw arrows within an image

\includegraphics[width=.45\textwidth]{./white.png}
    \hspace{-.45\textwidth}
    \resizebox{.45\textwidth}{!}{
      \tikz[baseline,remember picture]{
        \useasboundingbox (0,0) rectangle (580pt,300pt);
        \draw[color=black] (330pt,200pt) node[fill=green!20] (bad) {~};
        \draw[color=black] (330pt,100pt) node[fill=green!20] (good) {~};
        \path[draw=magenta,thick,->] ([yshift=2mm]bad.north) to [out=0, in=0,distance=1in] (good.east);
      }
    }

The full document is:

\documentclass[8pt,xcolor=dvipsnames,table]{beamer}
\linespread{1.1}


\xdefinecolor{darkgreen}{RGB}{000, 128, 000}

\mode<presentation>
{
  \usetheme{Rochester}
  \usecolortheme[named=BrickRed]{structure}
  \setbeamercovered{invisible}
  \setbeamertemplate{mini frames}[box]
  \setbeamertemplate{navigation symbols}{}}

  \usepackage{appendixnumberbeamer}
  \beamertemplateshadingbackground{Red!01!White}{White}
  \usepackage[absolute,overlay]{textpos}
  \useinnertheme{rectangles}
  \useoutertheme{infolines}

    \usepackage[UKenglish]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage{graphicx}
    \DeclareGraphicsRule{*}{mps}{*}{}

    \usepackage{pgf}
    \usepackage{tikz}
    \usetikzlibrary{arrows}
    \usetikzlibrary{shapes}
    \tikzstyle{every picture}+=[remember picture]


    \title{some title}

  \author[pseyfert]{just me}

  \date{\today}
  \subject{}


  \begin{document}
  \begin{frame}
    \frametitle{runstats}
    \includegraphics[width=.45\textwidth]{./white.png}
        \hspace{-.45\textwidth}
        \resizebox{.45\textwidth}{!}{
          \tikz[baseline,remember picture]{
            \useasboundingbox (0,0) rectangle (580pt,300pt);
            \draw[color=black] (330pt,200pt) node[fill=green!20] (bad) {see how bad it is};
          }
        }
        \includegraphics[width=.45\textwidth]{./white.png}
        \hspace{-.45\textwidth}
        \resizebox{.45\textwidth}{!}{
          \tikz[baseline,remember picture]{
           \useasboundingbox (0,0) rectangle (580pt,300pt);
           \draw[color=black] (320pt,200pt) node[fill=green!20] (good) {here it's much better};
         }
        }

\begin{tikzpicture}[remember picture,overlay]
        \path[draw=magenta,thick,->] ([yshift=2mm]bad.north) to [out=0, in=0,distance=1in] (good.east);
\end{tikzpicture}
  \end{frame}

  \end{document}

I build the document with xelatex minimum.tex and the result looks like this

how it actually looks

where I would expect something with an arrow from left to right

concept

1 Answer 1

6

There might be something I don't see, but why not just add everything in one tikzpicture. If those two images with annotations are all that's in the frame, that would make things easier I think.

A simple example:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}
\frametitle{runstats}
\begin{tikzpicture}
\node (bad) {\includegraphics[width=4cm]{example-image-a}};
\node (good) [right=of bad] {\includegraphics[width=4cm]{example-image-b}};

\node (a) [fill=yellow!20,draw] at (bad.center) {This is bad};
\node (b) [fill=yellow!20,draw] at (good.center) {This is good};

\draw [ultra thick,magenta,->] (a) to[bend left] (b);
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

1
  • thanks, in the original full version the pictures were in different columns, but for no reason, so i can adopt your solution.
    – pseyfert
    May 8, 2016 at 12:04

You must log in to answer this question.

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