From 2945227492d10d2e6e649952b9ede6b135755f27 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sun, 20 Oct 2019 19:34:29 +0200
Subject: testing blfootnote

---
 ekdosis.dtx | 84 +++++++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 63 insertions(+), 21 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 4a5a025..7ea82a5 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -341,7 +341,12 @@ Running "make install" installs the files in the local TeX tree.
   \else\fi\fi\fi}
 \ExecuteOptionsX{}
 \ProcessOptionsX\relax
+\newcommand{\dontusepackage}[2][]{%
+  \@namedef{ver@#2.sty}{9999/12/31}%
+  \@namedef{opt@#2.sty}{#1}}
+\dontusepackage{etex}
 \RequirePackage{luacode}
+\RequirePackage{manyfoot}
 \RequirePackage{paracol}
 \RequirePackage{keycommand}
 \RequirePackage{xparse}
@@ -482,7 +487,25 @@ idno={}, msName={}, origDate={}][3]{%
   {\luadirect{ekdosis.appin(\luastringO{#2})}}
   {\luadirect{ekdosis.appin(\luastringO{#2}, \luastringO{#1})}}%
 }
-\def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
+ %\def\blfootnote{\gdef\@thefnmark{\relax}\@footnotetext}
+\def\blfootnote{\gdef\@thefnmark{}\@blfootnotetext}
+\long\def\@blfootnotetext#1{\insert\footins{%
+    \reset@font\footnotesize
+    \interlinepenalty\interfootnotelinepenalty
+    \splittopskip\footnotesep
+    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+    \hsize\columnwidth \@parboxrestore
+    \protected@edef\@currentlabel{%
+       \csname p@footnote\endcsname\@thefnmark
+    }%
+    \color@begingroup
+      \@makeblfntext{%
+        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+    \color@endgroup}}%
+\newcommand\@makeblfntext[1]{%
+    \parindent 1em%
+    \noindent
+    \hb@xt@0em{\hss\@makefnmark}#1}
 \newif\ifrtl@app
 \NewDocumentCommand{\SetRTLapp}{}{\rtl@apptrue}
 \NewDocumentCommand{\SetLTRapp}{}{\rtl@appfalse}
@@ -493,6 +516,10 @@ idno={}, msName={}, origDate={}][3]{%
 \def\ekd@unit@delim{}
 \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}}
 \def\ekd@default@rule{\rule{2truein}{0.5pt}}
+ % \def\ekd@default@rule{\vskip-\baselineskip\mbox{}\newline%
+ %    \rule{2truein}{0.5pt}}
+\def\footnoterule{}
+\def\pcol@footnoterule{}
 \NewDocumentCommand{\SetDefaultRule}{m}{%
   \def\@tempa{#1}
   \ifx\@tempa\empty\def\ekd@default@rule{\mbox{}}%
@@ -501,10 +528,15 @@ idno={}, msName={}, origDate={}][3]{%
   \fi}
 \newif\ifsubsq@unit
 \subsq@unittrue
+\SetFootnoteHook{\hskip -1.8em}
+\newfootnote{@ekd}
 \def\add@@apparatus{%
-  % \blfootnote{\apparatus}%
   \if@pkg@parnotes\parnotes\else\fi%
-  \keyparbox[b!]{}{\ifrtl@app\setRL\else\setLR\fi%
+  \bgroup%
+  \ifrtl@app\setRL\fi%
+  \blfootnote{%
+  % \Footnotetext@ekd{\relax}{%
+    % \ifrtl@app\setRL\else\setLR\fi%
     \if@pkg@parnotes%
     \if@parnotesroman%
     \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
@@ -512,6 +544,15 @@ idno={}, msName={}, origDate={}][3]{%
     \footnotesize\apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi%
     \if@pkg@parnotes\parnotes\parnotereset\else\fi%
   }%
+  \egroup%
+  % \keyparbox[b!]{}{\ifrtl@app\setRL\else\setLR\fi%
+  %   \if@pkg@parnotes%
+  %   \if@parnotesroman%
+  %   \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi%
+  %   \parnoteclear\else\fi%
+  %   \footnotesize\apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi%
+  %   \if@pkg@parnotes\parnotes\parnotereset\else\fi%
+  % }%
   \unless\ifekd@mapps\unconditional@appin{%
     \expandafter{\ekd@default@rule}\newline}\fi
 }
@@ -664,25 +705,25 @@ idno={}, msName={}, origDate={}][3]{%
       \luadirect{tex.sprint(ekdosis.getappdelim(\luastringO{\ekdan@type}))}}%
   \fi%
   \ifekdl@nolem\edef\lem@app{%
-    \hskip .75em
+    % \hskip .75em
     \ifekd@mapps
     \ifbool{subsq@unit@\ekdan@type}%
-    {\expandafter\noexpand\ekd@munit@delim}{}%
+    {\ekd@munit@delim}{}%
     \else%
     \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
     \fi%
-    \current@ref\hskip .25em}%
+    \current@ref}%\hskip .25em}%
   \else%
   \ifbool{al@rlmode}{%
     \edef\lem@app{%
-      \hskip .75em
+      % \hskip .75em
       \ifekd@mapps
       \ifbool{subsq@unit@\ekdan@type}%
-      {\expandafter\noexpand\ekd@munit@delim}{}%
+      {\ekd@munit@delim}{}%
       \else%
       \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
       \fi%
-      \current@ref\hskip .25em
+      \current@ref%\hskip .25em
       \ifdefined\ekdlr@alt%
         \ifdefined\ekdlr@post%
           \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
@@ -706,14 +747,14 @@ idno={}, msName={}, origDate={}][3]{%
   }%
   {%
     \edef\lem@app{%
-      \hskip .75em
+      % \hskip .75em
       \ifekd@mapps
       \ifbool{subsq@unit@\ekdan@type}%
-      {\expandafter\noexpand\ekd@munit@delim}{}%
+      {\ekd@munit@delim}{}%
       \else%
       \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
       \fi%
-      \current@ref\hskip .25em
+      \current@ref%\hskip .25em
       \ifdefined\ekdlr@alt%
         \ifdefined\ekdlr@pre%
           \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
@@ -852,27 +893,27 @@ idno={}, msName={}, origDate={}][3]{%
     set.}\fi%
   \ifbool{al@rlmode}%
   {\edef\note@contents{%
-      \hskip .75em
+      % \hskip .75em
       \ifekd@mapps
       \ifbool{subsq@unit@\ekdan@type}%
-      {\expandafter\noexpand\ekd@munit@delim}{}%
+      {\ekd@munit@delim}{}%
       \else%
       \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
       \fi%
-    \current@ref@arg{\ekdn@labelb}{\ekdn@labele}\hskip .25em
+    \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em
       \ifdefined\ekdn@lem%
           {\textdir TRT\unexpanded\expandafter{\ekdn@lem}}%
           \unexpanded\expandafter{\ekdn@sep}\else\fi%
             {\textdir TRT\unexpanded{#2}}}}%
   {\edef\note@contents{%
-      \hskip .75em
+      % \hskip .75em
       \ifekd@mapps
       \ifbool{subsq@unit@\ekdan@type}%
-      {\expandafter\noexpand\ekd@munit@delim}{}%
+      {\ekd@munit@delim}{}%
       \else%
       \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi%
       \fi%
-      \current@ref@arg{\ekdn@labelb}{\ekdn@labele}\hskip .25em
+      \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em
       \ifdefined\ekdn@lem
         \ltx@ifpackageloaded{babel}%
           {\noexpand\selectlanguage{\languagename}%
@@ -1794,6 +1835,7 @@ function ekdosis.appout()
 	 end
 	 -- table.insert(output, "END")
       else
+	 table.insert(output, "\\vskip -\\baselineskip")
 	 local n = 1
 	 while apparatuses[n]
 	 do
@@ -1810,12 +1852,12 @@ function ekdosis.appout()
 	       end
 	       if apparatuses[n].rule == "none"
 	       then
-		  table.insert(output, "\\par\\mbox{}\\newline{}")
+		  table.insert(output, "\\par\\noindent\\mbox{}\\newline{}")
 	       elseif apparatuses[n].rule ~= ""
 	       then
-		  table.insert(output, "\\par\\mbox{}" .. apparatuses[n].rule .. "\\mbox{}\\newline{}")
+		  table.insert(output, "\\par\\noindent\\mbox{}" .. apparatuses[n].rule .. "\\mbox{}\\newline{}")
 	       else
-		  table.insert(output, "\\par\\csname ekd@default@rule\\endcsname\\newline{}")
+		  table.insert(output, "\\par\\noindent\\csname ekd@default@rule\\endcsname\\newline{}")
 	       end
 	       if apparatuses[n].bhook ~= ""
 	       then
-- 
cgit v1.2.3

