Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have quite a huge document with many pgfplots, which I would like to externalize. Well I can externalize them, but my \AddEverypageHook command from the everypage package affects this externalized plots.

I add a background picture to every page:

\AddEverypageHook{\ThisTileWallPaper{\paperwidth}{\paperheight}{res/background.pdf}}

Unfortunately this background picture appears in the externalized plots: error

Has anyone an idea to resolve this?

Update

Here is a minimal example:

\documentclass{scrreprt}

\usepackage[ngerman]{babel}

\usepackage{everypage}
\usepackage{wallpaper}
\usepackage{gnuplottex}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.polar}
\usepgfplotslibrary{external}
\tikzexternalize

\begin{document}
    \ThisULCornerWallPaper{}{res/background.pdf}

    \begin{figure}[h!tbp]
        \begin{center}
            \begin{tikzpicture}
                \begin{axis}[
                        height=5cm,
                        width=\textwidth,
                        domain=-3:10
                    \addplot[color=black] (x);
                \end{axis}
            \end{tikzpicture}
        \end{center}
    \end{figure}

\end{document}

The background.pdf-file is an A4 paper. It produces this result: bla

share|improve this question
    
Without a minimal working example (MWE), I think this could be very difficult to diagnose. Could you narrow down your large file to exhibit the issue with a simple pgfplot and basic background image from the mwe package or similar? This would make it more accessible to the community and you might discover the problem yourself in making the MWE. :-) –  Paul Gessler Mar 13 at 14:26
    
I would try TikZ and its absolute positioning instead of page hooking. Usually we deal with one resulting picture, then we put whole tikzpicture environment into header by using \fancyhead command from the fancyhdr package. –  Malipivo Mar 19 at 12:41
    
Sorry, for the long quiet time! I had to finish the paper first. I've finally added a minimal example. –  Sam Apr 13 at 19:46

1 Answer 1

up vote 1 down vote accepted

You can use \tikzifexternalizing{<code for true>}{<code for false>} to make something different during the externalization:

\documentclass{scrreprt}

\usepackage{everypage}
\usepackage{wallpaper}
\usepackage{gnuplottex}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.polar}
\usepgfplotslibrary{external}
\tikzexternalize

\begin{document}
    \tikzifexternalizing{}{%
    \ThisULCornerWallPaper{}{PP.pdf}%
    }

    \begin{figure}[h!tbp]
        \begin{center}
            \begin{tikzpicture}
                \begin{axis}[
                        height=5cm,
                        width=\textwidth,
                        domain=-3:10]
                    \addplot[color=black] {x};
                \end{axis}
            \end{tikzpicture}
        \end{center}
    \end{figure}

\end{document}

My image is

\documentclass{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
    \shade[left color=red,right color=white] (0,0) rectangle(10,1);
\end{tikzpicture}
\end{document}

enter image description here

PS Note the compile errors in your external image.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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