4

I drew some arrows to annotate a figure using standalone. However, when I put in [tikz]{standalone} the arrows do not show. If I use report or remove the [tikz] then the arrows show up, however, I want the figures to be separate on their own pages. How can I achieve this? Thanks for your time.

\documentclass[tikz]{standalone}
\usepackage{graphicx}
\usepackage{pgfplots,tikz}
\usepackage{textcomp}
\usepackage{fixltx2e}
\usetikzlibrary{shapes,arrows,calc,backgrounds}

\pagestyle{empty}
\begin{document}


\tikzstyle{line} = [draw, -latex']
\tikzstyle{every picture}+=[remember picture] 

\begin{tikzpicture}
\node [anchor=south, inner sep=0pt]{\includegraphics[width=4cm]{./graphics/imdligand.pdf}};
\node [anchor=west] (ligand) at (3,2.9) {2x L\textsubscript{IMD}};

\node [anchor=east] (top) at (0.35,4.56) {};
\node [anchor=east] (bottom) at (0.98,1.29) {};
\end{tikzpicture}

\begin{tikzpicture}[overlay]
\path [line,black,thick] (ligand) |- node {}(top);
\path [line,black,thick] (ligand) |- node {}(bottom);
\end{tikzpicture}

\begin{tikzpicture}
\node[anchor=south,inner sep=0pt]{\includegraphics[width=4cm]{./graphics/pyrligand.pdf}};
\node[anchor=west] (ligand2) at (3,4.3) {2x L\textsubscript{PYR}};

\node[anchor=east] (top1) at (0.85,5.9) {};
\node[anchor=east] (bottom2) at (0.85,2.6) {};
\end{tikzpicture}

\begin{tikzpicture}[overlay]
\path [line,black, thick] (ligand2) |-node{}(top1);
\path [line,black,thick] (ligand2) |-node{}(bottom2);
\end{tikzpicture}

\end{document}

image

  • You need to put the arrows in the same tikzpicture as the figure they belong to as each tikzpicture will get its own page. – cfr Aug 14 '15 at 0:01
3

Each tikzpicture starts a new page when you use the tikz option for the standalone class. This prevents the overlay picture from ever appearing, as there is nothing for it to be overlaid on.

To avoid this, simply include the arrows in the tikzpicture environment of the relevant figure.

For example:

\documentclass[tikz,multi,border=10pt]{standalone}
\usetikzlibrary{arrows}
\begin{document}
\tikzset{% \tikzstyle is deprecated
  line/.style = {draw, -latex'}}

\begin{tikzpicture}
  \node [anchor=south, inner sep=0pt]{\includegraphics[width=4cm]{example-image-a}};
  \node [anchor=west] (ligand) at (3,2.9) {2x L\textsubscript{IMD}};
  \node [anchor=east] (top) at (0.35,4.56) {};
  \node [anchor=east] (bottom) at (0.98,1.29) {};
  \path [line,black,thick] (ligand) |- node {}(top);
  \path [line,black,thick] (ligand) |- node {}(bottom);
\end{tikzpicture}

\begin{tikzpicture}
  \node[anchor=south,inner sep=0pt]{\includegraphics[width=4cm]{example-image-b}};
  \node[anchor=west] (ligand2) at (3,4.3) {2x L\textsubscript{PYR}};
  \node[anchor=east] (top1) at (0.85,5.9) {};
  \node[anchor=east] (bottom2) at (0.85,2.6) {};
  \path [line,black, thick] (ligand2) |-node{}(top1);
  \path [line,black,thick] (ligand2) |-node{}(bottom2);
\end{tikzpicture}

\end{document}

non-overlay overlaid arrows

  • oh great, silly me. thanks for spotting that out. – Spencer Trinh Aug 14 '15 at 0:14
  • Can I bother you with something? If you can run the document in this answer it runs with some warnings using xelatex but pdflatex fails with errors related to fontawesome. I am not familiar with that package, but I've used it without problems in other sitiuations. Do you have any idea where the problem is? – Gonzalo Medina Aug 14 '15 at 0:26
  • @GonzaloMedina: Not quite sure that I really got what you are referring too. But the undefined ` \faMobile ` is simply due to an outdated package. It doesn't work in TL14. This symbol has been added later. – Ulrike Fischer Aug 14 '15 at 8:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.