diff options
| author | Frank Fuhlbrück | 2022-02-09 15:40:44 +0100 |
|---|---|---|
| committer | Frank Fuhlbrück | 2022-02-09 15:40:44 +0100 |
| commit | 8fb71977a7dddf8f481f6b76bff864d98f00ffac (patch) | |
| tree | 54ff67eb2e56e7ca8fef29de844780db1f65e1b9 /exsh_lexercise.lua | |
| parent | b216df0bff1f24aa24e8039daea663dc64e3c1bd (diff) | |
| download | exercisesheets-8fb71977a7dddf8f481f6b76bff864d98f00ffac.tar.gz exercisesheets-8fb71977a7dddf8f481f6b76bff864d98f00ffac.tar.bz2 exercisesheets-8fb71977a7dddf8f481f6b76bff864d98f00ffac.zip | |
fragile framed exercises with lua
Diffstat (limited to 'exsh_lexercise.lua')
| -rw-r--r-- | exsh_lexercise.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/exsh_lexercise.lua b/exsh_lexercise.lua index b05d29e..85a298b 100644 --- a/exsh_lexercise.lua +++ b/exsh_lexercise.lua @@ -1,5 +1,5 @@ exsh_texprintlines = function(s) - for line in s:gmatch("[^\n]+") do + for line in s:gmatch("[^\n]*") do tex.print(line) end end @@ -117,3 +117,20 @@ exercise = function(ex) return ece end +fragileframed = function(s) + local frames,p,pn,n,i = {},1,1,#s,0 + pn = s:find([[\newframe]],p) or n+1 + while p < n do + i = i+1 + frames[i] = [[ + \begin{frame}[t,fragile] + \solutiontitle[\textwidth] + ]] .. s:sub(p,pn-1) .. [[ + \end{frame} + ]] + p = pn + 9 + pn = s:find([[\newframe]],p) or n+1 + end + return table.concat(frames,"") +end + |
