TransWikia.com

pstricks is not work properly

TeX - LaTeX Asked on September 27, 2021

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}
defpdfshellescape{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 Answers

Use

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

and then pdflatex --shell-escape <file>

Answered by user187802 on September 27, 2021

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}
%defpdfshellescape{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:

Answered by gigiair on September 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP