我想使用pstricks
。auto-pst-pdf
但是,在 上运行示例代码http://tug.org/PSTricks/main.cgi?file=pdf/pdfoutput#autopstpdf出现以下错误:
Package auto-pst-pdf Warning:
Could not create document-pics.pdf. Auxiliary files not deleted.
This warning occured on input line 124.
这是输入
\documentclass[12pt]{article}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\pagestyle{empty}
\begin{document}
\begin{pspicture}(-5.25,-5.25)(5.25,5.25)%
\pscircle*[linecolor=cyan]{5}
\psgrid[subgriddiv=0,gridcolor=lightgray,gridlabels=0pt]
\Huge\sffamily\bfseries
\rput(-4.5,4.5){A} \rput(4.5,4.5){B}
\rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
\rput(0,0){auto-pst-pdf}
\rmfamily
\rput(0,-3.8){PSTricks}
\rput(0,3.8){\LaTeX}
\end{pspicture}
% \includegraphics{foo}% can be foo.jpg or foo.png
\end{document}
这是输出:
Z:\>pdflatex -shell-escape C:\Daten-Privat\mjira\workspace\test\document.tex
This is pdfTeX, Version 3.1415926-1.40.11 (MiKTeX 2.9)
entering extended mode
(C:/Daten-Privat/mjira/workspace/test/document.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2009-06-19, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, lao, latin, lat
vian, lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerm
an, ngerman-x-2009-06-19, nynorsk, oriya, panjabi, pinyin, polish, portuguese,
romanian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swis
sgerman, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, u
senglishmax, welsh, loaded.
("C:\Programme\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Programme\MiKTeX 2.9\tex\latex\base\size12.clo"))
("C:\Programme\MiKTeX 2.9\tex\latex\pstricks\pstricks.sty"
>>> Loading package auto-pst-pdf <<<
("C:\Programme\MiKTeX 2.9\tex\generic\pstricks\pstricks.tex"
("C:\Programme\MiKTeX 2.9\tex\generic\xkeyval\pst-xkey.tex"
("C:\Programme\MiKTeX 2.9\tex\latex\xkeyval\xkeyval.sty"
("C:\Programme\MiKTeX 2.9\tex\generic\xkeyval\xkeyval.tex"
("C:\Programme\MiKTeX 2.9\tex\generic\xkeyval\keyval.tex"))))
("C:\Programme\MiKTeX 2.9\tex\generic\pstricks\pst-fp.tex"
`pst-fp' v0.05, 2010/01/17 (hv))
`PSTricks' v2.13 <2010/11/01> (tvz)
("C:\Programme\MiKTeX 2.9\tex\generic\pstricks\pstricks.con"))
("C:\Programme\MiKTeX 2.9\tex\generic\pstricks\pst-fp.tex")
("C:\Dokumente und Einstellungen\mjira\anwendungsdaten\MiKTeX\2.9\tex\latex\xco
lor\xcolor.sty" ("C:\Programme\MiKTeX 2.9\tex\latex\00miktex\color.cfg")
("C:\Programme\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"))) (Z:\document.aux)
("C:\Dokumente und Einstellungen\mjira\anwendungsdaten\MiKTeX\2.9\tex\latex\aut
o-pst-pdf\auto-pst-pdf.sty"
("C:\Programme\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty")
("C:\Dokumente und Einstellungen\mjira\anwendungsdaten\MiKTeX\2.9\tex\latex\ifp
latform\ifplatform.sty"
("C:\Programme\MiKTeX 2.9\tex\generic\oberdiek\pdftexcmds.sty"
("C:\Programme\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
("C:\Programme\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty")
("C:\Programme\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"))
("C:\Programme\MiKTeX 2.9\tex\generic\oberdiek\catchfile.sty"
("C:\Programme\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty")))" "
"-------------------------------------------------"
"auto-pst-pdf: Auxiliary LaTeX compilation"
"-------------------------------------------------"
Package auto-pst-pdf Warning:
Could not create document-pics.pdf. Auxiliary files not deleted.
This warning occured on input line 124.
"-------------------------------------------------"
"auto-pst-pdf: End auxiliary LaTeX compilation"
"-------------------------------------------------"
("C:\Dokumente und Einstellungen\mjira\anwendungsdaten\MiKTeX\2.9\tex\latex\pst
-pdf\pst-pdf.sty" ("C:\Programme\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
("C:\Programme\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
("C:\Programme\MiKTeX 2.9\tex\latex\graphics\trig.sty")
("C:\Programme\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg")))
("C:\Dokumente und Einstellungen\mjira\anwendungsdaten\MiKTeX\2.9\tex\latex\pre
view\preview.sty"
Preview: Fontsize 12pt
Preview: PDFoutput 1
) ("C:\Programme\MiKTeX 2.9\tex\latex\graphics\dvips.def")
("C:\Dokumente und Einstellungen\mjira\anwendungsdaten\MiKTeX\2.9\tex\latex\env
iron\environ.sty")))
("C:\Dokumente und Einstellungen\mjira\anwendungsdaten\MiKTeX\2.9\tex\context\b
ase\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)
Package pst-pdf Warning: pspicture No. 1 undefined.
Package pst-pdf Warning: File `document-pics.pdf' not found.
(pst-pdf) Use the following commands to create it:
(pst-pdf) ----------------------------------------------------
(pst-pdf) latex document.tex
(pst-pdf) dvips -o document-pics.ps document.dvi
(pst-pdf) ps2pdf document-pics.ps
(pst-pdf) ---------------------------------------------------- .
(Z:\document.aux) )
No pages of output.
Transcript written on document.log.
(Strawberry-)Perl 已安装:
Z:\>perl -v
This is perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32-x86-multi-t
hread
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
您知道要检查什么吗?
答案1
如果您希望从 TeX 主输入文件中导入所有 PSTricks 代码,那么使用xelatex
比使用pdflatex
+更好。使用+auto-pst-pdf
有很多限制。我将在下一次编辑中列出详细信息。pdflatex
auto-pst-pdf
如果您希望在 TeX 主输入文件中导入一些 PSTricks 代码,并将剩余的 PSTricks 代码转换为 PDF 图像,那么使用xelatex
+ preview
package。
如果你的 PSTricks 代码
\label
如下例所示使用:\begin{equation}\label{eq:Einstein} \rnode{A}{E}=mc^\rnode{B}{2} \ncbar[angle=90]{A}{B} \end{equation}
或导入 PNG、PDF、JPG 类型的图像,如下例所示:
\newsavebox\IBox \savebox\IBox{\includegraphics{image.jpg}} \pspicture(\wd\IBox,\ht\IBox) \rput[bl](0,0){\usebox\IBox} \endpspicture
或者与包一起使用,
animate
如下例所示:\animateinline[palindrome,autoplay]{10} \multiframe{11}{r=1+-0.1}{% \pspicture(2,2) \pscircle*[linecolor=red,opacity=0.5](1,1){\r} \endpspicture} \endanimateinline
那么pdflatex -enable-write18
+auto-pst-pdf
就不能用来产生正确的结果。
解决方案:使用xelatex
,但是如果你编译整个输入文件,它运行起来会非常非常慢。为了加快编译速度,你应该将输入文件分成几个子文件。将每个“独立”的 PSTricks 片段放入单独的输入文件中,然后编译它以生成单个 PDF 输出。
注意:独立的 PSTricks 片段是不属于上述 3 种情况的 PSTricks 代码。
“独立” PSTricks 片段的示例:
% frame.tex
\documentclass{article}
\usepackage{pstricks}
% preview must come after any pstricks package!
\usepackage[active,tightpage]{preview}
\PreviewBorder=0pt\relax
% Either
\PreviewEnvironment{pspicture}
% or
%\PreviewEnvironment{pspicture*}
\begin{document}
\begin{pspicture}(1,1)
\psframe(1,1)
\end{pspicture}
\end{document}
xelatex
用(比蜗牛慢)或latex-dvips-ps2pdf
(比光快)进行编译,您将得到frame.pdf
。
frame.pdf
稍后,您可以按如下方式从主输入文件中导入:
% main.tex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{frame.pdf}\newpage
\animateinline[palindrome,autoplay]{10}
\multiframe{11}{r=1+-0.1}{%
\pspicture(2,2)
\pscircle*[linecolor=red,opacity=0.5](1,1){\r}
\endpspicture}
\endanimateinline
\end{document}
再次,xelatex
仅使用编译主输入文件。但编译速度会更快!注意:latex-dvips-ps2pdf
无法导入 PDF 图像,这就是为什么您必须xelatex
仅使用!
preview
注意:如果加载 包,主输入文件不得加载包animate
。实际上,您永远不需要加载preview
主输入文件,只有子文件才需要preview
。