A bug report about the LaTeX package - exercise

by at tongji.edu.cn by at tongji.edu.cn
Fri Dec 25 12:28:55 CET 2020


Good evening, Sir/Madam:

I download the most recent Texlive 2020 distribution and find a problem when I am using the package - exercise to typeset one book I am working on.  The following is description of the problem that was met.

For the following LaTeX codes,

------------------------
\documentclass{book}
\usepackage{exercise}
\begin{document}
\tableofcontents
\listofexercises
\begin{Exercise}
This is an exercise.
\end{Exercise}
\shipoutExercise
\end{document}
------------------------

It is noticed that an invalid letter `t' will appear in each entry of the list of exercises typesetted through the macro - `\listofexercises'.  After examining the file - `exercise.sty' provided by the LaTeX exercise package, I think it is due to the codes in the line of 371.  The original code is `\theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}}'.  However this will cause things like `...\fontshape it...' to enter the corresponding loe file finally.  The correct way to specify an italic font shape is something like `\fontshape{it}', `\fontshape\itdefault', but not `\fontshape it'.  Typesetting `\fontshape it' will cause two problems.  First LaTex will report that it can not find the font shape specified by the letter `i'.  Second the letter `t' will sneak into the final file typesetted.  There are many ways to solve it.  The one I adopt is to change the original code - `... \expandafter{\itshape...' to `...\expandafter{\noexpand\itshape...' to prohibit the expansion of the macro - `\itshape' when the corresponding contents are written to the loe file.  Lastly, as a reminder, a similar situation is also found in the line 392 of `exercise.sty'.

That is all.  Thanks.

Sincerely,
Bin Yu



More information about the tex-live mailing list.