From 6766e3f2cd846b770fa131664053521dbfb9171a Mon Sep 17 00:00:00 2001
From: Frank Fuhlbrück
Date: Tue, 25 Jan 2022 18:48:11 +0100
Subject: Lua interface progress

---
 exercisesheets-beamer.sty | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'exercisesheets-beamer.sty')

diff --git a/exercisesheets-beamer.sty b/exercisesheets-beamer.sty
index 6688624..4ba3690 100644
--- a/exercisesheets-beamer.sty
+++ b/exercisesheets-beamer.sty
@@ -1353,6 +1353,8 @@
 
 \ifluatex
 \usepackage{luacode}
+
+%change only some catcodes to 
 \begingroup
 \catcode`!=0
 \catcode`\@=11
@@ -1363,13 +1365,14 @@
 \catcode`>=2
 \catcode`\~=11
 \catcode`\\=11
-%% Exoanded, when \catcode`\^^M=12 holds
-!global!long!def!@start@Lexercise@Helper#1\end{Lexercise}< %
+%% Expanded, when \catcode`\^^M=12 holds
+!global!long!def!exsh@start@Lexercise@#1\end{Lexercise}< %
   !directlua<exsh_cur_exercise=exercise ({#1})> %
-  !endgroup!end<Lexercise>!par %
+  !endgroup!end<Lexercise>%
 >
 !endgroup
-\def\startLexercise{
+
+\def\exsh@lua@catcodesBG{
 \begingroup
 \catcode`!=12
 \catcode`\$=12
@@ -1384,10 +1387,13 @@
 \catcode`\@=11
 \catcode`\%=12
 \catcode`\^^I=12
-\catcode`\^^J=12\catcode`\^^M=12\catcode`\\=11\endlinechar-1\@start@Lexercise@Helper}
+\catcode`\^^J=12\catcode`\^^M=12\catcode`\\=11\endlinechar-1}
+
+\def\exsh@start@Lexercise{%
+  \exsh@lua@catcodesBG\exsh@start@Lexercise@}
 
 \newenvironment{Lexercise}{%
-  \startLexercise%
+  \exsh@start@Lexercise%
 }{%
   \directlua{tex.print(exsh_cur_exercise)}
 }
-- 
cgit v1.2.3

