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.
\input{head/settings_thesis_template.tex}
\begin{document}
\include{main/optical_exp}
\end{document}
and settings_thesis_template.tex looks like this:
\documentclass[a4paper,11pt,fleqn]{book}
\usepackage{etex}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french,german,english]{babel}
\usepackage{fourier}
\usepackage{setspace} % increase interline spacing slightly
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{bm}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{mdwlist}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{lipsum}
\usepackage{microtype}
\usepackage{url}
\usepackage[final]{pdfpages}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary[topaths]
\usetikzlibrary{positioning,calc,arrows}
\usepackage[explicit]{titlesec}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{auto-pst-pdf}
\usepackage{pst-optexp}
\usepackage{pstricks-add}
\usepackage{pst-pdf}
and the image contained in optical_exp.tex is this:
\begin{pspicture}(-1.5,-1.5)(1.5,1.5)
\pnode(-1,0){in}
\pnode(0,0){mir}
\pnode(1,0){out}
\pnode(-1,-1){low}
\pnode(-1,1){high}
\mirror(low)(mir)(high)
\drawbeam[linecolor=red,arrows=->](in){1}(in)
\end{pspicture}
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!
inputenc
withxetex
it is natively utf8 (but then you should usefontspec
rather thanfontenc
to use a matching Unicode font encoding.auto-pst-pdf
afterpstricks
. Perhaps also, you shouldn't load bothpst-pdf
andauto-pst-pdf
?pdfcrop
to run?("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.