[texworks] 'Improved' auto-completion

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Aug 26 19:30:53 CEST 2013


On 25/08/2013 14:35, Herbert Schulz wrote:
> 
> 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.
>>
> 
> Howdy,
> 
> 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.

I was thinking that in for example

  \begin{figure}[#INS#]#RET#•#RET#\end{figure}•

you end up with the cursor on the same line as you started but

    \begin{figure}#RET##INS##RET#\end{figure}•

leaves the cursor on a different line. On the other hand, it's probably
more convenient to have the cursor at the position of the first 'fill
in' point rather than having in some cases to go backward as well as
forward.

Having thought about it some more, the current behaviour is almost
certainly the best default.

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

Yes, the TeXShop plan does sound sensible :-)

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

The reason I mentioned this is that it's common to lay out input in the form

  Content
  \begin{foo}
    Content of foo
  \end{foo}
  more content

i.e. with the \begin/\end statements on lines of their own. Of course,
not everyone does this.

I guess I'll just fiddle about with my own autocomplete files :-)
-- 
Joseph Wright


More information about the texworks mailing list