38

I have a problem with this file tex:

\begin{document}
\begin{figure}
\begin{center}
\begin{pspicture}(0,0)(1,3.8)
\psline{-<}(0,0)(0,.2)
\psline{-}(0,.2)(0,.4)
\psline{*->}(0,.4)(0,.9)
\psline{-*}(0,.9)(0,1.4)
\psline{-<}(0,1.4)(0,2.4)
\psline{-}(0,2.4)(0,3.4)
\psline{*-}(0,3.4)(0,3.6)
\psline{>-}(0,3.6)(0,3.8)
\rput(1,.4){$y=0$}%testo
\rput(1,1.4){$y=1$}
\rput(1,3.4){$y=3$}
\end{pspicture}
\end{center}
\caption{}
\end{figure}
\end{document}

but I don't understand where is the error.

Lorenzo
  • 381

2 Answers2

45

It was the typical error message when using pdflatex with PSTricks. With an up-to-date version you'll get an error message which explains what's the problem.

Run the document with xelatex or use the sequence latex->dvips->ps2pdf (which is often only one click in a GUI). See also FDE no 4 (Frequently Done Error) at http://PSTricks.tug.org

  • This worked for me. Wish I could get the tick beneath the answer :-P but only if it works for the asker! – Karthik C Oct 02 '13 at 04:59
  • Just click the grey tick mark beneath the score on the answer you want to accept. The tick mark will turn green. That means the answer is accepted and everyone will know that the problem has been solved. – Karthik C Oct 03 '13 at 06:30
15

There is another solution : you can use pdfLaTeX with pstricks, provided pdflatex is launched with one of these switches: --enable-write18 (MiKTeX) or --shell-escape (TeXLive, MacTeX), and you load the auto-pst-pdf package after pstricks.

Note that if you try to load xcolor with an option, there is an option clash for package 'xcolor' error message because pstricks already loads xcolor (without option). A work-around consists in adding the xcolor option to the document class options, or writing PassOptionsToPackage{option}{xcolor}.

As an example you may begin your document with something like:

\usepackage[11pt, a4paper, twoside, x11names, table]{article}

\usepackage{pst-plot}
\usepackage{auto-pst-pdf}
Sebastiano
  • 54,118
Bernard
  • 271,350