[texworks] Unwanted side-effect of <tab> : how to avoid ?

Stefan Löffler st.loeffler at gmail.com
Mon Jun 13 15:30:39 CEST 2011


On 2011-06-12 22:07, Philip TAYLOR (Webmaster, Ret'd) wrote:
> This seems very odd : would it not make sense for TeXworks
> to inspect the currently selected typesetting engine, and
> then /if/ the user wants auto-completion, to offer completions
> only from the set that are known to be compatible with the
> engine selected ?  In my case, I work exclusively with XeTeX,
> so neither Beamer nor LaTeX completions could possibly be of
> any interest.

unfortunately, the situation is more difficult, because there is no
direct connection between the engine and the syntax.
First of all, you can use different engines on a single document (think,
e.g., latex, bibtex, makeindex, ...).
And secondly, an engine may be arbitrarily complex (e.g., a
shell/batch/perl/etc. script that invokes other commands) and does not
necessarily work only for a single type of sources.

Other things might come to mind. You could inspect the document
preamble, e.g., to look for the beamer class and activate the
corresponding auto-completion only if it is found. But this again
doesn't cover the case that some company, journal, university, or other
build their own classes on top of beamer - in which case the
autocompletion would be valid although "beamer" is never mentioned in
the file. In addition, what do you do in a sub-document (which uses the
"%!TeX root" syntax)? There, you have no preamble at all to look for.

All in all, TeX & Co. are very complex languages, and safe of building a
*TeX parser into Tw, there's no reliable way of guessing what the user
wants. In fact, I see just one way: asking the user. This is definitely
on my todo list, but in a larger scope - and before I can start that, we
need to get Tw ready for TL'11 and I'll need to discuss this in-depth
with Jonathan.


More information about the texworks mailing list