# [texworks] SCRIPT: Insert a new \label{key} - checks for potential duplicate conflict

Tyler Estler w.t.estler at gmail.com
Fri May 21 15:01:17 CEST 2010

Dear All,

I am migrating from WinEdt to TexWorks, which I really like for its
simplicity.

I am looking for some kind of tutorial introduction to the use of scripts
such as the one described here. I have done a reasonable amount of LaTeX
writing, but I am a novice when it comes to scripts etc.

Could someone provide a simple step-by-step guide to the use of scripts,
hooks, etc?

Thanks for any help, and also for your efforts to expand the functionality
of TexWorks.

Tyler Estler

On Fri, May 21, 2010 at 5:01 AM, Paul A Norman <paul.a.norman at gmail.com>wrote:

> Hi,
>
> Insert a new \label{key}
>
>
> If text is selected first in the Tw editor, the script endeavours to
> use this as the key to make a new \label{key}
>
> Checks through the current document, and offers a drop-down box with
> either a blank area to type in, or if the user has selected some text,
> that as the proposed label key. The drop-down shows any already
> existing label keys in the document.
>
> If the user Ok-s the drop-down box, the script then checks through
> existing labels to avoid reproducing the same key.
>
> If the key has already been used in another \label{key} statement, the
> user is shown the pre-existing key, and asked to try making a new
> label up again. The same checks are performed recursively until either
> a unique key is made, or the user cancels.
>
> Successful use, inserts \label{usersKey}
>
> (Companion script to insertCrossRef.js)
>
> Paul
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20100521/7b6ba5dd/attachment.html>