I am struggling setting up AUCTeX preview in a way that I can use it with XeLaTeX documents. When I try to generate the previews I get the following error
cannot-use-pdftex
generated by the fontspec package. So I guess I have to force the use of XeLaTeX even when generating previews, but I didn't find anything suitable on the net.
Here is a MWE:
\documentclass[b5paper,BCOR=8mm,DIV=calc,11pt]{scrbook}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{url}
\newcommand{\nacr}{\newacronym}
\title{Some title}
\author{}
\date{\today}
\begin{document}
\maketitle
\begin{equation}
\theta=asdf_{bsdf}
\end{equation}
\end{document}
and here is the full result:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
!
! The fontspec package requires either XeTeX or LuaTeX to function.
!
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! instead of plain "latex" or "pdflatex".
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
...
Preview-LaTeX exited as expected with code 1 at Sun Apr 01 09:30:59
LaTeX: LaTeX found no preview images
Setting local variables didn't help.
If I remove:
\usepackage{fontspec}
\usepackage{xunicode}
The error is gone.
In consequence, I guess I need a way to force auctex to compile previews with xelatex.
Any ideas or existing setups?
Some additional information: AUCTeX 11.86 and gs 9.0 on debian wheezy as well as AUCTeX 11.86 on windows 7.
preview of circ.tex works fine
preview, you need a.dvifile. LuaLaTeX can generate these, XeLaTeX cannot. (No idea on how to force the use ofdvilualatex, I'm afraid.) – Joseph Wright♦ Apr 1 '12 at 8:20xelatex -no-pdf, but this generates an extendeddviwhich can only be converted into a pdf withxdvipdfmx– Herbert Apr 1 '12 at 8:31