[texhax] Nested lists and newenvironment
Hefferon, James S.
jhefferon at smcvt.edu
Sat Mar 8 12:44:19 CET 2014
> Wrapping \item in a group causes each item to see itself as
> the first in the enumerate environment. I have not been able
> yet to trace exactly how this leads to the results you see,
> and how the surrounding trivlist environment is involved,
> but sure one can expect things to go wrong if mistaken
> information is used.
Thank you, Dan.
Just a comment, to justify the awkward-looking MWE a bit: I have a book of exercises (it is an Inquiry-based intro to proofs class). The first edition had \item for exercises. But I want that I can make the number of exercises greater or lesser by omitting some (some instructors teach 3 credit classes, some teach 4, etc.). So I thought to have an optional argument to each exercise. For instance, because of the class option this sets \booklength to 1 and threrefore would not print the sketched-in exercise, since 2>1.
\documentclass[middlelength]{ibl}
:
\begin{problem}
Prove each of the following exercises.
\begin{exercise}[2]
Prove the Twin Primes Conjecture.
\end{exercise}
\begin{answer}
42
\end{answer}
-- more exercises--
\end{problem}
I can't use \item because I can't say \item[2]. In addition, when an exercise isn't printed, I want to copy it and its answer verbatim to otherproblems.tex for the instructor to use for extras. So I thought that verbatim copying required me to use environments.
I got it to work but for the one case that there is not text where it says "Prove each of the following exercises." But I absolutely get your point about groups. maybe it just won't go there.
Thanks,
Jim
------------------------------------------
"Does not the Captain seek your advice, sir?"
"Not always," said Stephen.
More information about the texhax
mailing list