[OS X TeX] Exercises
Michael Sharpe
msharpe at ucsd.edu
Sat Apr 18 15:22:39 EDT 2009
George,
I believe that what you are seeing here is the normal behavior of
\label for an item in an enumeration---it stores the current value of
the counter \enumi and the current page number in the .aux, but not
the section number. Here are a couple of suggestions you might
investigate.
1. You can add the page number to the reference, with something like
\newcommand{\exerref}[1]{Exercise \ref{#1} (p.\pageref{#1})}
then write, for example
\item Let the binary relation $ < $ satisfy the conditions of
\exerref{Exer:I.1.1}.\label{Exer:I.1.2}
2. I prefer to do exercise numbering as part of the equation
enumeration, along with theorems, lemmas, propositions, remarks,
definitions, so that everything I want numbered gets a unique
sequential id, and \label stores the entire id. That may not be to
everyone's taste, but I really dislike separate numbering sequences,
which makes it difficult to find, say, Theorem 2.3, when it comes
after Proposition 2.245.
By the way, \subsubsection*{Orders} should not be within the
exercises---it will be ignored.
Best,
Michael
On Apr 18, 2009, at 10:07 AM, George Gratzer wrote:
> Michael,
>
> More trouble in paradise...
>
> I am now using your exercises environment, it displays with
> perfection.
>
> But.
>
> Sample code (short):
>
> \begin{exercises}
>
> \subsubsection*{Orders}
>
> \item Define $x < y$ to mean \dots label{Exer:I.1.1}
>
> \item Let the binary relation $ < $ satisfy the conditions of
> Exercise~\ref{Exer:I.1.1}.\label{Exer:I.1.2}
> \end{exercises}
>
> These two exercises are numbered "1.1" and "1.2", as they should be,
> they are the first two exercises in Section 1. But \ref{Exer:I.1.1}
> produces "1", not "1.1".
>
> I do not understand.
>
>
> GG
>
>
> On 16-Apr-09, at 5:29 PM, Michael Sharpe wrote:
>
>> To allow more space for the exercise number and section number, you
>> may wish to change the exercises macro so it reads something like
>>
>> \newenvironment{exercises}
>> {
>> \begin{xcb}{}\noindent\textbf{Exercises}
>> \settowidth{\leftmargini}{NNNN.\hskip\labelsep}
>> \begin{enumerate}
>> \let\olditem\item
>> \def\staritem{\let\exerstar\par\olditem }
>> \renewcommand{\item}{\let\exerstar\empty\olditem }
>> \renewcommand{\labelenumi}{\ifx\exerstar\empty\else*\fi\thesection.
>> \theenumi.}
>> }
>> {\end{enumerate}\end{xcb}}
>>
>> Note that the \settowidth line was moved to just above
>> \begin{enumerate}.
>>
>> Michael
>>
>> On Apr 16, 2009, at 2:26 PM, George Gratzer wrote:
>>
>>> And one more question. What do I need to do so that the number of
>>> the exercise is of the form 4.5, where 4 is the section number.
>>>
>>> I could do this if I knew the name of the counter...
>>>
>>> GG
>>>
>>>
>>> On 16-Apr-09, at 4:14 PM, George Gratzer wrote:
>>>
>>>> You are right, the * should come before the number (for
>>>> alignment). How do i do that/
>>>>
>>>> GG
>>>>
>>>> On 10-Apr-09, at 1:33 PM, Michael Sharpe wrote:
>>>>
>>>>>
>>>>> On Apr 10, 2009, at 9:56 AM, George Gratzer wrote:
>>>>>
>>>>>> In my new book, I have exercises at the end of each section. I
>>>>>> use the xcb environment from amsbook.cls:
>>>>>>
>>>>>> \newenvironment{xcb}{%
>>>>>> \setcounter{enumi}{0}%
>>>>>> \settowidth{\leftmargini}{\labelenumi\hskip\labelsep}%
>>>>>> \setcounter{enumii}{4}% letter d
>>>>>> \settowidth{\leftmarginii}{\labelenumii\hskip\labelsep}%
>>>>>> \@startsection{section}% counter name; ignored because of the
>>>>>> % * below
>>>>>> {1}% sectioning level
>>>>>> {\z@}% indent to the left of the section title
>>>>>> {18\p@\@plus2\p@}% vertical space above
>>>>>> {1sp}% Space below of 13pt base-to-base, so none needs to be
>>>>>> added
>>>>>> % here; but \z@ would cause the following text to be run-in, so
>>>>>> we
>>>>>> % use 1sp instead.
>>>>>> {\bfseries}% The font of the subsection title
>>>>>> *% always unnumbered
>>>>>> }{%
>>>>>> \par
>>>>>> }
>>>>>>
>>>>>>
>>>>>> modified as follows:
>>>>>>
>>>>>> \newenvironment{exercises}
>>>>>> {
>>>>>> \begin{xcb}{}\noindent\textbf{Exercises}
>>>>>> \begin{enumerate}
>>>>>> \renewcommand{\labelenumi}{\theenumi.}
>>>>>> \settowidth{\leftmargini}{NN.\hskip\labelsep}
>>>>>> }
>>>>>> {\end{enumerate}\end{xcb}}
>>>>>>
>>>>>> and then
>>>>>>
>>>>>> \begin{exercises}
>>>>>>
>>>>>> \item
>>>>>>
>>>>>> \begin{exercises}
>>>>>>
>>>>>> works well.
>>>>>>
>>>>>> Problem: I want the difficult exercises marked with a *:
>>>>>>
>>>>>> 25*.
>>>>>>
>>>>>> How could I do that? How do I modify one number, without
>>>>>> effecting the rest?
>>>>>>
>>>>>
>>>>> One way is to redefine the exercises environment as follows.
>>>>>
>>>>> \newenvironment{exercises}
>>>>> {
>>>>> \begin{xcb}{}\noindent\textbf{Exercises}
>>>>> \begin{enumerate}
>>>>> \let\olditem\item
>>>>> \def\staritem{\let\exerstar\par\olditem }
>>>>> \renewcommand{\item}{\let\exerstar\empty\olditem }
>>>>> \renewcommand{\labelenumi}{\theenumi\ifx\exerstar\empty\else*\fi.}
>>>>> \settowidth{\leftmargini}{NN.\hskip\labelsep}
>>>>> }
>>>>> {\end{enumerate}\end{xcb}}
>>>>>
>>>>> You might want to change the alignment of the numbers, or
>>>>> perhaps place the * before the exercise number---that's a simple
>>>>> change.
>>>>>
>>>>> Michael
>>>>>
>>>>> ----------- Please Consult the Following Before Posting
>>>>> -----------
>>>>> TeX FAQ: http://www.tex.ac.uk/faq
>>>>> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>>>>> List Archive: http://tug.org/pipermail/macostex-archives/
>>>>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>>>>> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>>>>
>>>>
>>>> ----------- Please Consult the Following Before Posting -----------
>>>> TeX FAQ: http://www.tex.ac.uk/faq
>>>> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>>>> List Archive: http://tug.org/pipermail/macostex-archives/
>>>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>>>> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>>>
>>>
>>> ----------- Please Consult the Following Before Posting -----------
>>> TeX FAQ: http://www.tex.ac.uk/faq
>>> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>>> List Archive: http://tug.org/pipermail/macostex-archives/
>>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>>> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>>
>>
>> ----------- Please Consult the Following Before Posting -----------
>> TeX FAQ: http://www.tex.ac.uk/faq
>> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>> List Archive: http://tug.org/pipermail/macostex-archives/
>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>
More information about the MacOSX-TeX
mailing list