Exercises at end of sections

Steve Litt slitt at troubleshooters.com
Fri Jun 3 20:30:24 UTC 2022


Joseph Hesse said on Mon, 30 May 2022 05:38:33 -0500

>Hello,
>I am writing a text book and want to have numbered exercises at the
>end of each section.  Please point me to the docs or packages that
>will let me do this.
>Thank you,
>Joe Hesse

Hi Joe,

If for some reason the answers you've received don't fit your needs,
please remember you can always put special text tokens in your LyX
file, then run a Python3 program of your own device to make necessary
insertions, changes and deletions to produce what you want.

For instance, in your text you could have a vvvQUESTIONSvvv and a
^^^QUESTIONS^^^ bookend your questions, and a >>>CORRECT<<< at the
beginning of each correct answer. The Python program would remove the
tokens after reading them, and put the answer section where it belongs,
with the correct answer(s) having a different character style.

I did this in the past, and it worked. Obviously an all-LyX solution is
better, but one nice thing about LyX is its native format is still
reasonably parsable so if nothing else works, writing such a program is
always a way to get what you need. Basically, it just adds one more
short step to the compile process. 

SteveT

Steve Litt 
Spring 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm


More information about the lyx-users mailing list