diff options
| author | Frank Fuhlbrück | 2022-02-02 17:42:43 +0100 |
|---|---|---|
| committer | Frank Fuhlbrück | 2022-02-02 17:42:43 +0100 |
| commit | 8d712f0899f689942f0ae7e37ff36bc0f64dca25 (patch) | |
| tree | 74ba3d318eef5d3a18d110756028026280e2caf0 | |
| parent | 178cfdd4743d36975993cefcd0cb525748468578 (diff) | |
| download | exercisesheets-8d712f0899f689942f0ae7e37ff36bc0f64dca25.tar.gz exercisesheets-8d712f0899f689942f0ae7e37ff36bc0f64dca25.tar.bz2 exercisesheets-8d712f0899f689942f0ae7e37ff36bc0f64dca25.zip | |
skipping+fragile frames in Lua started
| -rw-r--r-- | examples/exshexample.tex | 14 | ||||
| -rw-r--r-- | exercisesheets.sty | 28 |
2 files changed, 35 insertions, 7 deletions
diff --git a/examples/exshexample.tex b/examples/exshexample.tex index 99a9b1f..4db32cd 100644 --- a/examples/exshexample.tex +++ b/examples/exshexample.tex @@ -1,4 +1,4 @@ -\long\def\ifbeamer#1#2{#2} +\long\def\ifbeamer#1#2{#1} \ifbeamer{\documentclass{beamer}}{\documentclass{article}} %navigation symbols and the title collide if @@ -36,12 +36,13 @@ \exshset{solutions=true, task restate font={\color{black!60}}, -only={5} +only={-} } \begin{document} +%1 \begin{sheet}[note={Learn how to create nice exercise sheets.}, date={Novanuar 42, -2022},title={First Sheet}] @@ -69,12 +70,14 @@ only={5} \end{exercise} \end{sheet} +%2 \begin{sheet}[date={Novanuar 35, -2022}] \begin{exercise}[points={many, many}, firstline={Read the manual.}] \end{exercise} \end{sheet} +%3 \begin{sheet}[date={Novanuar 28, -2022},title={Third Sheet}, number within sheet] \begin{exercise}[points={many, many}, @@ -85,6 +88,7 @@ only={5} \end{exercise} \end{sheet} +%4 \begin{sheet} \begin{Lexercise} task = [[ @@ -110,13 +114,13 @@ only={5} % \end{subtasks} \begin{enumerate} \subtask {first \label{subex:skipexOne}} - \item {{\label}{subex:skipexTwo}} {12345} + \item {\label{subex:skipexTwo}} {12345} \end{enumerate} \end{exercise} \end{sheet} - +%5 \begin{sheet}[date={Novanuar 21, -2022}] \begin{exercise}[points={many, many}, firstline={Read the manual.}] @@ -124,7 +128,7 @@ only={5} \begin{solution}[framed] OK, done (again). \newframe - Otherwise, I would'nt now now \textbackslash newframe which + Otherwise, I wouldn't know \textbackslash newframe now which does not exist in beamer. \end{solution} \end{exercise} 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<exsh_cur_exercise=exercise({#1})> % + !ifluatex!else!refstepcounter<section>!fi !endgroup!endgroup% !expandafter!exsh@skipstuff% !exsh@dlua<exsh_texprintlines(exsh_cur_exercise)>% > +!global!long!def!exsh@start@lframed#1\end{solution}< % + !exsh@dlua<exsh_cur_solution=[[#1]]> % + !endgroup!end<solution>% +> !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")} |
