[OS X TeX] Automatic labeling for references

Alain Schremmer schremmer.alain at gmail.com
Sat Apr 5 17:13:26 EDT 2008

On Apr 5, 2008, at 5:01 PM, Herbert Schulz wrote:
> On Apr 5, 2008, at 3:42 PM, 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
> \newcommand{\commandname}[#params][optional parameter default value  
> (if you want it)]{command text}
> you left out the command name.

Not quite: {\commandname} was misplaced after [#params] but I only  
realized it after I read your post. (Why couldn't I see it? Sigh.)

Now I have to make it work.

Grateful regards

More information about the MacOSX-TeX mailing list