Re: Exercises at end of sections
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 -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users
Re: Exercises at end of sections
On Wednesday, 1 June 2022 05.38.06 WEST Richard Kimberly Heck wrote: > > There probably is some pre-existing package you could adapt. But this > would be relatively easy to do from scratch. My first thought would be > as in the attached file. Is there something you need that isn't here? > > Riki FWIW I use tasks together with xsim (eXercises and Solutions IMproved). This allows to place together exercises and solutions in LyX and to print the solution where we want to (e.g. at the end in a special section/chapter). Attached follows the module file that I use for this. I need to clean it to add to lyx. :-) -- José Abílio#\DeclareLyXModule[xsim.sty]{Exercise sheets} #DescriptionBegin # Adds Exercise and Solution environments from the xsim package. # This package allows that solutions to exercises to appear where required. You will need to add # \printsolutions in TeX-code where you want the solutions to appear. #DescriptionEnd # #Author: José Matos Format 60 Requires xsim AddToPreamble \let\beamersolution\solution \let\endbeamersolution\endsolution % "delete" the `solution' environment: \let\solution\relax \usepackage{xsim} EndPreamble Counter exercise PrettyFormat "Exercise ##" End Counter solution PrettyFormat "Solution ##" End InsetLayout Flex:Question LyXType custom LatexName exercise LatexType environment Counter exercise Decoration classic MultiPartrue LabelString Exercise Requiresxsim End InsetLayout Flex:Solution LyXType custom LatexName solution LatexType environment Counter solution Decoration classic MultiPartrue LabelString Solution Requiresxsim End Style Task CopyStyle Enumerate LatexName tasks ItemTag *** End -- lyx-users mailing list lyx-users@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-users