我正在使用 pstricks 包在 pdflatex 构建设置中绘制图形,但在输出 pdf 中,图形丢失了。这是代码。
\documentclass{article}
\usepackage[pdf]{pstricks}
\def\pdfshellescape{1}
\usepackage{auto-pst-pdf}
\usepackage{pst-all}
\begin{document}
text here
\begin{figure}
\begin{center}
\psscalebox{1.0 1.0} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-4.34)(6.54,2.14)
\psframe[linecolor=black, linewidth=0.04, dimen=outer](6.12,2.14)(0.0,-3.98)
\psframe[linecolor=black, linewidth=0.04, dimen=outer](6.54,-3.5)(5.7,-4.34)
\psframe[linecolor=black, linewidth=0.04, shadow=true,shadowsize=0.10583334,shadowcolor=blue,
dimen=outer](3.34,0.78)(1.3,-1.26)
\psframe[linecolor=black, linewidth=0.04, shadow=true,shadowsize=0.10583334,shadowcolor=blue,
fillstyle=solid,fillcolor=red, dimen=outer](2.46,-1.42)(1.46,-2.42)
\end{pspicture}
}
\end{center}
\end{figure}
\end{document}
答案1
使用
\documentclass{article}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\usepackage{pst-all}
\begin{document}
[...]
进而pdflatex --shell-escape <file>
答案2
如果您是 AUCTeX 用户,则无需使用 auto-pst-pdf 包。只需将变量 TeX-PDF-from-Dvi 设置为“Dvips”,并将 TeX-PDF-mode 设置为 1。例如,可以使用 add-file-local-variable 完成此操作
\documentclass{article}
\usepackage[pdf]{pstricks}
%\def\pdfshellescape{1}
%\usepackage{auto-pst-pdf}
\usepackage{pst-all}
\begin{document}
text here
\begin{figure}
\begin{center}
\psscalebox{1.0 1.0} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-4.34)(6.54,2.14)
\psframe[linecolor=black, linewidth=0.04, dimen=outer](6.12,2.14)(0.0,-3.98)
\psframe[linecolor=black, linewidth=0.04, dimen=outer](6.54,-3.5)(5.7,-4.34)
\psframe[linecolor=black, linewidth=0.04, shadow=true,shadowsize=0.10583334,shadowcolor=blue,
dimen=outer](3.34,0.78)(1.3,-1.26)
\psframe[linecolor=black, linewidth=0.04, shadow=true,shadowsize=0.10583334,shadowcolor=blue,
fillstyle=solid,fillcolor=red, dimen=outer](2.46,-1.42)(1.46,-2.42)
\end{pspicture}
}
\end{center}
\end{figure}
\end{document}
% Local Variables:
% TeX-PDF-from-DVI: "Dvips"
% eval: (TeX-PDF-mode 1)
% End: