beamer 中的 \psfrag、pdflatex 问题

beamer 中的 \psfrag、pdflatex 问题

我正在使用 beamer 创建演示文稿,使用了许多 Matlab 生成的图形,到目前为止,我使用 \psfrag 和“auto-pst-pdf”来制作文章。但是,当我尝试将相同的技术用于 beamer 时,由于某些原因,它不起作用,并返回以下错误:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit)         
(preloaded format=pdflatex 2016.7.6)  10 NOV 2016 16:07
entering extended mode
! Undefined control sequence.
<recently read> \psfrag
l.15 \end{frame}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
Overfull \hbox (117.2166pt too wide) in paragraph at lines 15--15
[]\OT1/lmss/m/n/10.95 SC[c][]Sensor
[]
Overfull \vbox (67.0767pt too high) detected at line 15
[]
[1
Non-PDF special ignored!
Non-PDF special ignored!
Non-PDF special ignored!{C:/Users/rganapat/AppData/Local/MiKTeX/2.9/pdftex/conf
ig/pdftex.map} <./test-pics.pdf>]
\tf@nav=\write6
\openout6 = `test.nav'.
\tf@toc=\write7
\openout7 = `test.toc'.
\tf@snm=\write8
\openout8 = `test.snm'.
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 16.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 16.
(test.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 16.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 16.
Package rerunfilecheck Info: File `test.out' has not changed.
(rerunfilecheck) Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 16.
)
Here is how much of TeX's memory you used:
18442 strings out of 493335
352078 string characters out of 3128932
435874 words of memory out of 3000000
21529 multiletter control sequences out of 15000+200000
15137 words of font info for 20 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
56i,11n,55p,414b,378s stack positions out of 5000i,500n,10000p,200000b,50000s
{C:/Users/rganapat/AppData/Local/Programs/MiKTeX 2.9/fonts/enc/dvips/lm/lm-rm
.enc}<C:/Users/rganapat/AppData/Local/Programs/MiKTeX 2.9/fonts/type1/public/lm
/lmss10.pfb><C:/Users/rganapat/AppData/Local/Programs/MiKTeX 2.9/fonts/type1/pu
blic/lm/lmss12.pfb>
Output written on test.pdf (1 page, 33183 bytes).
PDF statistics:
35 PDF objects out of 1000 (max. 8388607)
3 named destinations out of 1000 (max. 500000)
41 words of extra memory for PDF output out of 10000 (max. 10000000)

有人能帮我解决这个问题吗?此外,我正在使用 shell escape 运行我的 pdflatex。此外,我还提供了一个 MWE 供您使用。

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{auto-pst-pdf}
\setbeamertemplate{navigation symbols}{} 
\begin{document}
\begin{frame}
\frametitle{Circle}
\begin{figure}
   { 
   \psfragfig[width=0.3\textwidth]{images/f11.eps}
   \psfrag{SC}[c][]{Sensor carrier}
    }
\end{figure}
\end{frame}
\end{document}

提前致谢。

答案1

如错误所示,\psfrag尚未定义。您可以使用pstool它在一定程度上自动化此操作,例如,此操作运行时不会出现错误

\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}
\usepackage{pstool}
\setbeamertemplate{navigation symbols}{} 
\begin{document}
\begin{frame}
\frametitle{Circle}
\begin{figure}
   \psfragfig[width=0.3\textwidth]{example-image-a}{
   \psfrag{A}[c][]{Sensor carrier}
    }
\end{figure}
\end{frame}
\end{document}

虽然实际上比尝试使用 shell-escape 技巧将 psfrag 与 pdflatex 结合使用更简单,但我会使用一个包含文章类和 latex 的小型自包含文档来制作一个带有 psfrag 替换的新 pdf,然后将新的 pdf 包含到 beamer 演示文稿中\includegraphics

相关内容