From 8d712f0899f689942f0ae7e37ff36bc0f64dca25 Mon Sep 17 00:00:00 2001 From: Frank Fuhlbrück Date: Wed, 2 Feb 2022 17:42:43 +0100 Subject: skipping+fragile frames in Lua started --- exercisesheets.sty | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'exercisesheets.sty') diff --git a/exercisesheets.sty b/exercisesheets.sty index 572549a..d096e54 100644 --- a/exercisesheets.sty +++ b/exercisesheets.sty @@ -64,6 +64,7 @@ \newif\ifexsh@beameruseblocks \newif\ifexsh@defersolutiontitle \newif\ifexsh@framed +\newif\ifexsh@fragile \fi %Also only true for beamer, but we want to use it elsewhere \newif\ifexsh@beamersolution @@ -174,6 +175,8 @@ defersolutiontitle/.default=true, framed/.is if=exsh@framed, framed/.default=true, + fragile/.is if=exsh@fragile, + fragile/.default=true, beamersolution/.initial={false}, beamerwithheadline/.initial={false}, beameruseblocks/.initial={false}, @@ -648,6 +651,8 @@ \fi %%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%TODO: We need some proper switch-case here +%evaluate csname/csdef+detokenize \ExplSyntaxOn \cs_new_eq:NN \exsh@ifsingletoken \tl_if_single_token:nTF \ExplSyntaxOff @@ -1293,7 +1298,19 @@ \ifhmode \linebreak\fi \exsh@solutiontitle{\linewidth} }% - \ifbool{exsh@framed}{\Collect@Body\exsh@collectedframe}{}% + \let\next\relax + \ifbool{exsh@framed}{% + \def\next{\Collect@Body\exsh@collectedframe}% + \ifbool{exsh@fragile}{% + \ifluatex% + \def\next{\exsh@start@lframed@} + \else + \PackageError{exercisesheets}{Fragile frames require + LuaLaTeX!}{} + \fi% + }{}% + }{}% + \next% }% \else%--------- NON-BEAMER: --------------------------------------- \def\exsh@startsolution{\@afterindentfalse @@ -1561,10 +1578,15 @@ > !global!long!def!exsh@start@skip@Lexercise#1\end{Lexercise}< % !exsh@dlua % + !ifluatex!else!refstepcounter
!fi !endgroup!endgroup% !expandafter!exsh@skipstuff% !exsh@dlua% > +!global!long!def!exsh@start@lframed#1\end{solution}< % + !exsh@dlua % + !endgroup!end% +> !endgroup \def\exsh@lua@catcodesBG{ @@ -1590,11 +1612,13 @@ \ifluatex \exsh@dlua{exsh_texprintlines(exsh_cur_exercise)}% \else + \refstepcounter{section} Lexercise needs Lua\LaTeX! \fi } +%TODO:setcounter without luatex \def\exsh@skipstuff@Lexercise{\exsh@lua@catcodesBG\exsh@start@skip@Lexercise}% -% \exsh@lua@catcodesBG\exsh@start@skip@Lexercise} +\def\exsh@start@lframed@{\exsh@lua@catcodesBG\exsh@start@lframed} \exsh@dlua{dofile("exsh_lexercise.lua")} -- cgit v1.2.3