[texworks] %!TEX root =

Alain Delmotte esperanto at swing.be
Sat Jan 3 14:19:30 CET 2009

Joseph Wright a écrit :
> Jonathan Kew wrote:
>> What if you have conflicting "program = ..." specifications in the
>> current file (sub-document) and the root document; which should be used
>> then?
>> The way "program = ..." is handled in TeXworks is slightly different
>> from TeXShop, if you're familiar with its behavior. In TS, any "program
>> = ..." specification *overrides* the engine that's selected in the
>> toolbar popup, so Cmd-T always uses what the file specifies. In TW, on
>> the other hand, the "program = ..." specification initializes the popup
>> to the chosen setting when the file is opened (or when the specification
>> is edited), but if the user then changes it manually, the new choice
>> will be respected.
>> This means that when you press Cmd-T (Ctrl-T), TeXworks relies on the
>> toolbar popup to tell it what to do; it doesn't inspect the "program =
>> ..." line at this time. And so the engine you get is the one that's
>> selected in the window where you press Cmd-T.
>> I'm not sure if there's any approach to this that's clearly "best",
>> within the model where you can have a number of files that may have
>> differing metadata, and you also have a user interface where you may
>> specify something different yet again. A full "TeX Project" model, where
>> all the component files "belong" to a project, and metadata like this is
>> carried at the project level rather than added to individual files,
>> would make things clearer. This may be an option in the future, but I
>> don't want to make it a requirement for using the program or for being
>> able to include the engine choice in the source.
> Thanks for the detailed explanation.  I see that the TeXworks model does
> make this a little complicated.
> One thing to bear in mind is that you get whatever the *current window*
> has in the drop-down, even if the master file is already open. I'd
> (naively) imagined that the flow was:
> - Open or "switch" to main file (switch logically, not necessarily
> graphically);
> - Typeset;
> - "Switch" back to current window.
> As you'll see, I'd imagined that if I'd already got the main file open
> the preference there would "win".
> My suggestion would be that nothing changes from a code point of view
> (it is perfectly logical as it is), but that the behaviour is
> documented.  Essentially this means saying something like:
> If you specify a main file using
> % !TEX root = <file>
> you should also include a
> % !TEX program = <program>
> line in each sub-file. This will ensure that your preference will be
> followed irrespective of the active window when you typeset.
OK noted for more detailed inclusion in the manual!!


More information about the texworks mailing list