From 70ff06d10cbbff3ebd6e38a5078b5817ac3dc48d Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Thu, 20 Feb 2020 07:40:29 +0100
Subject: more control over expansion in \note

---
 ekdosis.dtx | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index fdd14f3..56a1f89 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -993,11 +993,14 @@ Running "make install" installs the files in the local TeX tree.
   \options{/note,#1}%
   \letoption{/note/pre}\pre@value%
   \letoption{/note/post}\post@value%
-  \append@app{%
-    \ifoptionvoid{/note/pre}{}{\pre@value}%
-    #2%
-    \ifoptionvoid{/note/post}{}{\post@value}%
-  }
+  \edef\note@contents{%
+    \ifoptionvoid{/note/pre}{}{%
+      \unexpanded\expandafter{\pre@value}}%
+    \unexpanded{#2}%
+    \ifoptionvoid{/note/post}{}{%
+      \unexpanded\expandafter{\post@value}}%
+  }%
+  \append@app{\note@contents}%
   \egroup%
 }
 \NewDocumentCommand{\ekd@note@star}{O{} m}{%
@@ -1006,11 +1009,14 @@ Running "make install" installs the files in the local TeX tree.
       \options{/note,#1}%
       \letoption{/note/pre}\pre@value%
       \letoption{/note/post}\post@value%
-      \append@app{%
-        \ifoptionvoid{/note/pre}{}{\pre@value}%
-        \unskip\parnote{#2}%
-        \ifoptionvoid{/note/post}{}{\post@value}%
+      \edef\note@contents{%
+        \ifoptionvoid{/note/pre}{}{%
+          \unexpanded\expandafter{\pre@value}}%
+        \unskip\noexpand\parnote{#2}%
+        \ifoptionvoid{/note/post}{}{%
+          \unexpanded\expandafter{\post@value}}%
       }
+      \append@app{\note@contents}%
     \egroup%
   \else
     \append@app{\unskip\footnote{#2}}%
-- 
cgit v1.2.3

