From 2c8259d908346f1ff51d8838caaf3cd80693f103 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Thu, 26 Mar 2020 11:56:19 +0100
Subject: set direction of page/line numbers to LR

---
 ekdosis.dtx | 46 ++++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 09ed564..e20075b 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -372,13 +372,13 @@ Running "make install" installs the files in the local TeX tree.
 %    \end{macrocode}
 % Hooks
 %    \begin{macrocode}
-\ekvdefinekeys{hooks}{
+\ekvdefinekeys{ekd@hooks}{
   store refnumstyle = \ekd@refnumstyle,
   store postrefnum = \ekd@postrefnum,
   initial refnumstyle = \bfseries,
   initial postrefnum = ~
 }
-\NewDocumentCommand{\SetEkdosisHooks}{m}{\ekvset{hooks}{#1}}
+\NewDocumentCommand{\SetEkdosisHooks}{m}{\ekvset{ekd@hooks}{#1}}
 %    \end{macrocode}
 % Build and process the list of witnesses and hands.
 %    \begin{macrocode}
@@ -506,6 +506,7 @@ Running "make install" installs the files in the local TeX tree.
   \def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT}
   \def\setLR{\boolfalse{al@rlmode}\pardir TLT \textdir TLT}
 }
+\protected\def\LRnum#1{\bgroup\textdir TLT#1\egroup}
 \newcounter{ekd@lab}
 \globalcounter{ekd@lab}
  % \def\unconditional@appin#1{%
@@ -642,7 +643,7 @@ Running "make install" installs the files in the local TeX tree.
     "pg_ii")}%
   \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}%
   \ekd@isinappfalse}
-\def\current@ref@arg#1#2{{\textdir TLT%
+\def\current@ref@arg#1#2{{%\textdir TLT%
     \unexpanded\expandafter{\ekd@refnumstyle}%
     \ifnum%
     \getpagerefnumber{#1}
@@ -660,10 +661,10 @@ Running "make install" installs the files in the local TeX tree.
         =
         \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}
         \else
-        \getrefnumber{#1}%
+        \LRnum{\getrefnumber{#1}}% issue the no
         \fi%
       }%
-      {\getrefnumber{#1}}%
+      {\LRnum{\getrefnumber{#1}}}% issue the no
       \else
       \ifsubsq@unit%
       %
@@ -672,26 +673,27 @@ Running "make install" installs the files in the local TeX tree.
       =
       \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevnotelab())}}
       \else
-      \getrefnumber{#1}%
+      \LRnum{\getrefnumber{#1}}% issue the no
       \fi
       %
       \else
-      \getrefnumber{#1}%
+      \LRnum{\getrefnumber{#1}}% issue the no
       \fi
       \fi
       %
       \else
-      \getrefnumber{#1}--%
-      \getrefnumber{#2}%
+      \LRnum{\getrefnumber{#1}}--%
+      \LRnum{\getrefnumber{#2}}% issue the nos
       \fi%
       \else
-      \getrefnumber{#1}--%
-      \getpagerefnumber{#2}.%
-      \getrefnumber{#2}%
+      \LRnum{\getrefnumber{#1}}--%
+      \LRnum{\getpagerefnumber{#2}}.%
+      \LRnum{\getrefnumber{#2}}% issue pg and ln nos
       \fi%
     }\unexpanded\expandafter{\ekd@postrefnum}%
   }%
-\def\current@ref{{\textdir TLT\unexpanded\expandafter{\ekd@refnumstyle}%
+  \def\current@ref{{%\textdir TLT%
+      \unexpanded\expandafter{\ekd@refnumstyle}%
     \ifnum%
     \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}
     =
@@ -708,9 +710,9 @@ Running "make install" installs the files in the local TeX tree.
         =
         \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}
         \else
-        \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}%
+        \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% issue the no
         \fi%
-      }{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}%
+      }{\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}}% issue the no
       \else
       \ifsubsq@unit%
       %
@@ -719,22 +721,22 @@ Running "make install" installs the files in the local TeX tree.
       =
       \getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}
       \else
-      \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}%
+      \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% issue the no
       \fi
       %
       \else
-      \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}%
+      \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% issue the no
       \fi
       \fi
       %
       \else
-      \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}--%
-      \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}%
+      \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--%
+      \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% issue the nos
       \fi%
       \else
-      \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}--%
-      \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}.%
-      \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}%
+      \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--%
+      \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.%
+      \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% issue pg and ln nos
       \fi%
     }\unexpanded\expandafter{\ekd@postrefnum}%
   }%
-- 
cgit v1.2.3

