bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Mosè Giordano
Subject: bug#21832: 11.88.8; prompt for using LuaTeX/XeTeX engine
Date: Thu, 5 Nov 2015 10:38:59 +0100

Hi Jean-François,

2015-11-05 10:15 GMT+01:00 jfbu <address@hidden>:
> Hi Mosè
>
> Le 5 nov. 2015 à 00:01, Mosè Giordano <address@hidden> 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>.
> !...............................................

Ok, but you have to run compilation, wait that second to finish, read
the log and add the `TeX-engine' variable (and if you insert the
variable by hand you have also to revert the buffer in order for the
change to take effect).  The prompt skips directly to the setting of
`TeX-engine'.

> 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.

Yes.

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

Around three months ago.

>>
>>>
>>> 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.

How do you propose to tell AUCTeX which compiler/engine to run?  It
doesn't have a mind-reading system, yet ;-)  It's not to tie a
document to an engine, it's about how to tell your editor what to do.
Local variables aren't carved into the rock, you can change them.

> 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...

These conditionals often go into a package, in a hand-written style
file we can do something like

    (if (member TeX-engine '(xetex luatex))
        (TeX-run-style-hooks "fontspec"))

so that there won't be any problem for the user.

> ... 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.

AUCTeX's parser is known to fail when there are conditionals, you just
discovered one of such cases.  I'd like to keep this feature on by
default to receive more feedback (if it's off by default not many
people would try it), if more complaints will come I can think about
changing the default behavior.

Bye,
Mosè





reply via email to

[Prev in Thread] Current Thread [Next in Thread]