[OS X TeX] Exercises
Michael Sharpe
msharpe at ucsd.edu
Fri Apr 17 00:29:01 CEST 2009
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
>
More information about the macostex-archives
mailing list