[OS X TeX] Automatic labeling for references

Alain Schremmer schremmer.alain at gmail.com
Mon Apr 7 19:53:28 EDT 2008

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.
>   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.

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

> , then the aux files are read anyway and that's where the  
> addtocontents macros are.  But you're already incrementing the  
> counter with \section, so you'd have to make sure you didn't do it  
> twice...
> Several philosophical arguments have been made against this  
> approach, and I don't want to pile on.  But it seems like you're  
> going to a lot of trouble to effectively *remove* functionality  
> from LaTeX.  Automatically generated labels are *less* useful then  
> labels with human names.  Having \section create a label called  
> "4.11" that expands to "4.11" is no better than simply looking in  
> the table of contents and typing "4.11".  Either way, if you change  
> the document organization, you have to change the labels.  Having  
> \section create a label called "392" that expands to "4.11" is  
> worse, because I don't see where you check the number of the label  
> to refer to it (it's neither in the source nor the final).

That's where the package showkeys comes in and, for me, having each  
section automatically have its own label would make it a lot easier  
as these are all the references that I am using.  (for now?)

> Maybe you're tired of creating your own labels because you're using  
> more than you need.

Because of the kind of student I write for, I never know up front  
what reference I will need, only from their reactions. So having  
readymade labels is going to be nice.

> I only make a label at the moment I realize I need to refer to it.

The other thing is that I don't want to give too pointed a reference  
to force the students to read. And since the sections are one-subject- 
only, and I am using titleref, things ought to remain under control.

> I agree with your point that it's hard to decide on a label  
> "style" (capitalization, word breaks, etc.), but (assuming you're a  
> solo author) you've only yourself to blame for that.

Well, if you want to, you can be joint author. (And I found a bug in  


More information about the MacOSX-TeX mailing list