不能包含 pspicture 代码

不能包含 pspicture 代码

我正在尝试使用创建演示文稿beamer我的演示文稿中需要包含一张用 LaTeXDraw 软件制作的图片,我把绘制图片的代码粘贴在了框架里面,但是编译不通过,出现错误报告:

未定义的控制序列\end{frame}

以下是代码:

\documentclass{beamer}
\usetheme{default}
\usepackage{epstopdf}
\usepackage{pstricks-add}
\begin{document}

\begin{frame}{First One}
% Generated with LaTeXDraw 2.0.8
% Fri Feb 28 12:28:30 BDT 2014
% \usepackage[usenames,dvipsnames]{pstricks}
% \usepackage{epsfig}
% \usepackage{pst-grad} % For gradients
% \usepackage{pst-plot} % For axes
\scalebox{1} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-1.38)(7.92,1.38)
\psdots[dotsize=0.12](0.06,1.3)
\psdots[dotsize=0.12](0.86,1.3)
\psdots[dotsize=0.12](0.46,0.9)
\psdots[dotsize=0.12](0.46,0.3)
\psline[linewidth=0.04cm](0.08,1.3)(0.46,0.92)
\psline[linewidth=0.04cm](0.46,0.9)(0.46,0.32)
\psline[linewidth=0.04cm](0.46,0.94)(0.86,1.3)
\psdots[dotsize=0.12](2.06,0.9)
\psdots[dotsize=0.12](2.64,0.9)
\psdots[dotsize=0.12](3.24,0.9)
\psdots[dotsize=0.12](3.84,0.9)
\psline[linewidth=0.04cm](2.08,0.9)(2.64,0.9)
\psline[linewidth=0.04cm](2.66,0.9)(3.26,0.9)
\psline[linewidth=0.04cm](3.26,0.9)(3.82,0.9)
\psdots[dotsize=0.12](4.84,1.3)
\psdots[dotsize=0.12](4.84,0.5)
\psdots[dotsize=0.12](5.44,0.9)
\psdots[dotsize=0.12](6.24,0.9)
\psline[linewidth=0.04cm](4.84,1.28)(4.84,0.52)
\psline[linewidth=0.04cm](4.84,1.32)(5.46,0.9)
\psline[linewidth=0.04cm](4.84,0.48)(5.46,0.92)
\psline[linewidth=0.04cm](5.46,0.9)(6.26,0.9)
\psdots[dotsize=0.12](7.06,1.3)
\psdots[dotsize=0.12](7.84,1.3)
\psdots[dotsize=0.12](7.84,0.5)
\psdots[dotsize=0.12](7.06,0.48)
\psline[linewidth=0.04cm](7.06,1.3)(7.86,1.3)
\psline[linewidth=0.04cm](7.86,1.3)(7.86,0.52)
\psline[linewidth=0.04cm](7.84,0.46)(7.06,0.46)
\psline[linewidth=0.04cm](7.06,0.48)(7.08,1.34)
\psdots[dotsize=0.12](2.26,-0.3)
\psdots[dotsize=0.12](2.26,-1.3)
\psdots[dotsize=0.12](1.24,-0.8)
\psdots[dotsize=0.12](3.22,-0.8)
\psline[linewidth=0.04cm](2.28,-0.3)(2.28,-1.26)
\psline[linewidth=0.04cm](1.22,-0.78)(2.32,-0.3)
\psline[linewidth=0.04cm](1.28,-0.8)(2.26,-1.28)
\psline[linewidth=0.04cm](2.3,-1.28)(3.2,-0.8)
\psline[linewidth=0.04cm](2.28,-0.28)(3.22,-0.8)
\psdots[dotsize=0.12](6.04,-0.08)
\psdots[dotsize=0.12](5.06,-1.3)
\psdots[dotsize=0.12](7.26,-1.3)
\psdots[dotsize=0.12](6.12,-0.8)
\psline[linewidth=0.04cm](6.04,-0.1)(5.04,-1.3)
\psline[linewidth=0.04cm](5.08,-1.3)(7.26,-1.28)
\psline[linewidth=0.04cm](7.26,-1.3)(6.04,-0.04)
\psline[linewidth=0.04cm](6.04,-0.04)(6.14,-0.78)
\psline[linewidth=0.04cm](5.04,-1.3)(6.12,-0.8)
\psline[linewidth=0.04cm](6.12,-0.8)(7.22,-1.26)
\end{pspicture} 
}

\end{frame}

\end{document}

\begin{frame}和之间的所有内容\end{frame}均由 LaTeXDraw 创建。

怎么了?

答案1

beamer这是和的问题pstricks-add。但是,你不应该使用 LaTeXDraw 的导出,它非常糟糕。这会产生同样的效果:

\listfiles
\documentclass{beamer}
\usepackage{pstricks}
\begin{document}

\begin{frame}{First One}
\begin{pspicture}(0,-1.38)(7.92,1.38)
\psset{linewidth=0.04cm,showpoints}
\psline(0.08,1.3)(0.46,0.93)(0.46,0.32)
\psline(0.46,0.94)(0.86,1.3)
\psline(2.08,0.9)(2.64,0.9)(3.26,0.9)(3.82,0.9)
\psline(6.26,0.9)(5.46,0.9)(4.84,0.48)(4.84,1.32)(5.46,0.9)
\pspolygon(7.06,0.48)(7.86,0.48)(7.86,1.3)(7.06,1.3)
\psline(2.28,-1.28)(1.22,-0.78)(2.28,-0.3)(3.22,-0.78)(2.28,-1.28)(2.28,-0.3)
\pspolygon(6.04,-0.1)(5.04,-1.3)(7.26,-1.28)
\psline(7.26,-1.3)(6.12,-0.8)(5.04,-1.3)
\psline(6.04,-0.1)(6.12,-0.8)
\end{pspicture} 
\end{frame}

\end{document}

已加载文件的输出(在日志文件的末尾):

*File List*
beamer.cls 2013/12/02 3.33 A class for typesetting presentations (rcs-revi
sion 332bfd3ce558)
beamerbasercs.sty 2013/12/25 (rcs-revision 31cc758a62ae)
beamerbasemodes.sty 2013/09/03 (rcs-revision 768f2d98ca64)
beamerbasedecode.sty 2010/05/01 (rcs-revision efa082c6111d)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
beamerbaseoptions.sty 2013/03/10 (rcs-revision 47431932db0d)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
geometry.sty 2010/09/12 v5.6 Page Geometry
ifvtex.sty 2010/03/01 v1.5 Detect VTeX and its facilities (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
size11.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
pgfcore.sty 2010/04/11 v3.0.0 (rcs-revision 1.7)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
xetex.def 2013/04/29 v0.96 LaTeX color/graphics driver for XeTeX (RRM/JK)
pgfsys.sty 2013/11/30 v3.0.0 (rcs-revision 1.47)
pgfrcs.sty 2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pgfcore.code.tex
xxcolor.sty 2003/10/24 ver 0.1
atbegshi.sty 2011/10/05 v1.16 At begin shipout hook (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
hyperref.sty 2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
hobsub.sty 2012/05/28 v1.13 Construct package bundles (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
intcalc.sty 2007/09/27 v1.1 Expandable calculations with integers (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2012/04/08 v1.3 Expandable calculations on big integers (HO)
bitset.sty 2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty 2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty 2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
hopatch.sty 2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty 2011/01/30 xcolor patch
atveryend.sty 2011/06/30 v1.8 Hooks at the very end of document (HO)
refcount.sty 2011/10/16 v3.4 Data extraction from label references (HO)
hycolor.sty 2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
auxhook.sty 2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hxetex.def 2012/11/06 v6.83m Hyperref driver for XeTeX
puenc.def 2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
stringenc.sty 2011/12/02 v1.10 Convert strings between diff. encodings (HO)
rerunfilecheck.sty 2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
se-ascii-print.def 2011/12/02 v1.10 stringenc: Printable ASCII characters
beamerbaserequires.sty 2010/05/01 (rcs-revision efa082c6111d)
beamerbasecompatibility.sty 2012/05/01 (rcs-revision 67c48b3b652d)
beamerbasefont.sty 2013/10/18 (rcs-revision 72f39e01808a)
amssymb.sty 2013/01/14 v3.01 AMS font symbols
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
sansmathaccent.sty 2013/03/28
filehook.sty 2011/10/12 v0.5d Hooks for input files
beamerbasetranslator.sty 2010/06/11 (rcs-revision 85fd1cc7fc42)
translator.sty 2010/06/12 ver 1.10
translator-language-mappings.tex
beamerbasemisc.sty 2013/09/03 (rcs-revision a55719c41d85)
beamerbasetwoscreens.sty 2010/05/01 (rcs-revision efa082c6111d)
beamerbaseoverlay.sty 2013/12/25 (rcs-revision f6bd5e3805da)
beamerbasetitle.sty 2010/09/21 (rcs-revision f0446ed0b6ae)
beamerbasesection.sty 2013/06/07 (rcs-revision 60b9fe0f342f)
beamerbaseframe.sty 2013/10/02 (rcs-revision cdc8e9a3aaac)
beamerbaseverbatim.sty 2012/08/30 (rcs-revision dfdb135076b3)
beamerbaseframesize.sty 2011/09/12 (rcs-revision 70f9d8411e54)
beamerbaseframecomponents.sty 2013/10/18 (rcs-revision 5cf6c5555a45)
beamerbasecolor.sty 2010/06/06 (rcs-revision d1a9b48be06d)
beamerbasenotes.sty 2012/12/19 (rcs-revision 1686da3db3c9)
beamerbasetoc.sty 2013/05/23 (rcs-revision 0fdf5bc43be8)
beamerbasetemplates.sty 2010/05/01 (rcs-revision efa082c6111d)
beamerbaseauxtemplates.sty 2013/09/04 (rcs-revision 4ac715c499d0)
beamerbaseboxes.sty 2012/05/13 (rcs-revision 56972908a390)
beamerbaselocalstructure.sty 2013/09/04 (rcs-revision 4ac715c499d0)
enumerate.sty 1999/03/05 v3.00 enumerate extensions (DPC)
beamerbasenavigation.sty 2013/10/05 (rcs-revision 62be157fe783)
beamerbasetheorems.sty 2010/06/06 (rcs-revision 7e7cc5e53e9d)
amsmath.sty 2013/01/14 v2.14 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
amsthm.sty 2004/08/06 v2.20
beamerbasethemes.sty 2010/05/01 (rcs-revision efa082c6111d)
beamerthemedefault.sty 2010/06/17 (rcs-revision d02a7cf4d8ae)
beamerfontthemedefault.sty 2012/12/19 (rcs-revision 1686da3db3c9)
beamercolorthemedefault.sty 2012/12/19 (rcs-revision 1686da3db3c9)
beamerinnerthemedefault.sty 2013/10/15 (rcs-revision 65cb471f9634)
beamerouterthemedefault.sty 2012/12/19 (rcs-revision 1686da3db3c9)
pstricks.sty 2013/12/12 v0.60 LaTeX wrapper for `PSTricks' (RN,HV)
pstricks.tex 2014/02/03 v2.51 `PSTricks' (tvz,hv)
pst-xkey.tex 2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
xkeyval.sty 2012/10/14 v2.6b package option processing (HA)
xkeyval.tex 2012/10/14 v2.6b key=value parser (HA)
pst-fp.tex 2014/02/03 v2.51 `PST-fp' (hv)
pstricks.pro 2012/10/16 v. 1.15, PostScript prologue file (hv)
pst-algparser.pro 2011/10/31 v. 0.04, PostScript prologue file (hv)
pst-tools.pro 2012/01/01 v. 0.02, PostScript prologue file (hv)
pst-dots.pro 2006/12/19 v. 2.00, PostScript prologue file (hv)
nameref.sty 2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty 2010/12/03 v1.4 Cleanup title references (HO)
torus.out
torus.out
translator-basic-dictionary-English.dict
translator-bibliography-dictionary-English.dict
translator-environment-dictionary-English.dict
translator-months-dictionary-English.dict
translator-numbers-dictionary-English.dict
translator-theorem-dictionary-English.dict
***********

另外,您可以加载您的代码pstricks而不是pstricks-add

答案2

我粗暴地窃取了 Herbert 的代码,并对其进行了少许改进(删除了一些字符,并通过加载lmodern包裹):

\documentclass{beamer}

\usepackage{lmodern}
\usepackage{pstricks}

\begin{document}

\begin{frame}{First One}
\begin{pspicture}(0,-1.38)(7.92,1.38)
  \psset{linewidth = 0.04, showpoints}
  \psline(0.08,1.3)(0.46,0.93)(0.46,0.32)
  \psline(0.46,0.94)(0.86,1.3)
  \psline(2.08,0.9)(2.64,0.9)(3.26,0.9)(3.82,0.9)
  \psline(6.26,0.9)(5.46,0.9)(4.84,0.48)(4.84,1.32)(5.46,0.9)
  \pspolygon(7.06,0.48)(7.86,0.48)(7.86,1.3)(7.06,1.3)
  \psline(2.28,-1.28)(1.22,-0.78)(2.28,-0.3)(3.22,-0.78)(2.28,-1.28)(2.28,-0.3)
  \pspolygon(6.04,-0.1)(5.04,-1.3)(7.26,-1.28)
  \psline(7.26,-1.3)(6.12,-0.8)(5.04,-1.3)
  \psline(6.04,-0.1)(6.12,-0.8)
\end{pspicture}
\end{frame}

\end{document}

相关内容