1

I would like to externalize plots that have citations (and or acronyms) in the legend. A simple example below

\documentclass{article}
\usepackage[english]{babel} 
\usepackage{acronym}
\acrodef{ls}        [LS]            {Least Squares}
\usepackage{pgfplots}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
\begin{tikzpicture}
\begin{axis}
    \addplot coordinates { (0,0) (1,0) };
    \addplot coordinates { (0,1) (1,1) };
    \addplot coordinates { (0,2) (1,2) };
    \legend {\ac{ls} \cite{ref1}, \cite{ref2}, \tikzexternaldisable \ac{ls} \cite{ref3}\tikzexternalenable}     
\end{axis}
\end{tikzpicture}


\ac{ls} 
\cite{ref1}
\cite{ref2}
\cite{ref3}

\begin{thebibliography}{1}


\bibitem{ref1}
A.~Xxxxx, X.~Xxxx, ``ref 1,''.

\bibitem{ref2}
B.~Xxxxx, X.~Xxxx, ``ref 2,''.

\bibitem{ref3}
C.~Xxxxx, X.~Xxxx, ``ref 3,''.

\end{thebibliography}
\end{document}

The references are not working with the figure but works in the normal text. I tried using \tikzexternaldisable and \tikzexternalenable as suggested in pgfplots: externalization and legend referencing but no success. Also I tied with References in externalized pgfplots but could not make it work for my case!

I will appreciate simple and complete solution since I am not an expert with LaTeX.

Stefan Pinnow
  • 29,535
  • For me "Solution 1" in https://tex.stackexchange.com/a/40684 is working fine, so I think this is a duplicate of that question. If you still think that this is not working for you, please add more information on why you think so/what error message you get. – Stefan Pinnow Jul 21 '17 at 05:28

0 Answers0