# [OS X TeX] Automatic labeling for references

George Gratzer gratzer at mac.com
Sat Apr 5 01:04:47 EDT 2008

Could you not just simply define a command to do this?

GG

On 4-Apr-08, at 9:18 PM, Jan Anderssen wrote:
> Hello.
>
>>> But then you've still got to get the \ref commands right so you
>>> need to know what the labels are. Or do I have this wrong?
>>
>> I assume you mean that before I can write "We already saw in
>> \titleref{314} that …" in the source, I have to know that 314 is
>> the label of the section I want to reference. Well, I could look up
>> the section in the toc and then the label number at the given page
>> number. In fact, why coulnd't the label be the chapter number
>> followed by some symbol and then by the section number? Then I
>> would just have to look up the toc!
>>
>> The reason I would like this to be automatic is that last year I
>> gave up on references altogether because I got completely confused
>> even though someone on this list had written a macro that would
>> generate random label numbers. This way, it would be just a matter
>> of looking up an already existing label.
>
> I often change the order of things around as I go along (sometimes
> quite dramatically), so what was section 2.3 might become section
> 2.7 etc. So you (I?) would either need to live with a mismatch of
> label and actual section number then (making it kind of arbitrary),
> or change the label and all depending \ref's all the time, which
> seems quite tedious and error-prone unless automated.
>
> What I imagine could be more feasible is to create a label that
> looks more like \label{sec:SomeWordsFromSectionTitle}. I usually do
> that manually, but I imagine it might be automated - probably
> through some sort of autocompletion mechanism, or applescript that
> grabs hold of an immediately preceding \section{}, rather than in
> (La)TeX.
>
> Since I don't use TexShop myself, and are rather a novice at
> AppleScript, maybe other people could be more helpful with the
> specifics.
>
> Cheers,
> Jan
>
>
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://www.esm.psu.edu/mac-tex/list/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
> List Archive: http://tug.org/pipermail/macostex-archives/
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>