I've been trying to get the pst-optexp package working with the thesis template I have, and it's been a nightmare.

I'm using MikTeX with pdflatex compilation, as as previously mentioned in How to use PSTricks in pdfLaTeX? I have set the -enable-write18 flag.



and settings_thesis_template.tex looks like this:

\usepackage{setspace} % increase interline spacing slightly



and the image contained in optical_exp.tex is this:


In the end, I get 1) the thesis file pdf, and 2) a blank, automatically generated pdf that is supposed to contain the image in "optical_exp-tex".

Interestingly, XeTex is able to compile this MWE. However, when I try to compile my more-complicated thesis template with XeTeX I get a bunch of unicode errors like the following:

Unicode char \u8:èse not set up for use with LaTeX
Unicode char \u8:éle not set up for use with LaTeX.

My file encoding is indeed UTF-8 and I have included the packages related to this error as you can see in my "settings" file. (Thanks to the thread inputenc Error: Unicode char \u8: not set up for use with LaTeX). It's probably the french text I have in the document, though I don't understand why I get this error despite having the "work-around" packages.

So the question is: 1)why does pdflatex not work with my MWE, and 2) why does XeTex give me UTF-8 encoding errors?

Any insight into these problems would be very welcome!

  • the unicode errors are because you should not use inputenc with xetex it is natively utf8 (but then you should use fontspec rather than fontenc to use a matching Unicode font encoding. Commented Feb 17, 2015 at 20:37
  • I would load auto-pst-pdf after pstricks. Perhaps also, you shouldn't load both pst-pdf and auto-pst-pdf?
    – Bernard
    Commented Feb 17, 2015 at 21:03
  • @DavidCarlisle thanks, I replaced inputenc & fontenc with fontspec and now it runs. Unfortunately the thesis formatting got messed up. pdflatex respects the formatting, but does not generate the image even with Bernard's suggestions. Quite weird. Compiling with pdflatex, I changed the order of pstricks-add and auto-pst-pdf but to no avail. I also removed pst-pdf which did not seem to change anything. Commented Feb 18, 2015 at 8:05
  • Does the log file say anything about the external compilation of the images? Do you e.g. have a Perl interpreter which is required for pdfcrop to run?
    – Christoph
    Commented Feb 18, 2015 at 8:48
  • There is this snippet: ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdfpages\pdfpages.sty" Package: pdfpages 2013/08/25 v0.4v Insert pages of external PDF documents (AM). I'm also curious as to why the pdf image is not generated correctly. Commented Feb 18, 2015 at 9:13

1 Answer 1


I read the documentation at PSTricks website on tug.org, and apparently using tikz and pstricks together is a common mistake. The author offers a workaround like this, for using pst-plot with tikz.

For my particular example, I had to add


right after the \documentclass in the preamble, and remove the other \usepackage{tikz}.

You must log in to answer this question.

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