From ed0058953a644652c62ce9c46417b13513b9b6a5 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Tue, 13 Nov 2018 10:21:00 +0100
Subject: \note may also be found inside \lem or \rdg

---
 ekdosis.dtx | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 293cc1c..bed668b 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -345,6 +345,8 @@ Running "make install" installs the files in the local TeX tree.
 \newbool{ekdstarted}
 \newbool{doapp}
 \newbool{ekdstate}
+\newif\ifinapp
+\newif\ifnonote
 \providebool{al@rlmode}
 \newcounter{ekd@lab}
 \def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
@@ -384,15 +386,17 @@ Running "make install" installs the files in the local TeX tree.
     ekdosis.storeabspg(\luastring{\zref@extract{ekd:\theekd@lab}{abspage}},
     "pg_ii")}%
   \ifbool{ekdstate}{\add@apparatus}{}%
-    #1}
-\NewDocumentCommand{\lem}{o +m}{%
+  #1}
+\NewDocumentCommand{\lem}{o +m}{\nonotetrue#2%  
+  \nonotefalse\inapptrue%
   \ifbool{al@rlmode}%
   {\IfNoValueTF{#1}%
-    {#2\obappend{\bgroup\setRL#2\egroup:}}%
-    {#2\obappend{\bgroup\setRL#2\egroup{} #1:}}}%
-  {\IfNoValueTF{#1}{#2\obappend{#2:}}{#2\obappend{#2 #1:}}}%
+    {\obappend{\bgroup\setRL#2\egroup:}}%
+    {\obappend{\bgroup\setRL#2\egroup{} #1:}}}%
+  {\IfNoValueTF{#1}{\obappend{#2:}}{\obappend{#2 #1:}}}%
 }
 \NewDocumentCommand{\rdg}{o +m}{%
+  \inapptrue%
   \ifbool{al@rlmode}%
   {\IfNoValueTF{#1}
     {\append{\bgroup\setRL#2\egroup}}
@@ -400,9 +404,12 @@ Running "make install" installs the files in the local TeX tree.
   {\IfNoValueTF{#1}{\append{#2}}{\append{#2 #1}}}%
 }
 \NewDocumentCommand{\note}{s +m}{%
+  \ifnonote\else%
+  \ifinapp%
   \IfBooleanTF{#1}{%
     \if@pkg@parnotes\append{\parnote{#2}}%
     \else\append{\footnote{#2}}\fi}{\append{#2}}%
+  \else\ #2 \fi\fi%
 }
 \NewDocumentCommand{\apparatus}{}{\luadirect{tex.sprint(appout())}}
 \NewDocumentCommand{\testapparatus}{}{%
-- 
cgit v1.2.3

