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!
inputencwithxetexit is natively utf8 (but then you should usefontspecrather thanfontencto use a matching Unicode font encoding. – David Carlisle Feb 17 '15 at 20:37auto-pst-pdfafterpstricks. Perhaps also, you shouldn't load bothpst-pdfandauto-pst-pdf? – Bernard Feb 17 '15 at 21:03pdfcropto run? – Christoph Feb 18 '15 at 08:48("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. – drasticbutfine Feb 18 '15 at 09:13pdfpagespackage when it is loaded. No, I mean does the log say anything about if it succeeded to generate the external image (in your MWE, with pdflatex)? When it fails you should find something like "Package auto-pst-pdf Warning: Could not create file ...-pics.pdf". Please runpdfcropwithout any argument on the command line to see if it works... And note, that xelatex probably doesn't work with pst-optexp, see http://tex.stackexchange.com/a/219781/33933. I never tested pst-optexp to work with XeLaTeX. – Christoph Feb 18 '15 at 09:20Package auto-pst-pdf Warning: Creation of mwe-thesis-pics.pdf failed. Package auto-pst-pdf Warning: Could not create mwe-thesis-pics.pdf. Auxiliary files not deleted.pdfcrop first was "not found", so I installed ActivePerl (running windows). Now the pdfcrop gives
– drasticbutfine Feb 18 '15 at 10:01Can't use an undefined value as an ARRAY referenceerror... I guess I need to set some variables or paths somewhere?PATHenvironment variable. – Christoph Feb 18 '15 at 12:02