0

I am using pistols (\psfragfig) commands for font substitutions in .eps graphic files. In addition I am using the background package to have a graph paper background. With normal \includegraphics there is no problem but when using \psfragfig the command pulls the background grid into each picture when creating the .pdf file.

Below is the background code used.

\def\mygraphpaper{%
\begin{tikzpicture}
\draw[step=0.2in,line width=0.0pt,gray!60!white] (-3.5in,-4.5in) grid (3.5in,4.75in);
%       \draw[step=1.0in,line width=0.01pt,gray!60!white] (-3.5in,-4.5in) grid (3.5in,4.75in);
\draw[thick,gray!80!black] (-3.5in,5.5in) -- (-3.5in,-5.5in);       % left border
\draw[thick,gray!80!black] (3.5in,5.5in) -- (3.5in,-5.5in);     % right border
\draw[thick,gray!80!black] (-4.25in,4.75in) -- (4.25in,4.75in); % top border
\draw[thick,gray!80!black] (-1.167in,5.5in) -- (-1.167in,4.75in);  % left title
\draw[thick,gray!80!black] (1.167in,5.5in) -- (1.167in,4.75in);    % right title
\end{tikzpicture}
}
\usepackage{tikz}
\usepackage{background}
\backgroundsetup{
    angle=0,
    contents=\mygraphpaper,
    color=black,
    scale=1,
    opacity=1
}

And here is a typical figure

\usepackage[ %
    crop=pdfcrop, %
    cleanup={.tex,.dvi,.ps,.pdf,.log,.aux} %
    ]{pstool}

followed by

\begin{figure}[h!]
    \centering
    \psfragfig*[width=0.45\linewidth]{images/MyFigure}
    \caption{A figure.}
    \label{fig:myfigure}
\end{figure}

The result is that each .eps that gets converted to .pdf includes the full background image as well. Any way to fix this?

0

So I managed to finally fix the problem. By placing a \NoBgThispage command at the beginning of each <figure>.tex file suppresses the background from processing when going through the initial processing of the figures.

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.