5

I have managed to make PSTricks work with TeXworks. However after compilation it adds -autopp to the basename of the pdf file, e.g. report.pdf becomes report-autopp.pdf. As a result TeXworks is not able to preview the file in a window.

How can I make TeXworks preview the pdf file? Am I doing something wrong? Here is my tex file:

\documentclass{article}
\usepackage[pdf]{pstricks}
\begin{document}
\begin{figure}
\begin{pspicture}(4,5)
\psframe(0.7,2)(3.3,3)
\rput(2,2.5){First Example}
\end{pspicture}
\end{figure}
\end{document}
11
  • did you run the document with pdflatex -shell-escape? See tug.org/PSTricks/main.cgi?file=pdf/pdfoutput#texworks
    – user2478
    Aug 15, 2012 at 11:39
  • @Herbert yup. I've setup TeXworks for that.
    – nimcap
    Aug 15, 2012 at 11:44
  • 1
    and have you Perl installed? If not then use \usepackage{pstricks}\usepackage[crop=off]{auto-pst-pdf} and tell us what your log file reports.
    – user2478
    Aug 15, 2012 at 11:47
  • I have installed Perl and tried again, did not work. Using \usepackage{pstricks}\usepackage[crop=off]{auto-pst-pdf} worked. Does this mean my TeX distribution is too old?
    – nimcap
    Aug 15, 2012 at 12:06
  • run your original example and post the logfile where error messages appear.
    – user2478
    Aug 15, 2012 at 12:08

2 Answers 2

5

use

\usepackage{pstricks}
\usepackage{auto-pst-pdf}

I'll have a look at the pstricks.sty why it didn't work under Windows. With Linux it is no problem. However, you have to run it with

pdflatex --shell-escape <file>

for TeXnicCenter and others see http://tug.org/PSTricks/main.cgi?file=pdf/pdfoutput#TXC

5
  • Guys, I'm facing the same issue. pstricks doesn't work with pdflatex on windows as it is expected.
    – maksmara
    Feb 13, 2014 at 13:31
  • @nimcap, I have the same "autopp suffix problem". My TeX distribution is ProTeXt-3.1.3-060313
    – maksmara
    Feb 13, 2014 at 14:03
  • I suppose you forgot the -shell-escape. See my edited answer.
    – user2478
    Feb 13, 2014 at 14:09
  • nope, I have tried all possible ways :( how can i post my question? as an answer?
    – maksmara
    Feb 13, 2014 at 14:14
  • @maksmara Follow-up questions are more than welcome! Please use the "Ask Question" link for your new question; there you can link to this question to provide the background. Feb 13, 2014 at 15:02
1

You can also do with the following approach. Compile it with pdflatex -shell-escape main.tex where main.tex is as follows.

% main.tex
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{figure.tex}
\documentclass[pstricks,border=12pt]{standalone}

\begin{document}
\begin{pspicture}(4,5)
\psframe(0.7,2)(3.3,3)
\rput{90}(2,2.5){First Example}
\pscircle[linecolor=red,linewidth=2pt](2,2.5){2}
\end{pspicture}
\end{document}
\end{filecontents*}

\usepackage{pgffor}
\usepackage{graphicx}

\foreach \compiler/\extension in {latex/tex,dvips/dvi,{ps2pdf -dAutoRotatePages=/None}/ps}{\immediate\write18{\compiler\space figure.\extension}}
\begin{document}
\begin{figure}
\centering
\includegraphics{figure}
\caption{This is my figure.}
\end{figure}
\end{document}

enter image description here

Notes

  • -dAutoRotatePages=/None is important here to avoid ps2pdf to automatically rotate the figure. Try it by yourself, remove -dAutoRotatePages=/None.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .