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

Herbert Schulz herbs at wideopenwest.com
Tue Jun 14 02:46:04 CEST 2011

On Jun 13, 2011, at 7:38 PM, Paul A Norman wrote:

> Hi,
> At a pinch I wouldn't mind even a drop down type widget with checkable
> boxes that lets me choose which completion scenarios to use.
> Else as I wrote earlier how does Tw know I'm working directly on a
> bibliography file etc etc?
> That's pretty well much Typesetting Engine independent as are some other things.
> Paul
> On 14 June 2011 10:40, Philip TAYLOR (Webmaster, Ret'd)
> <P.Taylor at rhul.ac.uk> wrote:
>> Reinhard Kotucha wrote:
>>> Even if you specify a particular engine, it's still not clear which
>>> type of file you want to process.  Suppose you select "plain TeX" but
>>> the file contains the line "\input texinfo.tex".  After loading this
>>> file, the escape character is "@" instead of "\".  This breaks command
>>> completion and syntax highlighting and it's extremely difficult for an
>>> editor to find out what to do.
>>> The problem you reported is a good example.  Plain TeX can more or
>>> less considered as a programming language, whereas LaTeX is supposed
>>> to be a markup language, i.e. a file format.  One would expect then
>>> that it's easier to support command completion and syntax highlighting
>>> in LaTeX.  This is definitely true, but Beamer re-defines standard
>>> LaTeX list environments.  Hence, if you want to provide proper command
>>> completion and syntax highlighting, you have to evaluate the whole
>>> file.
>> Yes, I agree that no matter which engine you select, you /may/
>> have a pathological file that does not follow the normal markup
>> pattern for that engine, so in an ideal world you could then
>> switch auto-completion on the fly.  But a default behaviour that
>> uses the engine to determine which set of auto-completes is
>> most likely to be relevant is surely not an unreasonable
>> behaviour, is it ?
>> ** Phil.


The command-completion file would have to be related to the extension of the file being edited and also the default engine being used to compile that file via the

% !TEX program = xxxxx

line. The other way to do it would simply be to have another ``magic line'' that defined which command completion file to use; that would probably be the easiest thing to do. E.g.,

% !TEX commandcompletion = xxxxx

with xxxxx being latex, etc. I'd suggest that the default commandcompletion (i.e., when no line is given) is latex only because that is the most common use.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

More information about the texworks mailing list