# [OS X TeX] Automatic labeling for references

Peter Pagin peter.pagin at philosophy.su.se
Sat Apr 5 17:03:27 EDT 2008


Alain Schremmer wrote:
>
> On Apr 5, 2008, at 1:02 PM, Peter Pagin wrote:
>
>> I thought a little more about it.
>>
>> Why not define a new counter, \newcounter{labb},
>> and a new command, like
>> \newcommand[1]{\lab}{\label{#1}\stepcounter{labb}}
>
> 1) Without writing anything in the document, I am getting the error
> message
>
> Missing \endcsname inserted.
>        \@ne
> l.82             \newcommand[1]
>             {\lab}{\label{#1}\stepcounter{labb}}
>
> Companion2ed p905 says
>
>     Missing \endcsname inserted
>         This error can arise from using commands as part of the name
> of a counter or environment
>
> So, the error seems to occur as LaTeX is reading the \newcommand but I
> have no idea what the above means.
>
>> Then in the document run \lab{newlabel}\thelabb. Typeset and check
>> the output result of \thelabb. Replace "newlabel" with that result,
>> and delete "\thelabb". One has to make sure to get the value from the
>> end of the document, even the label is put into the middle. So it is
>> sort of quarter-automatic. But if 391 \lab commands have been given,
>> the next gets the label content "392".
>> Maybe of no interest.
>
> I have a feeling that this is what I want but I won't know for sure
> until I can fix the \newcommand,
>
> Hopeful regards
> --schremmer
\newcommand{\laban}[1]{\label{#1}\stepcounter{labb}}

Peter
> ------------------------------------------------------------------------
>
>
> 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/
>
>

--

-----------------------------------------------------
Professor
Department of Philosophy, Stockholm University
106 91 Stockholm, Sweden
tel: +46-8-162813, fax: +46-8-152226
email: peter.pagin at philosophy.su.se
http://people.su.se/~ppagin/pagineng.htm