[OS X TeX] New TeXShop macro: "Insert reference"

Josep M.Font pepf54 at tiscali.es
Mon Aug 23 12:51:35 EDT 2004

El 21 ago 2004, a las 8:03, Will Robertson escribió:

>> - Before the list of real labels the script also presented as such 
>> some lines of code from my preamble, like "\usepackage{pdfsync" and 
>> "\def\quotedfrom ... [long]". ???
> Hmmm. That's strange. I split my preambles out into .sty files, 
> usually, so my (brief) tests wouldn't have picked up anything like 
> this. Let's see.
> The first thing the script does is find every line with the text 
> "\label" in it. Do you have this anywhere in your preamble?
> Can you go to the Terminal and tell me the output of:
>    grep -h '\\label' document.tex
> (Changing document.tex to the appropriate file path)

It has displayed an incredible number of lines of my document (it is a 
whole book). But not complete, altering sometimes the order of the 
lines, etc. It is nonsense for me.

I used the latest version of the script. It consistently keeps finding 
these two non-labels as such. Both are before the first occurrence of 
\label in the file, by the way.

Then I tried other files. To my surprise, in some of them it only found 
the *last* of the many \label commands. The only peculiarity I cazn 
think of in these files is that they are old Textures files, saved with 
Mac line endings and MacRoman text code (I suppose). In still other 
files, it works correctly. Sorry for giving troubles to you.

>> - When you highlight some text and then select the script (great 
>> idea!), if it does not find any label containing the highlighted 
>> text, then all what one gets is an "AppleScript Runner" error telling 
>> you that TeXShop encountered a type 1 error. I hope there is a way of 
>> poping up the proper message.
> I didn't check that, oops!
> I see what you mean - I've put some error catching code in, but it 
> isn't very efficient coz Applescript seems to be a bit weird today 
> (?). I don't think its too slow, though.

I would have preferred to see a message saying "No labels match your 
request" or the like... in its present behaviour one can think simply 
that it does not work as expected!

> Thanks for the feedback!

You scripts deserve it! Let me take the opportunity to let you know 
that I would reverse the default in two of the features:

property only_scan_current_file : true by default. I would advertise 
the other possbility as an aditional feature for special situations 
(\include, etc.) and only for very well organized people who do not put 
lots of docs in the same folder...

property sort_output : false by default. The alphabetical order may not 
always be meaningful, it depends a lot on your labelling schemes... On 
the other hand, the order in which the labels appear in the source is 
alamost always meaningful, as it matches the places they are 
labelling... Again, I would describe the alphabetical possibility as an 
additional one for very well organized people...

Hope all this helps.


--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list