3

I've been trying to get pstricks to work but to no avail. I am using Miktex, and I downloaded the package from it packages manager. But when I try to build it, it always fails:

This is XeTeX, Version 3.1415926-2.2-0.9995.1 (MiKTeX 2.8)
entering extended mode
(C:\xxxx\Desktop\untitled-6.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman, ngerman, german-x-2009-06-19, ngerman-x-2009-06-19, french, portuguese, l
oaded.
("C:\Program Files\MiKTeX 2.8\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.8\tex\latex\base\size10.clo"))
("C:\Program Files\MiKTeX 2.8\tex\latex\oberdiek\epstopdf.sty"
("C:\Program Files\MiKTeX 2.8\tex\latex\oberdiek\epstopdf-base.sty"
("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\infwarerr.sty")
("C:\Program Files\MiKTeX 2.8\tex\latex\oberdiek\grfext.sty")
("C:\Program Files\MiKTeX 2.8\tex\latex\oberdiek\kvoptions.sty"
("C:\Program Files\MiKTeX 2.8\tex\latex\graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\kvsetkeys.sty"
("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\etexcmds.sty")))
("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\pdftexcmds.sty"
("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\ifluatex.sty")
("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\ltxcmds.sty"))

Package epstopdf Warning: No graphics package `graphic{s,x}' loaded.

)) ("C:\Program Files\MiKTeX 2.8\tex\latex\graphics\graphics.sty"
("C:\Program Files\MiKTeX 2.8\tex\latex\graphics\trig.sty")
("C:\Program Files\MiKTeX 2.8\tex\latex\00miktex\graphics.cfg")
("C:\Program Files\MiKTeX 2.8\tex\xelatex\xetex-def\xetex.def"))
("C:\Program Files\MiKTeX 2.8\tex\latex\pstricks\pstricks.sty"
("C:\Program Files\MiKTeX 2.8\tex\generic\pstricks\pstricks.tex"
`PSTricks' v1.29  <2009/05/19> (tvz)

======================================================================
starting package maintenance...
installation directory: "C:\Program Files\MiKTeX 2.8"
package repository: http://ftp.eq.uc.pt/software/TeX/systems/win32/miktex/tm/packages/
lightweight database digest: ecef59fd2592919972b79117b8fcd1c8
going to download 1520 bytes
going to install 4 file(s) (1 package(s))
downloading http://ftp.eq.uc.pt/software/TeX/systems/win32/miktex/tm/packages/xetex-pstricks.tar.lzma...
1520 bytes, 8.84 KB/Sec
extracting files from xetex-pstricks.tar.lzma...
miktex-xetex.exe: Windows API error 87: The parameter is incorrect.

miktex-xetex.exe: Data: C:\ProgramData\MiKTeX\2.8\miktex\config\1567d83d412396067c84a669e65114a0.fndb
======================================================================
("C:\Program Files\MiKTeX 2.8\tex\generic\pstricks\pstricks.con"))
("C:\Program Files\MiKTeX 2.8\tex\latex\xcolor\xcolor.sty"
("C:\Program Files\MiKTeX 2.8\tex\latex\00miktex\color.cfg")))
(C:\xxxx\Desktop\untitled-6.aux)
! Undefined control sequence.
<recently read> \c@lor@to@ps 

l.8 \psframe(0.7,2)(3.3,3)

? 

Anything special I have to do?

Thanks edit:

Here is the code:

\documentclass{article}
\usepackage{epstopdf}
\usepackage{graphics}
\usepackage{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}
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
  • Do you have to rebuild the tex database in Miktex? If so, there should be an option to do so. It could be called "texhash" or "rebuild tree" or similar. Just guessing. – Alok Singhal Jan 21 '10 at 05:59
  • there is a xetex-pstricks package http://tug.ctan.org/tex-archive/graphics/xetex-pstricks/ though if you're going to go to PDF, why not use tikz/pgf? – Mica Jan 21 '10 at 16:19
  • pstricks _comes with_ the MikTeX distribution you are using .. you shouldn't have to install anything – bobobobo Feb 16 '10 at 18:13

2 Answers2

1

I can't see from the partial log results, but it looks like pstricks is loading OK since it's got that far: you can look further up the results to check and it'll list the pstricks package it's used. There are two problems I can see. First, you need a

\usepackage{graphics}

Second, you need to choose DVI from the drop down menu I can see in TeXworks. It should say something like LaTex + DVI + PDF. You can use pdflatex with pstricks (see e.g. http://www.coli.uni-saarland.de/~fouvry/how-do-I.html), but dvi is easier. If you go the pdflatex route, a first step is:

\usepackage{epstopdf}

Omitting this package is what is causing the error we see above, but the will be other errors after that is fixed (see the website above). As a minor aside, it was good to see the picture, since it obviously was necessary for the above comments, but additionally having the code copy and pasted as text would've been useful for me to copy and try (yes I am a bit lazy).

Ramashalanka
  • 8,564
  • 1
  • 35
  • 46
  • Thanks for the answer. I had heard about the incompatibilities between pstricks and pdflatex. I've read what is in the link you provided but I don't understand very well what I'm supposed to do. What does he mean with the first point "and then run it through latex, dvips, ps2pdf and pdflatex."? Do I have to do it by hand? I'd like to have it like it is right now, where I just click once and it compiles everything and shows me the pdf. – devoured elysium Jan 21 '10 at 09:17
  • 1
    Do you have to use pdflatex? If not, just use the TeXworks drop down menu (top left, just under the menu bar) to choose DVI+pdf and it will make a pdf with one click as you want. – Ramashalanka Jan 21 '10 at 09:22
  • I don't have any DVI+pdf option in the drop down menu. :( . Do I have to install something first, then? – devoured elysium Jan 21 '10 at 09:25
  • In the original post I have now a picture of what my current options are. I post it here anyway: http://img121.imageshack.us/img121/1049/lsrgr3lhdhg1b4h5qbeajts.png – devoured elysium Jan 21 '10 at 09:26
  • 1
    OK, then use XeLaTeX. It works on my TeXworks (though on a mac). – Ramashalanka Jan 21 '10 at 09:40
  • Doesn't seem to work on mine, though. I posted up there the total error code, if it helps at all. – devoured elysium Jan 21 '10 at 09:51
  • 1
    Thanks for the error output, looks like you do have a pstricks loading problem after all. OK, I don't have windows handy, but try again without MikTeX open in the background (from this link (scroll down to the end): http://old.nabble.com/Problem-Updating-(Windows-API-error-87)-td24971196.html). As an aside, you don't need epstopdf or graphics for your example with XeLaTeX. – Ramashalanka Jan 21 '10 at 10:13
  • Ah, you were right. Reinstalled the packages with everything closed and then used XeLaTeX and it seems to work! Thanks! – devoured elysium Jan 21 '10 at 16:12
0

Its PSTricks, not PDFTricks.

I solved this by converting to PS first, then to PDF afterwards. In TeXNic Center there's an option for that, in the drop down box at the top, looks like LaTeX => PS => PDF

In TeXlipse you can set it up by Right clicking your project, then picking "latex.exe + dvips.exe + ps2pdf.exe" as your Build Commands.

bobobobo
  • 64,917
  • 62
  • 258
  • 363