From b1c05c427af73fd29ac3605af4845fb97ccfbed4 Mon Sep 17 00:00:00 2001
From: Sebastian Kuhnert
Date: Thu, 3 Dec 2015 10:34:13 +0000
Subject: exercisesheets.sty: some fixes for lualatex

---
 exercisesheets.sty | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index 0a53683..a99f0a8 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -1,6 +1,6 @@
 %\NeedsTeXFormat{LaTeX2e}[1994/12/01]
 \RequirePackage{svn-prov}
-\def\exsh@version{0.5g}
+\def\exsh@version{0.5h}
 \ProvidesPackageSVN{$Id$}[\exsh@version\space Typesetting of exercise sheets \revinfo]
 \GetFileInfoSVN*
 \message{`Typesetting of exercise sheets' \exsh@version\space <\filedate> (SVN Rev: \filerev)}
@@ -528,6 +528,7 @@
 }{}
 
 \newenvironment*{exercise}[1][]{%
+  % TODO: \edef is not safe with luatex and umlauts, only fixed for "oral" for now
   \pgfkeys{exsh,every exercise,#1}%
   \ifthenelse{\equal{}{\pgfkeysvalueof{/exsh/points}}}{%
     \def\exsh@points{}%
@@ -538,9 +539,9 @@
     }{%
       \ifthenelse{\equal{oral}{\pgfkeysvalueof{/exsh/points}}}{%
         \ifexsh@abbrev%
-          \edef\exsh@points{\pgfkeysvalueof{/exsh/strings/oral abbrev}}%
+          \pgfkeysgetvalue{/exsh/strings/oral abbrev}{\exsh@points}%
         \else%
-          \edef\exsh@points{\pgfkeysvalueof{/exsh/strings/oral}}%
+          \pgfkeysgetvalue{/exsh/strings/oral}{\exsh@points}%
         \fi%
       }{%
          \ifexsh@abbrev%
@@ -593,10 +594,10 @@
     \edef\exsh@shortexname{:\space\pgfkeysvalueof{/exsh/name}}%
   }%
   \refstepcounter{section}%
-  \edef\exsh@tmp{[\pgfkeysvalueof{/exsh/strings/exercise} \arabic{section}\exsh@shortexname\exsh@shortpoints]}%
+  \edef\exsh@tmp{[\pgfkeysvalueof{/exsh/strings/exercise} \arabic{section}\exsh@shortexname\expandonce\exsh@shortpoints]}%
   \expandafter\exsh@startsection\exsh@tmp{\noindent%
     \hbox to 0pt{\hss\pgfkeysvalueof{/exsh/exercisemark}}%
-    \pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@exname\exsh@firstline\exsh@points}%
+    \pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}\exsh@exname\exsh@firstline\expandonce\exsh@points}%
   \unskip\vskip\pgfkeysvalueof{/exsh/below exercise title skip}\relax
   \@afterindentfalse
   % Use \leavevmode to ensure proper distances above environments that start
@@ -625,6 +626,7 @@
   \setenumerate[3]{label=\roman*.}
   \setenumerate[4]{label=\Alph.}
 }
+\def\theHenumi{enumi.\arabic{part}.\arabic{section}.\arabic{enumi}}
 
 % reset equation numbering for each exercise
 \@addtoreset{equation}{section}
@@ -735,12 +737,17 @@
 }
 
 \ifluatex%
-\def\exsh@putatend#1{%
-\leavevmode\luatextextdir TRT\unskip{\luatextextdir TLT{\hfill~~#1}}\luatextextdir TLT}%
+  \ifdefined\luatextextdir
+    \def\exsh@putatend#1{%
+      \leavevmode\luatextextdir TRT\unskip{\luatextextdir TLT{\hfill~~#1}}\luatextextdir TLT}%
+  \else
+    \def\exsh@putatend#1{%
+      \leavevmode\textdir TRT\unskip{\textdir TLT{\hfill~~#1}}\textdir TLT}%
+  \fi
 \else%
-\def\exsh@putatend#1{%
-\TeXXeTstate=1%
-\beginR\unskip{\beginL~~#1\endL}\hfill\beginL\TeXXeTstate=0}%
+  \def\exsh@putatend#1{%
+    \TeXXeTstate=1%
+    \beginR\unskip{\beginL~~#1\endL}\hfill\beginL\TeXXeTstate=0}%
 \fi
 
 \def\exsh@leaveinplace#1{\unskip~{#1} }
-- 
cgit v1.2.3

