[texworks] 'Improved' auto-completion

Herbert Schulz herbs at wideopenwest.com
Sun Aug 25 15:35:39 CEST 2013

On Aug 25, 2013, at 8:20 AM, Joseph Wright <joseph.wright at morningstar2.co.uk> wrote:

> On 17/08/2013 21:43, Herbert Schulz wrote:
>> It is now possible to surround a first argument place holder with two #INS# statements, i.e., #INS#•#INS#, and it will be selected; that allows all arguments to have place holders, •, including the first one. Not only that, you can have a place holder that starts with •‹ and ends with › surrounding a comment so you can add a short memory jogger (note: ‹ and › are NOT < and > but open/close single guillemet quotes). When you jump to a comment the complete comment is selected. Finally, AutoComplete in TeXshop retains indentation for those that like to ``pretty print'' environments. PS: that file MUST be saved in UTF-8 Unicode since it uses non-ascii characters and is read in by TeXShop as UTF-8.
> Looking over the auto-complete files for TeXworks, this would I think be
> a very handy change ported to TeXworks. One of the things that does make
> completion slightly odd is the for example
>  \begin{figure}#RET##INS##RET#\end{figure}•
>  \begin{figure}[#INS#]#RET#•#RET#\end{figure}•
> means the outcome in terms of cursor position depends on the
> atuo-complete choice.


I'm not sure what you mean by this. The first argument always has the insertion point while there is a Mark, i.e., •, for the other arguments. There is a final • at the end of many commands if it would require multiple keystrokes to get to the end; especially true of environments but also true of several commands. You get to each of the • by pressing the Tab key (Shift-Tab to go backwards) in TeXworks.

By the way, the inconsistency with the above is that the first argument doesn't have a (selected) • so that ALL arguments start out with a •. This has been `fixed' in TeXShop by allowing two #INS# commands and everything in between is selected. So, in TeXShop, the first argument is set at #INS#•#INS#.

> Another thing I notice is that the use of #INS#/• is at best
> inconsistent between apparently similar cases. For example, some
> commands have #RET# at the end, others don't, while it would seem
> logical to end environments with #RET#• but that's not what is set up.

I think the ending of an environment by #RET#• vs just • is a matter of taste. The nice thing is that the completion file can be edited for any individual's taste.
> Quite apart from any clever (or not so clever) ideas about making
> completion choices 'context sensitive', I'd love to know what people
> think about these two points. The second one could be cleaned up by a
> non-developer if there is interest, but the first one I guess would need
> some serious programming skills to sort.
> --
> Joseph Wright

Can you give me an example of what is meant by `context sensitive'?

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

More information about the texworks mailing list