From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/edfnotes/PdUsample.pdf | Bin 0 -> 103693 bytes macros/latex/contrib/edfnotes/README | 1 + macros/latex/contrib/edfnotes/README.pdf | Bin 0 -> 13439 bytes macros/latex/contrib/edfnotes/README.txt | 41 + macros/latex/contrib/edfnotes/SRCFILEs.txt | 11 + macros/latex/contrib/edfnotes/docsrc/README.tex | 12 + macros/latex/contrib/edfnotes/docsrc/edfnotes.tex | 114 +++ macros/latex/contrib/edfnotes/docsrc/srcfiles.tex | 6 + macros/latex/contrib/edfnotes/edfnotes.pdf | Bin 0 -> 253606 bytes macros/latex/contrib/edfnotes/edfnotes.sty | 918 ++++++++++++++++++++++ 10 files changed, 1103 insertions(+) create mode 100644 macros/latex/contrib/edfnotes/PdUsample.pdf create mode 120000 macros/latex/contrib/edfnotes/README create mode 100644 macros/latex/contrib/edfnotes/README.pdf create mode 100644 macros/latex/contrib/edfnotes/README.txt create mode 100644 macros/latex/contrib/edfnotes/SRCFILEs.txt create mode 100644 macros/latex/contrib/edfnotes/docsrc/README.tex create mode 100644 macros/latex/contrib/edfnotes/docsrc/edfnotes.tex create mode 100644 macros/latex/contrib/edfnotes/docsrc/srcfiles.tex create mode 100644 macros/latex/contrib/edfnotes/edfnotes.pdf create mode 100644 macros/latex/contrib/edfnotes/edfnotes.sty (limited to 'macros/latex/contrib/edfnotes') diff --git a/macros/latex/contrib/edfnotes/PdUsample.pdf b/macros/latex/contrib/edfnotes/PdUsample.pdf new file mode 100644 index 0000000000..4782b354e1 Binary files /dev/null and b/macros/latex/contrib/edfnotes/PdUsample.pdf differ diff --git a/macros/latex/contrib/edfnotes/README b/macros/latex/contrib/edfnotes/README new file mode 120000 index 0000000000..c3ca07460a --- /dev/null +++ b/macros/latex/contrib/edfnotes/README @@ -0,0 +1 @@ +README.txt \ No newline at end of file diff --git a/macros/latex/contrib/edfnotes/README.pdf b/macros/latex/contrib/edfnotes/README.pdf new file mode 100644 index 0000000000..42809c80b7 Binary files /dev/null and b/macros/latex/contrib/edfnotes/README.pdf differ diff --git a/macros/latex/contrib/edfnotes/README.txt b/macros/latex/contrib/edfnotes/README.txt new file mode 100644 index 0000000000..cc99cf4843 --- /dev/null +++ b/macros/latex/contrib/edfnotes/README.txt @@ -0,0 +1,41 @@ + README for the `edfnotes' package + critical annotations to footnote lines + (C) Uwe Lueck 2011/02/16 + + +`edfnotes.sty' extends `ednotes.sty' so that you can refer +even to footnotes of the edited work by line numbers, building +on the accompanying `fnlineno' package in the `lineno' bundle. + +KEYWORDs: critical editions; footnotes + +The package file `edfnotes.sty' and the documentation files +`edfnotes.pdf' and `edfnotes.tex' can be redistributed and/or +modified under the terms of the LaTeX Project Public License; +either version 1.3c of the License, or any later version, see + + http://www.latex-project.org/lppl.txt + +We did our best to help you, but there is NO WARRANTY. + +The `edfnotes' package is author-maintained in the sense of +this license. + +The latest public version of the package is available at + + http://mirror.ctan.org/macros/latex/contrib/edfnotes/ + +A TDS version of the package is available as + + http://mirror.ctan.org/install/macros/latex/contrib/edfnotes.tds.zip + +`edfnotes' requires at least `lineno.sty' and `fnlineno.sty' from +the `lineno' bundle, as well as `ednotes.sty', cf. + + http://ctan.org/pkg/ednotes + http://ctan.org/pkg/lineno + +Please report bugs, problems, and suggestions via + + http://www.contact-ednotes.sty.de.vu + diff --git a/macros/latex/contrib/edfnotes/SRCFILEs.txt b/macros/latex/contrib/edfnotes/SRCFILEs.txt new file mode 100644 index 0000000000..f95d6cfb2f --- /dev/null +++ b/macros/latex/contrib/edfnotes/SRCFILEs.txt @@ -0,0 +1,11 @@ + + *File List* +edfnotes.sty 2011/02/16 v0.6b annotations to footnote lines (UL) +edfnotes.tex 2011/02/22 documenting edfnotes.sty (UL) + README.tex 2011/02/24 make README.pdf +srcfiles.tex 2011/02/16 collect source file infos + *********** + + List made at 2011/02/24, 12:58 + from script file srcfiles.tex + diff --git a/macros/latex/contrib/edfnotes/docsrc/README.tex b/macros/latex/contrib/edfnotes/docsrc/README.tex new file mode 100644 index 0000000000..596cc96387 --- /dev/null +++ b/macros/latex/contrib/edfnotes/docsrc/README.tex @@ -0,0 +1,12 @@ +\ProvidesFile{README.tex}[2011/02/24 make README.pdf] +\listfiles + +\documentclass[12pt]{article} +\usepackage{verbatim} +\pagestyle{empty} +\begin{document} +\vspace*{-3\baselineskip} %% 3 2011/02/24 +\enlargethispage{2\baselineskip} +% \small %% 2011/02/14 +\verbatiminput{README.txt} +\end{document} diff --git a/macros/latex/contrib/edfnotes/docsrc/edfnotes.tex b/macros/latex/contrib/edfnotes/docsrc/edfnotes.tex new file mode 100644 index 0000000000..5e83218954 --- /dev/null +++ b/macros/latex/contrib/edfnotes/docsrc/edfnotes.tex @@ -0,0 +1,114 @@ +\ProvidesFile{edfnotes.tex}[2011/02/22 documenting edfnotes.sty (UL)] +\title{\textsf{edfnotes.sty}\\---\\Critical Annotations to Footnote + Lines\thanks{This document describes version + \textcolor{blue}{\UseVersionOf{edfnotes.sty}} + of \textsf{edfnotes.sty} as of \UseDateOf{edfnotes.sty}.}} +% \listfiles +{ \RequirePackage{makedoc}[2010/12/20] \ProcessLineMessage{} + \MakeJobDoc{19}{\SectionLevelThreeParseInput} %% 2010/12/16 +} +\documentclass{article}%% TODO paper dimensions!? +\input{makedoc.cfg} %% shared formatting settings +% \providecommand*{\strong}{\textbf} %% 2010/12/15 +%% 2011/01/01: +\newcommand*{\setoffbox}{\\[\smallskipamount]} +\newcommand*{\SOB}{} \let\SOB\setoffbox %% or let |...| redefine ... +\ReadPackageInfos{edfnotes} +\usepackage{color} +\makeatletter \@beginparpenalty\@lowpenalty \makeatother +\sloppy +\begin{document} +\maketitle +\begin{abstract}\noindent +'edfnotes.sty' extends +\CtanPkgRef{ednotes}{ednotes.sty}\urlpkgfoot{ednotes} %% 2011/02/16 +so that you can refer even to \emph{footnotes} +of the edited work by line numbers, +%% 2011/01/01: +building on the accompanying 'fnlineno' package in the +\ctanpkgref{lineno} bundle.\urlpkgfoot{lineno} +%% rm. 2011/02/09: +% %% 2011/01/08: +% While version v0.1 of 'ednotes' +% just aimed at not loosing annotations to footnotes +% and v0.2 aimed at printing annotations to main text +% earlier than annotations to footnotes, +% v0.3 aims at starting an annotation to a footnote +% on the same page where the annotated passages starts. +% %% 2011/01/19: +% v0.4 introduced `\clearfootnoteannotations'. +% v0.5 fixes a basic mistake from v0.2 and aims at +% more transparent code, including a re-implementation +% of 'ednotes'' core macro. +% v0.6 re-implements v0.2 in the sense that, when +% lemmas move among pages, the annotations needn't wander +% to the end of the edition as often as with v0.2 through v0.5. +'ednotes.sty' has addressed ``scholarly" critical editions +of (hand-written) manuscripts. +%% 2011/02/10: +'edfnotes' additionally supports critical editions of +(printed) \emph{works with footnotes.} +The package was developed for an edition of +\Wikienref{Bernard Bolzano}'s +\textit{Paradoxien des Unendlichen} by Prof.\ Dr.\ Dr.\ Christian +Tapp---a work with some very long footnotes. + +%% moved etc. 2011/02/14: +As to \emph{implementation}, +%% added 2011/02/22: +'edfnotes' modifies 'ednotes'' annotation commands +and label-test mechanism so that the latter does not break +and the former place critical notes on the pages and +in the order as one naturally expects (not so easy with footnotes). +Certain core parts of 'ednotes' have been re-implemented entirely, +this may later migrate into 'ednotes' itself. +It had been hoped that 'edfnotes' could build on the +\ctanpkgref{bigfoot} package.\urlfoot{CtanPkgRef}{bigfoot} +This might have improved (automatic) page breaking and placement +of original footnotes and critical annotations +(whereas at present, some page breaks need manual trial-and-error + solutions). +However, analysis of 'lineno' and 'ednotes' for extending them, +as well as many unexpected difficulties, +exhausted project resources too early. +David Kastrup's `\MakeSorted' +(or `\MakeSortedPerPage', actually from + \ctanpkgref{perpage})\urlpkgfoot{perpage} +has here been implemented +by `\insert'ing annotations to footnotes at the last main text line of +a page only, hooking into 'lineno''s numbering mechanism---a +nice (``leight-weight"---?) alternative to David Kastrup's approach. + \par\smallskip\noindent +\strong{Keywords:}\quad critical editions; footnotes +\end{abstract} + \newpage +\tableofcontents + +\section{Usage and Features} +\subsection{Package File Header (Legalize)} +\input{edfnotes.doc} +\section{Example} %% 2011/02/14 +The file `PdUsample.pdf' +% (belonging to documentation, `docint/' directory) %% rm. 2011/02/16 +shows results with a very long +(original, edited) footnote in +\Wikienref{Bernard Bolzano}'s +\textit{Paradoxien des Unendlichen}, +with critical annotations by Christian Tapp. +\end{document} + +VERSION HISTORY + +2010/12/31 very first +2011/01/01 \SOB +2011/01/03 \newpage +2011/01/07 \strong +2011/01/08 for v0.3; `\jobname' replaced by `edfnotes' +2011/01/16 changed page breaking +2011/01/19 for v0.5 +2011/02/02 for v0.6 +2011/02/09 for public presentation +2011/02/10 abstract changed/extended; example PdUsample.pdf; + wiki link for Bolzano +2011/02/16 link to ednotes bundle, rm. `docint/' +2011/02/22 clarification in abstract diff --git a/macros/latex/contrib/edfnotes/docsrc/srcfiles.tex b/macros/latex/contrib/edfnotes/docsrc/srcfiles.tex new file mode 100644 index 0000000000..7a6d242f34 --- /dev/null +++ b/macros/latex/contrib/edfnotes/docsrc/srcfiles.tex @@ -0,0 +1,6 @@ +\RequirePackage{myfilist} +\ProvidesFile{srcfiles.tex}[2011/02/16 collect source file infos] +\EmptyFileList %%% [readprov.sty,myfilist.sty] +\ReadPackageInfos{edfnotes} +\ReadFileInfos{edfnotes,README,srcfiles} +\ListInfos[SRCFILEs.txt] diff --git a/macros/latex/contrib/edfnotes/edfnotes.pdf b/macros/latex/contrib/edfnotes/edfnotes.pdf new file mode 100644 index 0000000000..cc36cb8ce7 Binary files /dev/null and b/macros/latex/contrib/edfnotes/edfnotes.pdf differ diff --git a/macros/latex/contrib/edfnotes/edfnotes.sty b/macros/latex/contrib/edfnotes/edfnotes.sty new file mode 100644 index 0000000000..98742de9e7 --- /dev/null +++ b/macros/latex/contrib/edfnotes/edfnotes.sty @@ -0,0 +1,918 @@ +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{edfnotes}[2011/02/16 v0.6b + annotations to footnote lines (UL)] + +%% Copyright (C) 2010 2011 Uwe Lueck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% We did our best to help you, but there is NO WARRANTY. +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% {\it This work has been supported %% rm. `partially' 2011/02/14 +%% by the Deutsche Forschungsgemeinschaft (DFG), +%% organized %% 2010/12/18 TODO!? +%% by Prof.~Dr.\ Dr.\ Christian Tapp +%% at Ruhr-Universit\"at Bochum, Germany.} +%% %% 2011/01/14: +%% Christian also participated immensely in development +%% by creating really small failure examples for debugging. +%% %% 2011/01/17: +%% Completing the work was possible thanks to a loan +%% from my mother, Mrs.~Renate L\"uck. +%% +%% === Known Issues === +%% Please note the following difficulties you may experience +%% with 'edfnotes', and what to do about them: +%% \begin{enumerate} +%% \item In certain situations, ``\strong{hanging}" of the `latex' +%% run has been observed. +%% As to \emph{implementation}, %% 2011/02/14 +%% it has not been analysed completely yet (TODO), +%% but it occurred with `\marginpar' and printing the second +%% part of a footnote before its first part---a well-known +%% \LaTeX\ bug, +%% ``\strong{footnote placement disaster}." +%% However, this situation usually does not +%% lead into ``hanging," rather replacing `=' by \verb+>+ +%% in the definition of `\EFN@annot' with package version +%% v0.6 (to keep ``displaced" annotations from wandering +%% to the last page) seems to cause the hang when a +%% ``footnote placement disaster" occurs +%% (where the footnote has annotations). +%% +%% \strong{You must be careful with marginals anyway}---with +%% critical editions. There also is the problem with +%% placement in the wrong margin. Mistakes of the named kinds +%% occur rather \emph{usually} in critical editions. +%% With \emph{annotations to footnotes} things may become +%% even worse, since placement restrictions +%% (``start note on same page as target") +%% may become difficult or impossible to +%% satisfy.\footnote{These advices should appear in +%% 'ednotes' already---TODO!}%% 2011/02/10 +%% +%% Often, just manual `\pagebreak's (in the last line of a +%% page---when near completion of the work) help. +%% +%% The \ctanpkgref{mparhack} package\urlpkgfoot{mparhack} at least +%% ensures that marginals appear in the appropriate margin. +%% +%% ``Footnote placement disasters" can be avoided (at some cost) +%% by the \ctanpkgref{tamefloats} package\urlpkgfoot{tamefloats} +%% (helped sometimes, did not help with +%% \textit{Paradoxien des Unendlichen}). +%% Another possibility for avoiding footnote placement disasters +%% due to `\marginpar' is using `\marginnote' from the +%% \ctanpkgref{marginnote} package\urlpkgfoot{marginnote} +%% instead. +%% +%% However, `\marginnote' behaves badly when, e.g., page breaks +%% in two sources appear in the same line of the edition. +%% On the other hand, `\marginpar' ``moves" the second marginal, +%% which is not much better. I would prefer a ``manual" +%% solution: inserting the page break symbols within the +%% line manually and produce a single `\marginpar' or +%% `\marginnote' entry for both of them. +%% (Actually, this could be automated within 'lineno'.) +%% +%% \item \strong{Page break oscillations:} \ +%% 'ednotes.sty' provides a message about page break +%% oscillations that gives advice how to fix them. +%% With annotations to footnotes, that advice may help only +%% little. Besides fixing the page break in main text, +%% it may be needed to place `\pagebreak' +%% (or `\warningpagebreak') commands in footnotes too. +%% While the oscillation of main text lines is fixed +%% (for the page about the message reports), +%% page breaks of footnotes may keep oscillating. +%% I was successful in a test case +%% (that giant footnote in \textit{Paradoxien des Unendlichen}) +%% by placing a `\pagebreak' in the footnote text quite +%% early first and then moved it down line by line, +%% until the result became bad. At that point, I chose +%% the previous position of `\pagebreak'. +%% The result is presented as `PdUsample.pdf'. +%% % (part of documentation, `docint/' directory). %% rm. 2011/02/16 +%% +%% \item For \strong{other Limitations}, please see the section +%% in 'fnlineno.pdf' of this title. +%% \end{enumerate} +%% +%% === Installing and Calling === +%% The file 'edfnotes.sty' is provided ready, installation only requires +%% putting it somewhere where \TeX\ finds it +%% (which may need updating the filename data +%% base).\footnote{\url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf}} +%% +%% As usually, 'edfnotes.sty' is loaded by +%% % \begin{verbatim} +%% `\usepackage{edfnotes}' +%% % \end{verbatim} +%% below the `\documentclass' line %% 2011/01/13 +%% (after loading 'ednotes') +%% and before `\begin{document}'. +%% 'edfnotes' does not offer any package options. +%% +%% This should suffice just to get the advertised functionality. +%% There are \emph{two} user commands |\ForceFootnoteAnnotations| +%% and |\clearfootnoteannotations| +%% described in section~\ref{sec:enddoc}. +%% +%% %% 2011/02/16: +%% Minimum functionality of 'edfnotes' requires that +%% \CtanPkgRef{ednotes}{ednotes.sty}, +%% \CtanPkgRef{lineno}{fnlineno.sty}, and +%% \CtanPkgRef{lineno}{lineno.sty} are installed and ``visible." +%% For more functionality, see the descriptions of both +%% bundles.\urlpkgfoot{ednotes}\urlpkgfoot{lineno}. +%% +%% +%% \pagebreak %% 2011/02/16 +%% == Implementation == +%% === Loading Required Package === +%% The package builds on 'fnlineno''s ability to +%% number footnote lines and processing `\linelabel' there. +%% So we load it. %%% (TODO or `\AtBeginDocument'?): +%% We need a version without earlier tries at supporting +%% 'edfnotes.sty' v0.2: +\RequirePackage{fnlineno}[2011/01/07] +%% +%% === Overview of Processing Levels === +%% %% new 2011/01/18 +%% 'ednotes'' and 'edfnotes'' apparatus entries +%% are handled by the 'manyfoot' package. +%% An entry for apparatus level +%% is passed to 'manyfoot' by 'manyfoot''s command +%% |\Footnotetext\@empty{}|. +%% +%% In terms of \TeX's hard-wired mechanisms, +%% such a `\Foonotetext' command issues an `\insert' +%% command. `\insert' is a so-called ``primitive," +%% hard-wired command. It typesets the entry +%% and stores the result internally, and in choosing +%% the next page break, \TeX\ will try to start +%% the typesetting result of on the ``current" page. +%% +%% \TeX\ is not so well-prepared (\strong{hard-wired}) +%% for placing a footnote (its beginning) +%% intended to refer to a passage +%% in another footnote on the same page as that passage +%% (starts). +%% Our \strong{hard-weird} macros build an own mechanism +%% using the `.aux' file in order to manage this. +%% A footnote to a footnote is not directly passed to +%% 'manyfoot', such ``secondary" footnotes are rather +%% withhold and collected in a list from which +%% 'edfnotes' will later decide what to do with them. +%% The goal is to find a good point for finally passing +%% to 'manyfoot' such that \TeX\ will be able to place +%% and appropriately. +%% +%% In the most basic application of 'edfnotes', +%% there is \emph{one} critical apparatus referring both +%% to the main text and to the footnotes of an edited text. +%% We want that, in the apparatus, +%% annotations to \emph{main text} lines +%% precede annotations to \emph{footnote} lines. +%% To achieve this, the idea is to issue the +%% `\Footnotetext' commands for annotations to footnotes +%% only at \emph{last main text lines} of pages. +%% +%% Unfortunately, sometimes the `.aux' file provides +%% either \emph{no} or \emph{wrong} information for +%% identifying that last line. Therefore, we sometimes +%% \emph{skip} the item-by-item procedure that tries to pair +%% with , and instead somewhere pass \emph{all} the +%% items in that list to 'manyfoot' +%% and \TeX's primitive `\insert' command. +%% This will be just a kind of ``emergency" routine, +%% considered necessary temporarily, while hoping that +%% the required and correct information will appear +%% in the `.aux' file some runs later. +%% +%% \pagebreak %% 2011/02/16 +%% === Postponing Annotations === +%% ==== Goal and Strategy ==== +%% Version v0.2 of 'edfnotes' used +%% `\@EN@hookfn{}'---that is called from 'ednotes'' +%% `\@EN@putdown'---in order to intercept %%% and collect +%% 'manyfoot''s `\FootnotetextA' etc. commands that +%% execute \TeX's `\insert' commands for 'ednotes'' annotations. +%% `\@EN@hookfn' has the trivial meaning `\@firstofone' in 'ednotes' +%% and is only activated by 'edtable.sty' ('lineno' bundle) +%% in order to collect annotations to a tabular environment +%% at the latter's ``footnote hook" that finally executes +%% the `\insert' commands. These annotations +%% are inserted to the \emph{current} page, i.e., +%% all the annotations collected there +%% start on the same page. +%% +%% This behaviour (starting on the same page) +%% is in general not adequate with annotations to footnotes +%% when the latter are split and continued at later pages. +%% If a footnote starts at page~$p$, is continued on +%% page~$p+1$, and a passage of it on page~$p+1$ gets a +%% critical annotation, that annotation should start on +%% page~$p+1$, not on page~$p$. The footnote may also get +%% an annotation to its page~$p$ part, that one should start +%% at page $p$ indeed. The mechanism we have to introduce here +%% must be able to tell these two cases apart. +%% For each annotation to a footnote, it must retrieve the +%% page which the annotation refers to. +%% +%% Interception at 'ednotes'' `\@EN@hookfn' now becomes too clumsy. +%% We redefine +%% \[|\@EN@putdown{}{}{}{}|\] +%% entirely, replacing its former `\@EN@hookfn' section +%% by a new macro +%% \[|\@EN@appentry{}{}{}{}|\] +%% i.e., taking the same arguments as `\@EN@putdown'. +%% is a string that is used to write commands +%% `\newlabel{-}{}', `\newlabel{+}{}', +%% and `\newlabel{}{}' to the `.aux' file. +%% From these commands, the next run builds a macro containing +%% placement informations for that annotation with ID . +%% contains the page on which the annotated passage +%% starts. This is where the annotation \emph{should} start +%% as well. It just contains the ``public" (``relative") page number, +%% as opposed to ``absolute" page numbers that 'lineno.sty' +%% traces through `\c@LN@truepage'. Well, the minute chance +%% of failure arising from this difference should be +%% acceptable for the present attempt at equipping 'edfnotes' +%% with functionality adequate for real life. +%% +%% ==== Re-implementation of \cs{@EN@putdown} ==== +%% |\@EN@putdown| ... +\long\def\@EN@putdown#1#2#3#4{% +% #1 label, #2 note family, #3 lemma tag, #4 note. +% \long note/lemma!? + \linelabel{-#1}% Ensures hmode. +%% `\insert' apparatus entry: + \@EN@appentry{#1}{#2}{#3}{#4}% +%% Lemma in main text: + \nobreak \hskip\z@skip %% 2006/01/12 cf. german.sty: \allowhyphens + \@EN@lemmaarg %% Should not end with space so \linelabel... + %% \allowhyphens not needed here (tested) 2006/01/12 + \linelabel{+#1}% + % \csname #1rightmark\endcsname %% Suggested. +} +%% |\@EN@appentry| ... +\def \@EN@appentry #1#2#3#4{% + \csname Footnotetext#2\endcsname\@empty{% + \csname#2notefmt\endcsname + \let\@currentlabel\@empty + \label{#1}% Need page number of note. + \let\nopunct\@gobble % or by \if... +%% Print line numbers: + \@ifundefined{r@#1}% + {\differentlines\@EN@unknown\@EN@unknown}% + {\let\@EN@incomplete@ref\relax + \@EN@xpxpxp \@EN@extract\csname r@#1\endcsname + \@EN@incomplete@ref\@EN@incomplete@ref + \@EN@incomplete@ref\@EN@incomplete@ref + \ifx\@EN@elemp\@EN@Incomplete + \G@refundefinedtrue + \let\@EN@incomplete@ref\@EN@unknown + \fi + \@tempswatrue + \ifx\@EN@bleml\@EN@eleml \else \@tempswafalse \fi +%% Restart of line numbers / different page!? + \ifx\@EN@blemp\@EN@elemp \else \@tempswafalse \fi + \if@tempswa + \sameline{\@EN@plref\@EN@blemp\@EN@bleml}% + \else + \@EN@lastline@z@ + \differentlines{\@EN@plref\@EN@blemp\@EN@bleml}% + {\ifx\@EN@blemp\@EN@elemp + \@EN@eleml + \else + \pageandline\@EN@elemp\@EN@eleml + \fi}% + \@EN@lastline@z@ + \fi}% + \lemmafmt{{\@EN@lemmaexpands#3}}% + \notefmt{#4}% + }% +}% +%% A copy |\EFN@@appentry| for the case that +%% `\@EN@appentry' is redefined by `\FNLN@text': +\let \EFN@@appentry \@EN@appentry +%% +%% ==== Basic Changes ==== +%% We patch the patch of `\@footnotetext' again ... +%% |\EFN@@text| stores 'fnlineno''s variant |\FNLN@text| +%% of \LaTeX's `\@footnotetext': +\let \EFN@@text \FNLN@text +%% A hook |\EFN@annot@hook| will collect and +%% handle annotations to the footnotes of a page. +%% It will be changed globally: +\global\let \EFN@annot@hook \@empty +%% |\EFN@move{}{}{}{}| +%% will move an annotation into the (next ...\,) hook: +\def \EFN@move #1#2#3#4{% + \g@addto@macro\EFN@annot@hook{\EFN@annot{#1}{#2}{#3}{#4}}} +%% The new |\FNLN@text| will redefine `\@EN@appentry' +%% in order to redirect the annotation: +\renewcommand\FNLN@text[1]{\EFN@@text{\let\@EN@appentry\EFN@move #1}} +%% +%% === Inserting Annotations to Footnotes === +%% ==== Strategy ==== +%% Version v0.2 of 'edfnotes.sty' aims at proper \strong{sorting} +%% of the annotations, in the sense that in the critical apparatus, +%% notes on \emph{main text} lines appear before all notes +%% to \emph{footnote} lines. +%% +%% David Kastrup's 'bigfoot' and 'perpage' packages +%% seem to deal with this task +%% (however, the documentation doesn't help much in +%% making use of it); on the other hand, +%% 'lineno.sty' offers its own nice tools ... +%% +%% Our idea is inserting all the \emph{annotations to footnotes} +%% right after the \emph{last main text line of the page}---this +%% way they should appear \emph{after} all annotations to main text lines. +%% (This idea grew with v0.2, and with v0.3 it became clear +%% this hook can be used for passing certain annotations +%% to the next page.) +%% % ; `samepage@hook' then turned into `annot@hook'.) +%% %% <- indeed 2011/01/17 +%% +%% For version v0.3, this is refined a little. +%% The hook will not actually `\insert' all annotations, +%% it will rather choose some for immediate insertion +%% and collect the remaining annotations +%% in the hook for the next page. +%% +%% We use |\MakeLineNo| from 'lineno.sty' for hooking in here +%% (you may find the context relevant here in `fnlineno.pdf'). +%% `\MakeLineNo'---in ``pagewise" mode +%% that we assume here---has access to the absolute number +%% of the last numbered line of the current page, +%% involving 'lineno.sty''s |\testLastNumberedPage|. +%% We modify the latter so that it records that number as +%% |\theLastLineNumber|. +%% % (I tried more efficient things +%% % involving a switch, failed terribly, +%% % no idea what was going on.) %% 2011/01/07 +%% ==== Deciding ==== +%% |\EFN@run@annot@hook| first expands `\EFN@annot@hook', +%% then empties it, +%% and while the version for the recent page runs, +%% the version of |\EFN@annot@hook| for the \emph{next} page +%% may be built, containing annotations to footnote passages +%% on later pages: +\def \EFN@run@annot@hook {% + \expandafter \global \expandafter \let + \expandafter \EFN@annot@hook \expandafter \@empty + \EFN@annot@hook} +%% |\EFN@annot@hook| (unless empty) is a list of commands +%% \[|\EFN@annot{}{}{}{}|\] +%% that were issued either by `\@EN@putdown' or by the previous +%% version of `\EFN@run@annot@hook' using `\EFN@move'. +%% `\EFN@annot' uses to determine the page number where +%% the footnote passage the annotation refers to starts. +%% There are \emph{three} cases deciding about immediate `\insert'ion +%% vs.\ postponing. The annotation is `\insert'ed immediately +%% if \emph{either} has not been used in the previous run +%% (it contains an annotation number exceeding the earlier +%% number of annotations---minus one) \emph{or} +%% if the annotation was placed on the ``current" page +%% in the run before. In these cases, the four arguments of +%% `\EFN@annot' are run by |\EFN@@appentry|. \emph{Otherwise} +%% the annotation is deferred by running the four arguments +%% with |\EFN@move|. +\def \EFN@annot #1{% + \let \EFN@next \EFN@@appentry +%% I.e., immediate `\insert'ion is the ``default." +%% `undefined' in the next line means there is no placement +%% information from the previous run +%% (stored as `\r@'). If there is, it is +%% extracted by `\@EN@extract', `\@EN@blemp' will carry the +%% ``public" (relative) page number. + \@ifundefined{r@#1}\relax{% + \@EN@xpxpxp \@EN@extract \csname r@#1\endcsname + \relax \relax \relax \relax %% somewhat lazier than ednotes +%% If the page numbers don't match, we `move'. +%% With v0.6 however, we don't `move' when we have +%% ``missed" the (according to `.aux') +%% matching page. This happens when +%% the passage we are referring to moves to later pages. +% \ifnum \@EN@blemp=\c@page %% TODO \ifx\relax!? \c@page OK? +% \else + \ifnum \@EN@blemp>\c@page %% v0.6 + \let \EFN@next \EFN@move + \fi }% + \EFN@next{#1}% +} +%% +%% ==== Normal Insertion ==== +%% The ``normal" way of inserting annotations to footnotes +%% is a call from the extended `\MakeLineNo' +%% involving testing whether the line is the last +%% numbered one on the page. It seems not to have been +%% easily accessible with 'lineno.sty', we are extending +%% the latter's |\testLastNumberedPage| so it stores +%% that number as |\theLastLineNumber|. +%% Indeed, calculating the ``pagewise" line number +%% in `\MakeLineNo' invokes a series of tests +%% that finally calls \[`\testLastNumberedPage{}'\] +%% where is the least ``last" line number of a +%% page with numbered lines that is greater than or +%% equal to the current absolute line number. +\def\testLastNumberedPage#1{\ifnum#1<\c@linenumber + \let\firstLN\@gobble + \fi + %% both tests new 2011/01/15, + %% not sure about efficiency TODO: +% \if@FNLN@sw@ \else +% <- don't run with \getfoot...! 2011/01/19 -> + \ifx\c@linenumber\c@pagewiselinenumber + \ifnum\theLastLineNumber=#1\relax \else + \gdef\theLastLineNumber{#1}% %% mod. 2011/01/07! + \fi \fi } +%% 'lineno''s |\MakeLineNo| is extended using that +%% `add' macro from 'ednotes'. It will +%% test if the line just numbered is a main text line and +%% the last numbered one on the page, and only then +%% call the `\insert's from 'manyfoot' for the critical +%% apparatus.---With v0.5, we actually extend %% 2011/01/19 +%% |\stepLineNumber| that `\MakeLineNo' invokes. +%% Appending `\insert'ions to `\MakeLineNo' creates +%% a strong risk that it is executed on the \emph{next} +%% page. (So this requires a certain version of 'lineno.sty', +%% and the latter might better provide an ``official" hook. +%% \emph{Prepending} to `\MakeLineNo' in v0.34 failed +%% because `\theLastLineNumber' may be wrong there.) +\@EN@addtomacro \stepLineNumber {% + \if@FNLN@sw@ \else + \ifx\EFN@annot@hook\@empty \else %% 2011/01/14 efficient!? TODO + \advance\c@linenumber\m@ne %% local to \output 2011/01/16 + \ifnum\theLastLineNumber=\c@pagewiselinenumber + \EFN@run@annot@hook + \fi \fi \fi } +%% +%% ==== Forced Insertion ==== +%% \paragraph{1.} At an \strong{initial run} +%% of the document (no `.aux' present), +%% there isn't any information about line number ranges for pages. +%% We then `\insert' everything immediately so that an initial run +%% at least produces page breaks that are useful for ordering +%% annotations in the next run. This is achieved by choosing +%% a default definition for |\theLastLineNumber| that +%% trivially renders the `\ifnum' test in `\MakeLineNo' `\iftrue'. +\@ifdefinable \theLastLineNumber {% + \let \theLastLineNumber \c@pagewiselinenumber} +%% \paragraph{2.} Another problem may occur with the +%% \strong{very last line} of an edition. +%% When between two \LaTeX\ runs the number of +%% main text lines is reduced (e.g., one has removed +%% wrong text or has improved line breaking by a manual +%% change of hyphenation), the annotations for the last +%% page may get lost because the line number that the +%% insertions wait for doesn't occur any more. They will +%% then get lost, and their `\newlabel' entries in the +%% `.aux' file will be missing, perhaps resulting in +%% other errors. We provide a command +%% |\ForceFootnoteAnnotations| for manual use by authors +%% or for being added to certain hooks. It might be +%% added to `\nolinenumbers' and `\endlinenumbers', +%% but I am not sure ... +%% +%% v0.5 allows a much cleaner implementation of +%% `\ForceFootnoteAnnotations' than we had in v0.35 and v0.4: +\newcommand* \ForceFootnoteAnnotations {{% + \let\EFN@annot\EFN@@appentry + \EFN@run@annot@hook}} +%% \paragraph{3.} Finally it may occur that a +%% %% \strong 2011/01/19: +%% \strong{chapter ends} with a very +%% \strong{long footnote} with annotations +%% to all of its pages, and the editor decides +%% that the footnotes should fill the final pages +%% of the chapter without main text on their pages. +%% Then the annotations have problem with our +%% approach of v0.3. +%% % +%% A similar problem could be that a short end +%% of the last footnote of a chapter +%% gets remarks of several pages that the editor +%% doesn't want to see in the following chapter +%% (e.g., when there isn't any following chapter). +%% +%% We therefore provide a command +%% |\clearfootnoteannotations| +%% that creates dummy page entries for those final pages. +%% Of course, these dummy page entries must not be +%% numbered like lines ... +%% +%% The first version of the macro worked fine with a +%% two-page footnote, but crashed as soon as a main text line +%% was removed. (Infinitly many pages are created then ...\,) \ +%% This is just the problem that was addressed by +%% |\ForceFootnoteAnnotations|. But it would be very wrong to use +%% `\ForceFootnoteAnnotations' for the present problem, +%% because this would move the annotations for the next +%% footnote-only pages to the next page with numbered +%% main text, or to the end of the entire document. %% tested 2011/01/17 +%% +%% The problem has then been %% `en' 2011/01/19 +%% solved by inserting `\EFN@run@annot@hook'; %% `;' 2011/01/19 +%% however, +%% in reasoning about it, about former failures, about the `\par', +%% it seems to become clear that this is a solution for Christian's +%% `Test13.tex' as of 2011/01/16 after a footnote that closes a +%% paragraph and a main text page at the same time---only, +%% while ... +\newcommand* \clearfootnoteannotations {% + \par %% TODO!? the whole only via \MakeLineNo!? + %% doesn't work without \par + \EFN@run@annot@hook + \loop \ifx\EFN@annot@hook\@empty \else + \pagebreak %% TODO!? \newpage? \clearpage? + %% leave to user before? + \write\m@ne{}\vbox{}%% TODO!? from \clearpage + \EFN@run@annot@hook + \repeat + %% TODO: \clearpage!? may come from \chapter +} +%% TODO: What if pages are removed? What if annotations are inserted +%% or removed? So far, ... +%% +%% === 'ednotes'' &\newlabel\ variant === +%% 'ednotes' changes \LaTeX's `\newlabel' so that three +%% `\newlabel' entries in the `.aux' file build only +%% \emph{one} macro containing the information needed +%% for typesetting \emph{one} annotation in the apparatus. +%% %% 2011/01/11: +%% Both that building mechanism and the change testing +%% at the final run of the new `.aux' file +%% don't work with 'edfnotes.sty'. +%% To repair this, I needed much time to understand +%% those mechanisms again. I found that they were quite +%% redundant and now am re-implementing them almost +%% entirely. +%% +%% ==== Suppressing the ``&\get\,..." Commands ==== +%% %% reworded 2011/01/11: +%% 'lineno' must suppress expansion of |\getpagewiselinenumber| +%% when the `.aux' file is read. +%% With 'fnlineno.sty', |\getfootnotelinenumber| +%% must be prevented from expansion as well. Both macros are +%% activated at `\begin{document}' only +%% when reading the `.aux' has been finished. +%% +%% With 'fnlineno.sty', both macros are accessed as +%% |\getwiselinenumber|, %% 2011/01/03 +%% so we just need to switch `\getwiselinenumber': +% \let\EFN@getlineno\getwiselinenumber +% \let\getwiselinenumber\@gobble +% \AtBeginDocument{\let\getwiselinenumber\EFN@getlineno} +%% %% 2011/01/03: +%% On the other hand, 'ednotes' deals with +%% `\getpagewiselinenumbers' already, so we only ... +%% saves one expansion for each footnote line! +\let \EFN@getfnlineno \getfootnotelinenumber +\let \getfootnotelinenumber \relax +\AtBeginDocument{\let \getfootnotelinenumber \EFN@getfnlineno} +%% By analogy to 'ednotes'' `\AtEnd'\,...\,: +\AtEndDocument{\let\getfootnotelinenumber\relax} +%% ==== &\newlabel\ Building Info Macros ==== +%% %% 2011/01/10: +%% For version v0.3 of 'edfnotes', it turns out that +%% 'ednotes'' (v1.1--1.3) mechanism for building the +%% note info macros `\r@EN@l' assumes that +%% \[`\newlabel{-EN@l}{}'\] +%% will appear before +%% \[`\newlabel{+EN@l}{}'\] +%% and +%% \[`\newlabel{EN@l}{}'\] +%% in the `.aux' file. +%% With 'edfnotes' v0.3, an annotation to the second page +%% of a long footnote will be `\insert'ed on the previous +%% page in a ``first" run (no `.aux' present) due to the +%% missing placement information. +%% 'ednotes'' `\newlabel' mechanism then looses the +%% note placement information, and a ``missing number" +%% error occurs. +%% +%% To fix this, we modify 'ednotes'' +%% |\@EN@addtolabeldef| so that at the first step of +%% the recursive building of `\r@EN@l', +%% the latter is not used as input (as a part). +%% Then the tricky `\@gobble' in the first case of 'ednotes'' +%% redefinition of |\newlabel| (see the recent presentation +%% of the code---currently [2011/01/10] `ednotesc.pdf') +%% can be replaced by the obvious empty argument. +%% +%% With the former implementation in 'ednotes', +%% I had already wondered if I couldn't postpone +%% reading the second argument of +%% |\newlabel{