[OS X TeX] Exercises

Michael Sharpe msharpe at ucsd.edu
Sat Apr 18 22:45:37 CEST 2009


On Apr 18, 2009, at 12:48 PM, George Gratzer wrote:

> Michael,
>
> What is odd that exercises are numbered with the section number, as  
> 1.1, 1.2, etc. Normally, what is displayed is what is stored. Not in  
> this  case, of Exercise 1.2 \ref only remembers 2.
>
> In Section 4, everything is consecutively numbered: Corollary 4.6,  
> Theorem 4.7, etc., so that they be easily found. A typical section  
> has 30-40 exercises; it would look funny to have them numbered along  
> with everything else.
>
> I do not understand how the Exercises are properly numbered. How do  
> they know the section number? How is it lost with \ref?
>

George,

The way the section number gets into the exercise label is through the  
line

\renewcommand{\labelenumi}{\ifx\exerstar\empty\else*\fi\thesection. 
\theenumi.}

in the definition of the exercises environment. The segment '\ifx 
\exerstar\empty\else*\fi' places a star, if called for, '\thesection'  
places the section number, and '\theenumi' places the value of the  
counter \enumi which keeps track of the number of the item in the  
current enumerate list. The LaTeX code for \label doesn't know about  
what is written to \labelenumi---it just writes the value in \enumi  
(as well as the current page number) to the .aux file.

Best,

Michael



More information about the macostex-archives mailing list