2

I am using pstricks package to draw a figure in pdflatex build setting, but in output pdf, the figure is missing. Here is the code.

\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}
2
  • Did you actually run it with shell-escape enabled? That is not something you can do from with in LaTeX (for obvious reasons as being able to run arbitrary commands is a security risk) – daleif Jun 11 '20 at 15:14
  • \def\pdfshellescape{1} will break all tests for whether shell escape is enabled. – David Carlisle Jul 27 '20 at 20:23
1

Use

\documentclass{article}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\usepackage{pst-all}
\begin{document}
[...]

and then pdflatex --shell-escape <file>

0

If you are a AUCTeX user, you don't need using package auto-pst-pdf. Just set the variable TeX-PDF-from-Dvi to "Dvips" and TeX-PDF-mode to 1. This can be done (for instance) with 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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.