[OS X TeX] Automatic labeling for references

Alain Schremmer schremmer.alain at gmail.com
Sat Apr 5 18:00:00 EDT 2008


On Apr 5, 2008, at 5:03 PM, Peter Pagin wrote:
>
>
> 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.
>> <to be read again>
>>        \@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
> Sorry about that. I had misplaced the '[1]'. It should be
> \newcommand{\laban}[1]{\label{#1}\stepcounter{labb}}

No worry. I caught it … after Schulz put my nose on it.

Grateful regards
--schremmer


More information about the MacOSX-TeX mailing list