[OS X TeX] Automatic labeling for references

Matthew Leingang leingang at math.harvard.edu
Tue Apr 8 06:45:57 EDT 2008


On Apr 7, 2008, at 7:53 PM, Alain Schremmer wrote:
>
> On Apr 7, 2008, at 9:07 AM, Matthew Leingang wrote:
>>
>>>> Alain Schremmer wrote:
>>> But I have no idea about how to get "total number of sections  
>>> before the current chapter" other than by hand.
>>
>> Well, maybe you could extend the addtocontents macro to count for  
>> you.
>
> I checked in Companion 2ed page 46 ±1 and addtocontents is to add  
> items to toc so I don't understand this.

Sorry, I was being lazy and named the wrong macro.  If you look  
inside the aux file for your book, you'll notice it includes the aux  
files for your chapters.  Inside the a chapter's aux file, you might  
find statements like

\@writefile{toc}{\contentsline {chapter}{\numberline {6}The Axioms of  
Probability}{6-1}{chapter.6}}

This writes TOC information to the .toc file regardless of whether  
the file is included or not.  I was saying if you wanted to  
automatically increment your "total number of labels" command you  
could alter that macro to do that.

An alternative would be to augment the commands in the TOC file such as

\contentsline {chapter}{\numberline {6}The Axioms of Probability}{6-1} 
{chapter.6}

>>   If you're using \include on each of your chapter files and  
>> includeonly to specify which
>
> I don't do that. I use:
> —a "book" rootfile in which are all the \includes,
> —one "chapter" root file for each chapter with an \addtocounter 
> {chapter}{total number of chapters before the current chapter} just  
> before the \include for the single corresponding chapter with  
> "total number of chapters before the current chapter" entered by hand.

So why aren't you using includeonly?

> Is there a way to read that from the aux file? That would be really  
> nice but I don't have a clue.

Like I was saying, given the fact that the aux files produce a  
complete TOC without including the complete document, yes, I think  
that's possible.

--Matt

--
Matthew Leingang
Preceptor in Mathematics
Harvard University

http://www.math.harvard.edu/~leingang/vCard.vcf






More information about the MacOSX-TeX mailing list