# Using pstool with beamer

I would like to use pstool with beamer to create a presentation in pdflatex with figures processed by psfrag. However, as the simple example below shows, the figures are processed using the beamer documentclass, so that they each have a full beamer "frame" around them. Is there a way around this?

\documentclass{beamer}

\usepackage{lmodern}
\usepackage{graphicx}
\usepackage[process=all,crop=pdfcrop]{pstool}

\begin{document}
\begin{frame}
\frametitle{Circle}
\begin{figure}
\psfragfig[width=0.3\textwidth]{figures/circle}
{
\psfrag{1}{$$s$$}
}
\end{figure}
\end{frame}
\end{document}


I suspect that if it's possible to override the documentclass used by pstool to process the figures, that would be a solution, but I haven't found how to do this.

Thanks.

• I should add that I'm on a fully updated version of Tex Live 2013 (on Linux, if that matters)
– mjr
Mar 24 '14 at 19:28

The key to solving this is to realise that a "regular" compilation process sends your document through pdfLaTeX in PDF mode, and in order to do the psfrag replacements the graphic is sent through pdfLaTeX in DVI mode.

Therefore, conditional commands for either the main document only or each graphic only can simply use \ifpdf:

\ifpdf
% setup for the main document only
\else
% setup for pstool images only
\fi


\ifpdf\else
\fi


This is entirely unmentioned in the documentation, so I'll go fix that up now.

pstool package uses the preamble of main document class(in your Q it is beamer) to build the pdf figures during the underhood auxiliary processing (latex-dvips-ps2pdf) of .eps figure and psfrag commands. So to get a circle.pdf figure without navigation bar add

\setbeamertemplate{navigation symbols}{}


in the preamble after \documentclass{beamer}as shown in How to get rid of navigation symbols in beamer? and compile with pdflatex -shell-escape gives

Once you have all pdf figures are generated via auxiliary processing. Set the option process=none instead of process=all and comment out the only line like this %\setbeamertemplate{navigation symbols}{} to process beamer slides with figures (navigation bar less) and finally you will get navigation bar on main beamer slides.

Note: \EndPreamble can be used to limit the preamble used for auxiliary processing and thereby speed it up. More details refer pstool documentation

• This sounds very promising. I'll try it when I get a chance and let you know how it goes. Thanks!
– mjr
Apr 25 '14 at 15:59
• However, it does seem like this would get rid of the navigation symbols for the actual presentation as well as the embedded figures. Is there a way to avoid this?
– mjr
Apr 25 '14 at 16:03
• @mjrussell Navigation bar symbols will be added once you comment %\setbeamertemplate{navigation symbols}{} and set process=none since we have already generated pdf figures(without navigation symbol). Apr 25 '14 at 20:31
• It's a bit of a "manual" process, but it should work I guess. Thanks. I wonder if there is a nice way to automate this
– mjr
May 7 '14 at 15:54
• @mjrussell No to my knowledge, but you may post it as feature request to remove navigation symbols in figures with beamer class with pstool at Package authors github's repo github.com/wspr/pstool/issues May 7 '14 at 18:22