Subject: Re: bug#21832: 11.88.8; prompt for using LuaTeX/XeTeX engine

From: jfbu <[email-masked]>
Date: Thu, 5 Nov 2015 10:15:15 +0100

Hi Mosè

Le 5 nov. 2015 à 00:01, Mosè Giordano <[email-masked]> a écrit :
> 
> fontspec requires two engines, we can't select one of the two for the
> user.  The point is that compilation will certainly fail if one loads
> particular packages, provided that there aren't conditionals.  A
> prompt suggesting you the action to take is better than waiting for
> the compilation to finish and then try to realize what went wrong.

sorry to possibly sound very stubborn: 

one does not have to wait (except perhaps in batchmode, but that's
not interactive) for compilation to finish, as package fontspec
itself very prominently complains if it is run under pdftex rather 
than xetex/luatex.

the compilation halts immediately (in my experience)

ERROR: Fatal fontspec error: "cannot-use-pdftex"

--- TeX said ---
! 
! 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>.
!...............................................  

and I now realize that this alternative MWE:

\documentclass{article}

\usepackage{ifxetex}

\ifxetex
\usepackage{fontspec}
\else
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\fi

\begin{document}
\end{document}

suffices to elicit the prompting. I guess this is what you
meant by detecting conditionals.

When was that behavior introduced ? I had no issues with files
like the above in the past.

> 
>> 
>> Why not rather a file variable at top of file ? Yes, user will
>> have thus to put something explicit there, but isn't it actually
>> better if the file is destined to be exchanged with other people
>> possibly not using Emacs/AUCTeX ?
> 
> We already have a file-local variable to specify the engine to use,
> `TeX-engine', the check is only for those who forget to set it
> properly.

I myself proposed file local variable in the citation above but
should have thought better. File local variable is not so good 
an idea, because ideally a TeX source should not be tied to an engine.

Who knows if 20 years from now there will still be XeTeX ? (at one
point a few years back, support for XeTeX on Mac OS was on the decline
due to issues I don't know nor understand about font libraries, although
initially XeTeX first was developed for Mac OS).

If I want my source to be valid years from now, the best is to
have some comment at top saying: "Compile this preferably with XeTeX"
Only if XeTeX primitives are used making it XeTeX-only would
a file-local variable possibly be justified.

Presence of fontspec by itself only currently reduces to two engines.
It does not reduce to only one engine. I remain of the opinion
that parsing the source for \usepackage{fontspec} and on this
basis issue the prompting is not really an advance in AUCTeX's
ergonomy.

Naturally that's only a personal opinion ;-) But there must be
people who maintain multiple-engine-compatible sources
(in the past, some like me went to some efforts to allow
both latex+dvips and pdflatex, and I still do that almost systematically
now for latex+dvipdfmx viz. pdflatex, using conditionals
to help hyperref, xcolor, etc... get the correct driver if
latex+dvipdfmx road is followed)
and the prompting will be a bit annoying to them...

... TeX-check-engine set to nil appears a necessity then,

To conclude, my personal opinion is this should be the default, with the
documentation mentioning that the user may customize
it instead to t, to get the prompting behavior if it fits his/her bill.

cheers,

Jean-François