Exercises at end of sections

José Abílio Matos jamatos at lyx.org
Fri Jun 3 16:37:28 UTC 2022


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20220603/41b2b2d5/attachment-0001.html>
-------------- next part --------------
#\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  
   MultiPar    true
   LabelString Exercise
   Requires    xsim
End

InsetLayout Flex:Solution
   LyXType     custom
   LatexName   solution
   LatexType   environment
   Counter     solution
   Decoration  classic  
   MultiPar    true
   LabelString Solution
   Requires    xsim
End

Style Task
   CopyStyle   Enumerate
   LatexName   tasks
   ItemTag     ***
End


More information about the lyx-users mailing list