diff options
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el | 261 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf | bin | 830931 -> 930575 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf | bin | 17995 -> 18006 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/ekdosis/Makefile | 16 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx | 1468 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua | 241 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty | 394 |
9 files changed, 2041 insertions, 345 deletions
diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/README.md b/Master/texmf-dist/doc/lualatex/ekdosis/README.md index 51a1e595e6b..0fef027f196 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/README.md +++ b/Master/texmf-dist/doc/lualatex/ekdosis/README.md @@ -62,7 +62,7 @@ This release of ekdosis consists of the following source files: License Applicable to the Documentation --------------------------------------- -Copyright ⓒ 2020 Robert Alessi +Copyright ⓒ 2020--2021 Robert Alessi The documentation file `ekdosis.pdf` that is generated from the `ekdosis.dtx` source file is licensed under the GNU Free Documentation diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el index 74d6bf1745c..845c004aef7 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el +++ b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.el @@ -24,7 +24,11 @@ (defvar LaTeX-ekdosis-preamble-options '(("parnotes" ("true" "false" "roman")) ("teiexport" ("true" "false" "tidy")) - ("layout" ("float" "footins"))) + ("layout" ("float" "footins" "keyfloat" "fitapp")) + ("divs" ("ekdosis" "latex")) + ("poetry" ("verse")) + ("parnotes" ("true" "false" "roman")) + ("teiexport" ("true" "false" "tidy"))) "Package options for the ekdosis package.") (defun LaTeX-ekdosis-package-options () @@ -42,37 +46,66 @@ (TeX-read-key-val optional arg) optional))) +(defvar LaTeX-ekdosis-ekdsetup-options + '(("showpagebreaks" ("true" "false")) + ("spbmk") + ("hpbmk")) + "List of local options for ekdsetup macro.") + (defvar LaTeX-ekdosis-declarewitness-options '(("settlement") + ("institution") ("repository") + ("collection") + ("idno") ("msName") ("origDate") - ("idno")) + ("locus")) "List of local options for DeclareWitness macro.") +(defvar LaTeX-ekdosis-declarehand-options + '(("note")) + "List of local options for DeclareHand macro.") + +(defvar LaTeX-ekdosis-declarescholar-options + '(("rawname") + ("forename") + ("surname") + ("addname") + ("note")) + "List of local options for DeclareScholar macro.") + (defvar LaTeX-ekdosis-app-options '(("type")) "Local option for app|note macro.") (defvar LaTeX-ekdosis-lem-options '(("wit") + ("source") + ("resp") ("alt") ("pre") ("post") ("prewit") ("postwit") ("sep") + ("type") + ("num") + ("nonum") ("nolem" ("true" "false")) ("nosep" ("true" "false"))) "Local options for lem macro") (defvar LaTeX-ekdosis-rdg-options '(("wit") + ("source") + ("resp") ("alt") ("pre") ("post") ("prewit") ("postwit") + ("type") ("nordg" ("true" "false"))) "Local options for rdg macro.") @@ -82,6 +115,9 @@ ("labelb") ("labele") ("sep") + ("nosep") + ("num") + ("nonum") ("pre") ("post")) "Local options for note macro.") @@ -91,6 +127,93 @@ ("post")) "Local options for note* macro.") +(defvar LaTeX-ekdosis-rdggrp-options + '(("type")) + "Local options for rdgGrp macro.") + +(defvar LaTeX-ekdosis-setcritsymbols-options + '(("suppbegin") + ("suppend") + ("delbegin") + ("delend") + ("sicbegin") + ("sicend") + ("gapmark")) + "List of local options for setcritsymbols macro.") + +(defvar LaTeX-ekdosis-sethooks-options + '(("appfontsize") + ("refnumstyle") + ("postrefnum") + ("lemmastyle") + ("readingstyle") + ("initialrule") + ("noinitialrule") + ("keyparopts") + ("appheight") + ("fitalgorithm" ("fontsize" "hybrid" "areasize" "squeeze"))) + "List of local options for sethooks macro.") + +(defvar LaTeX-ekdosis-gap-options + '(("reason") + ("unit") + ("quantity") + ("extent")) + "List of local options for gap macro.") + +(defvar LaTeX-ekdosis-setapparatus-options + '(("direction" ("LR" "RL")) + ("sep") + ("delim") + ("bhook") + ("ehook") + ("rule") + ("norule") + ("lang") + ("notelang")) + "List of local options for setapparatus macro.") + +(defvar LaTeX-ekdosis-declareapparatus-options + '(("direction" ("LR" "RL")) + ("sep") + ("delim") + ("bhook") + ("ehook") + ("rule") + ("norule") + ("lang") + ("notelang") + ("maxentries")) + "List of local options for declareapparatus macro.") + +(defvar LaTeX-ekdosis-setlineation-options + '(("lineation" ("page" "document" "none")) + ("sep") + ("modulo") + ("modulonum") + ("margin" ("right" "left" "inner" "outer")) + ("numbers" ("elided" "full")) + ("vlineation" ("page" "document")) + ("vmodulo") + ("vmargin" ("right" "left")) + ("continuousvnum")) + "List of local options for setlineation macro.") + +(defvar LaTeX-ekdosis-ekddiv-options + '(("type") + ("n") + ("head") + ("barehead") + ("depth" ("1" "2" "3" "4" "5" "6" "7" "8" "9")) + ("toc" ("book" "part" "chapter" "section" "subsection" + "subsubsection" "paragraph" "subparagraph")) + ("mark")) + "List of local options for ekddiv macro.") + +(defvar LaTeX-ekdosis-setteixmlexport-options + '(("autopar" ("true" "false"))) + "List of local options for SetTEIxmlExport macro.") + (defvar LaTeX-ekdosis-alignment-key-val-options '(("tcols") ("lcols") @@ -98,9 +221,18 @@ ("apparatus") ("flush" ("true" "false")) ("paired" ("true" "false")) - ("pagelineation" ("true" "false"))) + ("lineation" ("page" "document"))) "Local options for alignment env.") +(defvar LaTeX-ekdosis-ekdverse-key-val-options + '(("width") + ("type")) + "Local options for ekdverse env.") + +(defvar LaTeX-ekdosis-ekdstanza-key-val-options + '(("type")) + "Local options for ekdstanza env.") + (TeX-add-style-hook "ekdosis" (lambda () @@ -120,12 +252,53 @@ (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) '("[l]" ("linelabel")) t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("{{1}}" ("surplus")) + t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("<{1}>" ("supplied")) + t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("{1}" ("sic")) + t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("[g]" ("gap")) + t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("{1}" ("mbox")) + t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("{1}" ("rdgGrp")) + t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("[pb]" ("ekdpb")) + t) + (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) + '("[t]" ("teidirect")) + t) ;; This package relies on lualatex, so check for it: (TeX-check-engine-add-engines 'luatex) (TeX-add-symbols + '("ekdsetup" (TeX-arg-key-val LaTeX-ekdosis-ekdsetup-options)) '("DeclareWitness" "xml:id" "rendition" "description" [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-declarewitness-options ] 0) + '("DeclareHand" "xml:id" "base ms." "rendition" + [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-declarehand-options ] + 0) + '("DeclareSource" "xml:id" "rendition" + 0) + '("DeclareScholar" "xml:id" "rendition" + [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-declarescholar-options ] + 0) + '("DeclareShorthand" "xml:id" "rendition" "csv-list of ids" + 0) + '("getsiglum" "csv-list" + 0) + '("SigLine" "unique id" + 0) + '("linelabel" "label" + 0) '("app" [ TeX-arg-key-val LaTeX-ekdosis-app-options ] t) '("lem" [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-lem-options ] @@ -136,14 +309,90 @@ t) '("note*" [ LaTeX-ekdosis-long-key-val LaTeX-ekdosis-note-star-options ] t) - '("SetEkdosisAlignment" + '("rdgGrp" [ TeX-arg-key-val LaTeX-ekdosis-rdggrp-options ] + t) + '("SetCritSymbols" (TeX-arg-key-val LaTeX-ekdosis-setcritsymbols-options)) + '("supplied" "supplied text" 0) + '("surplus" "surplus text" 0) + '("gap" (TeX-arg-key-val LaTeX-ekdosis-gap-options)) + '("sic" "sic text" 0) + '("SetAlignment" (TeX-arg-key-val LaTeX-ekdosis-alignment-key-val-options)) + '("columnratio" "fraction(s)" [ "fraction(s)" ] ) + '("setcolumnwidth" "width/gap" [ "width/gap" ] ) + '("marginparthreshold" "number of columns" [ "number of columns" ] ) + '("footnotelayout" + (TeX-arg-eval completing-read + (TeX-argument-prompt nil nil "Layout") + '("c" "m" "p"))) + '("SetHooks" (TeX-arg-key-val LaTeX-ekdosis-sethooks-options)) + '("SetLTRapp" 0) + '("SetRTLapp" 0) + '("SetSeparator" "separator" 0) + '("SetBeginApparatus" "chars|commands" 0) + '("SetEndApparatus" "chars" 0) + '("SetUnitDelimiter" "delimiter" 0) + '("SetDefaultRule" "command" 0) + '("SetApparatusLanguage" "lang name" 0) + '("SetApparatusNoteLanguage" "lang name" 0) + '("SetApparatus" (TeX-arg-key-val LaTeX-ekdosis-setapparatus-options)) + '("footnoteruletrue" 0) + '("footnoterulefalse" 0) + '("SetDefaultApparatus" "apparatus name" 0) + '("DeclareApparatus" "apparatus name" + [ TeX-arg-key-val LaTeX-ekdosis-declareapparatus-options ] 0) + '("indentpattern" "pattern" 0) + '("vin" 0) + '("SetLineation" (TeX-arg-key-val LaTeX-ekdosis-setlineation-options)) + '("innerlinenumbers" 0) + '("outerlinenumbers" 0) + '("modulolinenumbers" [ "number" ] ) + '("resetlinenumber" [ "number" ] ) + '("resetvlinenumber" [ "number" ] ) + '("verselinenumfont" "commands" 0) + '("SetLR" 0) + '("SetRL" 0) + '("MkBodyDivs" "div1" "div2" "div3" "div4" "div5" "div6" 0) + '("ekddiv" (LaTeX-ekdosis-long-key-val LaTeX-ekdosis-ekddiv-options)) + '("FormatDiv" "number" "code before" "code after" 0) + '("ekdmark" 0) + '("endmark" 0) + '("ekdprintmark" + (TeX-arg-eval completing-read + (TeX-argument-prompt nil nil "selector") + '("HEL" "HEC" "HER" "HOL" "HOC" "HOR" + "FEL" "FEC" "FER" "FOL" "FOC" "FOR")) + "signpost" 0 ) + '("ekdnohfmark" 0) + '("ekdresethfmarks" 0) + '("ekdpb" [ "page number" ] "line number" 0) + '("ekdpb*") + '("addentries" [ "layer" ] "number" 0) + '("SetTEIFilename" "base name" 0) + '("SetTEIxmlExport" (TeX-arg-key-val + LaTeX-ekdosis-setteixmlexport-options)) + '("TeXtoTEI" "csname" "TEI element" [ "TEI attributes" ] 0) + '("EnvtoTEI" "env name" "TEI element" [ "TEI attributes" ] 0) + '("EnvtoTEI*" "env name" "TEI element" [ "TEI attributes" ] 0) + '("TeXtoTEIPat" "TeX pattern" "TEI pattern" 0) + '("teidirect" [ "xml attributes" ] "xml element" "code" 0) + '("AddxmlBibResource" "basename or name.xml" 0) ) (LaTeX-add-environments "ekdosis" + "edition" + "translation" + "edition*" + "translation*" + "patverse" + "ekdpar" '("alignment" LaTeX-env-args - [ TeX-arg-key-val LaTeX-ekdosis-alignment-key-val-options ] - )) + [ TeX-arg-key-val LaTeX-ekdosis-alignment-key-val-options ] ) + '("ekdverse" LaTeX-env-args + [ TeX-arg-key-val LaTeX-ekdosis-ekdverse-key-val-options ] ) + '("ekdstanza" LaTeX-env-args + [ TeX-arg-key-val LaTeX-ekdosis-ekdstanza-key-val-options ] ) + ) ) LaTeX-dialect) diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf Binary files differindex b3f66493573..de40fcdb68a 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf +++ b/Master/texmf-dist/doc/lualatex/ekdosis/ekdosis.pdf diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf b/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf Binary files differindex 17f6b02a968..1ca02247624 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf +++ b/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.pdf diff --git a/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.tex b/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.tex index 2b1b442a972..14673ac2ac7 100644 --- a/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.tex +++ b/Master/texmf-dist/doc/lualatex/ekdosis/samples/Caesar_BG-6-13-1.tex @@ -2,8 +2,8 @@ \usepackage{fontspec} \usepackage[latin.classic,french,english]{babel} \babelfont{rm}{Old Standard} -\babelfont{sf}{NewComputerModern Sans} -\babelfont{tt}{NewComputerModern Mono} +\babelfont{sf}{NewComputerModernSans10} +\babelfont{tt}{NewComputerModernMono10} \usepackage{nextpage} \usepackage{xltabular} diff --git a/Master/texmf-dist/source/lualatex/ekdosis/Makefile b/Master/texmf-dist/source/lualatex/ekdosis/Makefile index 4479b82d096..032cf9baed6 100644 --- a/Master/texmf-dist/source/lualatex/ekdosis/Makefile +++ b/Master/texmf-dist/source/lualatex/ekdosis/Makefile @@ -57,6 +57,8 @@ clean: testsamples rm -rf * cp -p -r .backup/* . rm -rf .backup + +pandoc: pandoc -s README.md -o about.html auctex: @@ -86,6 +88,18 @@ local: uninst auctex mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) cp $(NAME).sty $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).lua $(UTREE)/tex/lualatex/$(NAME) + if [ -e "$(NAME).pdf" ]; then cp $(NAME).pdf $(UTREE)/doc/lualatex/$(NAME) &&\ + cp -r $(SAMPLES)/ $(UTREE)/doc/lualatex/$(NAME); fi + +install: all + sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(NAME) + sudo cp $(NAME).dtx $(LOCAL)/source/latex/$(NAME) + sudo cp $(NAME).sty $(LOCAL)/tex/latex/$(NAME) + sudo cp $(NAME).pdf $(LOCAL)/doc/latex/$(NAME) + cp -r $(SAMPLES)/ $(LOCAL)/doc/latex/$(NAME) + +uninstall: + rm -rf $(LOCAL)/{tex,source,doc}/latex/$(NAME) zip: all ln -sf . $(NAME) @@ -109,4 +123,4 @@ package: distclean all rm -rf $(NAME)/ .SILENT: testsamples -.PHONY: all clean distclean inst local uninst install uninstall zip package samples testsamples +.PHONY: all clean distclean pandoc inst local uninst install uninstall zip package samples testsamples diff --git a/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx b/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx index 229d7c1d142..30b19f07d6d 100644 --- a/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx +++ b/Master/texmf-dist/source/lualatex/ekdosis/ekdosis.dtx @@ -61,7 +61,7 @@ along with this program. If not, see %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{ekdosis} %<*package> - [2021/04/02 v1.2 Typesetting TEI xml-compliant critical editions] + [2021/08/18 v1.3 Typesetting TEI xml-compliant critical editions] %</package> %<*driver> \begin{filecontents}[noheader,overwrite]{bibdata.xml} @@ -166,7 +166,7 @@ along with this program. If not, see <monogr> <title level="m">Works of W. Shakespeare</title> <editor> - <forename>H.N.</forename> + <forename>H. N.</forename> <surname>Hudson</surname> </editor> <imprint> @@ -180,7 +180,7 @@ along with this program. If not, see <monogr> <title level="m">Shakespeare's Complete Sonnets</title> <editor> - <forename>C.M.</forename> + <forename>C. M.</forename> <surname>Walsh</surname> </editor> <imprint> @@ -246,7 +246,7 @@ along with this program. If not, see author = {{Homer}}, title = {The Odyssey}, date = 1919, - editor = {Murray, A.T\adddot}, + editor = {Murray, A. T.}, volumes = 2, publisher = {Harvard University Press -- William Heinemann}, location = {Cambridge, MA. -- London} @@ -266,7 +266,7 @@ along with this program. If not, see } @Book{ReynoldsWilson1991, - author = {Reynolds, L. D. and Wilson, N. G}, + author = {Reynolds, L. D. and Wilson, N. G.}, title = {Scribes and Scholars}, year = {1991}, subtitle = {A Guide to the Translation of Greek and Latin @@ -311,6 +311,15 @@ along with this program. If not, see url = {http://www.teibyexample.org} } +@Software{babel, + title = {The Babel package}, + titleaddon = {Multilingual support for Plain TeX or LaTeX}, + author = {Bezos López, Javier and Braams, Johannes L.}, + url = {http://www.ctan.org/pkg/babel}, + date = {2020-07-13}, + version = {3.47} +} + @Software{extdash, title = {The Extdash package}, titleaddon = {A range of dash commands for compound words}, @@ -329,6 +338,16 @@ along with this program. If not, see version = {1.0} } +@Software{keyfloat, + title = {The Keyfloat package}, + subtitle = {Provides a key/value interface for generating + floats}, + author = {Dunn, Brian}, + url = {https://ctan.org/pkg/keyfloat}, + date = {2021-06-29}, + version = {2.06}, +} + @Software{lineno, title = {The Lineno package}, titleaddon = {Line numbers on paragraphs}, @@ -365,13 +384,23 @@ along with this program. If not, see version = {1.49} } -@Software{babel, - title = {The Babel package}, - titleaddon = {Multilingual support for Plain TeX or LaTeX}, - author = {Bezos López, Javier and Braams, Johannes L.}, - url = {http://www.ctan.org/pkg/babel}, - date = {2020-07-13}, - version = {3.47} +@Software{tcolorbox, + title = {The Tcolorbox package}, + subtitle = {Coloured boxes, for LaTeX examples and theorems, + etc}, + author = {Sturm, Thomas F.}, + url = {https://ctan.org/pkg/tcolorbox}, + date = {2021-06-14}, + version = {4.51}, +} + +@Software{titleps, + title = {The Titleps package}, + titleaddon = {Page style control}, + author = {Bezos López, Javier}, + url = {https://ctan.org/pkg/titleps}, + date = {2019-10-16}, + version = {2.13} } @Software{verse, @@ -413,6 +442,7 @@ along with this program. If not, see \end{filecontents} \begin{filecontents}[overwrite]{\jobname-ekd.cfg} \footnotelayout{m} +\SetCritSymbols{suppbegin = 〈,suppend = 〉} \EnvtoTEI{ancientgreek}{p}[xml:lang="grc"] \DeclareApparatus{fontium}[ delim=\hskip0.75em, @@ -423,7 +453,6 @@ along with this program. If not, see delim=\hskip0.75em] \DeclareApparatus{rtl}[ direction=RL, - sep={[ }, delim=\hskip0.75em] \DeclareWitness{M}{M}{\emph{Marcianus Gr.} 269}[ settlement=Venice, @@ -475,6 +504,11 @@ along with this program. If not, see \DeclareHand{hIpc}{hI}{I\textsuperscript{pc}}[Lectio post correctionem] \DeclareWitness{hR}{R}{\emph{Vaticanus Gr.} 277} \DeclareWitness{hH}{H}{\emph{Parisinus Gr.} 2142} +\DeclareWitness{hGalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.} + 2174}[origDate=s. XIV] +\DeclareWitness{hGalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.} + 231}[origDate=s. XVI] + \DeclareShorthand{hGalE1.M.Q}{Gal.E1(MQ)}{hGalE1.M,hGalE1.Q} \DeclareSource{Lit}{Littré} \DeclareSource{Erm}{Ermerins} \DeclareSource{Sm}{Smith} @@ -524,17 +558,18 @@ along with this program. If not, see \defaultfontfeatures{Renderer=Harfbuzz} \usepackage[latin.classic,greek.ancient,american]{babel} \babelfont{rm}{Old Standard} -\babelfont{sf}{NewComputerModern Sans} -\babelfont{tt}{NewComputerModern Mono} +\babelfont{sf}{NewComputerModernSans10} +\babelfont{tt}{NewComputerModernMono10} \babelfont[greek]{rm}[ Script=Greek, RawFeature={+ss05;+ss06} ]{Old Standard} -\babelfont[greek]{sf}[Script=Greek]{NewComputerModern Sans} -\babelfont[greek]{tt}[Script=Greek]{NewComputerModern Mono} +\babelfont[greek]{sf}[Script=Greek]{NewComputerModernSans10} +\babelfont[greek]{tt}[Script=Greek]{NewComputerModernMono10} \newfontfamily{\junicode}{Junicode}[ Ligatures=TeX, RawFeature={+hist}] +\newfontfamily\missaali{Missaali Regular} \babeltags{ancientgreek = greek} \def\sg#1{\textancientgreek{#1}} \usepackage[Old Standard]{mathfont} @@ -564,6 +599,8 @@ along with this program. If not, see \usepackage{manfnt} \usepackage{lettrine} \newcommand\danger{\lettrine[loversize=-.5]{\textdbend}{\hskip6pt}} +\newcommand\mansee{\lettrine[loversize=-.4, + lraise=.55]{\mantriangleright}{\hskip6pt}} \usepackage{metalogox} \usepackage{hologo} \usepackage{xcolor} @@ -575,9 +612,9 @@ along with this program. If not, see \colorlet{cinnamon}{black}}{} \definecolor{gainsboro}{RGB}{222,222,222} \PassOptionsToPackage{bookmarks=true}{hyperref} -\usepackage{xurl} +\usepackage[obeyspaces]{url} \usepackage[numbered]{hypdoc} -\usepackage[loadlang=en]{metastr} +\usepackage[titlematter,loadlang=en|de|fr|es]{metastr} \hypersetup{ colorlinks, allcolors=cinnamon, @@ -593,7 +630,11 @@ along with this program. If not, see \bibinput{ekdosis} \usepackage[nospace,american]{varioref} \newcommand\phts{\phantomsection} +\usepackage{nameref} +\newcommand\vnref[1]{\vref{#1}, \enquote{\nameref{#1}}} \usepackage[style=oxnotes-inote,dashed]{biblatex} +\DefineBibliographyStrings{english}{ + seenote={cf\adddotspace n\adddotspace}} \DeclareSourcemap{ \maps[datatype=bibtex]{ \map{ @@ -602,6 +643,27 @@ along with this program. If not, see } } } +% include seenote in parentheses +\renewbibmacro*{footcite:note}{% + \ifnameundef{labelname} + {\printfield{label}} + {\printnames{labelname}}% + \ifsingletitle + {} + {\setunit*{\printdelim{nametitledelim}}% + \printfield[title]{labeltitle}}% + \setunit*{\addspace}% + \printtext{% + \mkbibparens{% + \bibstring{seenote}\addnbspace + \ref{cbx@\csuse{cbx@f@\thefield{entrykey}}}% + \iftoggle{cbx:pageref} + {\ifsamepage{\the\value{instcount}} + {\csuse{cbx@f@\thefield{entrykey}}} + {} + {\addcomma\space\bibstring{page}\addnbspace + \pageref{cbx@\csuse{cbx@f@\thefield{entrykey}}}}} + {}}}} \ifbool{nocolordoc} { \usepackage{academicons} @@ -662,6 +724,14 @@ along with this program. If not, see \metaset{contacturl}{http://www.roberalessi.net} \metaset{partof}{The ekdosis Package} \metaset[print]{partof}{The \textsf{ekdosis} Package} +\metaset[altlang]{rightstext}{en,de,fr,es} +\metaset[fr]{partofmessage}{% + Ce document fait partie de l'œuvre: \metapick[#1]{partof}.} +\metaset[es]{partofmessage}{% + Este documento forma parte de la obra: \metapick[#1]{partof}.} +\metaset[es]{licenseurlmessage}{% + Para ver una copia de esta licencia, siga el vínculo: + \metapick[#1]{licenseurl}.} \metaset{copyrightowner}{\metapick[#1]{author}} \metaset{copyrightdate}{2020--2021} \metaset{licensemessage}{Permission is granted to copy, distribute @@ -674,7 +744,6 @@ along with this program. If not, see \metaset{licenseurl}{https://www.gnu.org/licenses/fdl-1.3.html} \metaset[print]{licenseurl}{% \url{https://www.gnu.org/licenses/fdl-1.3.html}} -\metaset[cmd]{licenselogo}{\includegraphics[scale=0.75]{#1}} \metawritepdfinfo \metawritepdfaux \metawritepdfpreamble @@ -780,7 +849,7 @@ along with this program. If not, see %</driver> % \fi % -% \CheckSum{2188} +% \CheckSum{2519} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -857,7 +926,7 @@ along with this program. If not, see % Please send error reports and suggestions for improvements to Robert % Alessi: % \begin{itemize} -% \item email: \mailto[ekdosis package]{alessi@roberalessi.net} +% \item email: \mailto[ekdosis package]{Robert Alessi <alessi@roberalessi.net>} % \item website: \url{http://www.robertalessi.net/ekdosis} % \item development: \url{http://git.robertalessi.net/ekdosis} % \item comments, feature requests, bug reports: @@ -915,8 +984,9 @@ along with this program. If not, see % \end{keyfigure} % \end{comment} % -% The reader will find here, by way of introduction, a summarized -% version of the first part of an article published in the +% \lettrine{\color{cinnamon}\missaali +T+}{he reader} will find here, +% by way of introduction, a summarized version of the first part of an +% article published in the % \mkbibemph{\citefield{Alessi2020}{journaltitle}} as a contribution % to a Digital Humanities workshop held at Stanford University % (\printdate{2019-04-15}).\footcite{Alessi2020} @@ -1123,17 +1193,66 @@ along with this program. If not, see % follows. % % \danger The reader is invited to refer to the relevant sections of -% this documentation for more information on how to use them. +% this documentation for more information on how to use these options. % % \DescribeOption{layout}\phts\label{ref:layout-opt} -% |layout|$=$\verb+float|footins+\hfill\tcboxverb{Default: float}\\ -% By default, layers of critical notes are inserted as a floating -% environment to be printed at the bottom of pages. |layout=footins| -% can be set to insert critical notes in the default footnote block -% which can be considered to be a special kind of float that is -% printed at the bottom of pages. In this case, the apparatus criticus -% will be inserted between regular numbered footnotes, but will carry -% no footnote mark of its own. +% |layout|$=$\verb+float|footins|keyfloat|fitapp+ +% \hfill\tcboxverb{Default: float} +% \begin{enumerate} +% \item |layout=float| By default, layers of critical notes are +% inserted as floating environments to be printed at the bottom of +% the pages. +% \item |layout=footins| This can be set to insert critical notes in +% the default footnote block which can be considered to be a special +% kind of float that is printed at the bottom of the pages. In this +% case, the apparatus criticus will be inserted between regular +% numbered footnotes, but will carry no footnote mark of its own. +% \item \label{ref:keyfloat-opt}\newfeature[v1.3] |layout=keyfloat| +% does approximately the +% same as the default option |layout=float| but uses the +% \pkg{keyfloat} package\footcite{keyfloat} to generate the floating +% environments to be used as containers for critical footnotes. This +% way, the keys and values provided by this +% package\footcite[See][sect. 2.3, \ppno~13--16]{keyfloat} may be +% used to achieve such effects as append additional, informative +% text below the apparatus, draw a line around the apparatus block +% or change its width.\footnote{See below, \vpageref{ref:keyparopts} +% for more information.} +% \item \label{ref:fitapp-opt}\newfeature[v1.3] |layout=fitapp| As +% described below in \vnref{sec:oscillating-problem}, \pkg{ekdosis} +% may oscillate indefinitely between different sets of page +% decisions when one or more apparatus entries attached to the last +% lines of the edition text on a given page do not fit in the +% apparatus block. The reader will find in this section of the +% documentation a detailed account of several ways to circumvent +% this issue. Alternatively, or rather conjointly with those ways, +% |layout=fitapp| can be used to instruct \pkg{ekdosis} to scale +% down the characters of the apparatus block so that the contentious +% entries can fit. This mechanism uses the \enquote{fitting} library +% provided by the \pkg{tcolorbox} package.\footcite[sect.~22, +% \ppno~\pnfmt{438--449}]{tcolorbox} When this option is set, the +% apparatus criticus grows normally until a predefined height is +% reached. This height is set to |0.5\textheight| by +% default.\footnote{Of course, this height can be modified. See +% below \vpageref{ref:appheight} for details.} From this point on, +% the apparatus block ceases to grow; rather, the size of the +% characters is reduced to allow for additional entries. As a +% consequence of this rationale, the total number of entries on a +% given page must not be too high. It is therefore advisable to use +% |layout=fitapp| conjointly with |maxentries| as described below +% \vpageref{ref:maxentries} and in \vref{sec:oscillating-problem}. % +% \danger If used appropriately, this mechanism gives excellent +% typographical results, notably with complex edition texts of which +% the entries in the associated apparatus can be quite abundant in +% number. It may even put an end to the +% \enquote{\hyperref[sec:oscillating-problem]{oscillating problem}} +% in most of the cases. However, as suitable it may be for high +% quality typeset texts and final, camera-ready copies, its benefit +% comes at the expense of slowing down the compilation process. Yet +% looser algorithms can be selected when speed must prevail over +% quality for intermediate or draft copies.\footnote{See below +% \vpageref{ref:fitalgorithm} for more information.} +% \end{enumerate} % % \DescribeOption{divs}\phts\label{ref:divs-opt} % |divs|$=$\verb+ekdosis|latex+\hfill\tcboxverb{Default: ekdosis}\\ @@ -1203,6 +1322,53 @@ along with this program. If not, see %</example> % \fi % +% \subsection{Setup} +% \label{sec:setup} +% \DescribeMacro{\ekdsetup} \newfeature[v1.3] Starting from v1.3, +% \cs{ekdsetup} can be used to specify options that affect the general +% behavior of \pkg{ekdosis}. \cs{ekdsetup} is a preamble-only +% command. It accepts the following |key=value| options the number of +% which is expected to increase as \pkg{ekdosis} grows:\\ +% \DescribeOption{showpagebreaks}\phts\label{ref:showpagebreaks-opt} +% \unskip|showpagebreaks|$=$\verb+true|false+ +% \hfill \tcboxverb{Initially: false; Default: true}\\ +% This named argument, which defaults to |true| if used without value, +% has specific marks printed in the margins so as to spot with a rapid +% cast of the eye the locations of conditional page breaks generated +% by the \cs{ekdpb} command described below \vpageref{ref:ekdpb}. By +% default, page breaks generated by \cs{ekdpb} are identified by the +% string |spb|\===for \enquote{soft} page break\=== whereas those +% generated by \cs{ekdpb*} are identified by |hpb|\===for +% \enquote{hard} page break. Furthermore, when \cs{ekdpb} triggers no +% page break, the marker is printed between square brackets, like so: +% |[spb]|. In this +% way, inoperative \cs{ekdpb} can be easily spotted and removed.\\ +% \DescribeOption{spbmk} |spbmk|$=$\meta{string} +% \hfill\tcboxverb{Default: spb}\\ +% |spbmk| is used to change the string associated to \enquote{soft} +% page breaks.\\ +% \DescribeOption{hpbmk} |hpbmk|$=$\meta{string} +% \hfill\tcboxverb{Default: hpb}\\ +% |hpbmk| is used to change the string associated to \enquote{hard} +% page breaks. +% +% As an example, what follows has \enquote{soft} page breaks printed +% in blue and \enquote{hard} page breaks printed in red:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{latex} +\ekdsetup{ + showpagebreaks, + spbmk = \textcolor{blue}{spb}, + hpbmk = \textcolor{red}{hpb} +} +\end{minted} +% \iffalse +%</example> +% \fi +% % \subsection{Using a Configuration File} % \label{sec:using-conf-file} % Complex editions may use a large number of witnesses, sources and @@ -1212,7 +1378,7 @@ along with this program. If not, see % way to avoid overloading the document preamble: all the settings % related to the critical edition can be gathered in a separate % configuration file named |\jobname-ekd.cfg|. If such a file can be -% found, its contents is automatically read and used by +% found, its contents are automatically read and used by % \pkg{ekdosis}. % % \subsection{Witnesses, Hands, Sources, Scholars \& Shorthands} @@ -1247,7 +1413,8 @@ along with this program. If not, see % \begin{enumerate} % \item The unique identifier of the witness to be used both in the % |.tex| source file and as an |xml:id| in the \texttt{TEI xml} -% output if any. +% output if any.\footnote{See \vpageref{ref:xmlid} for more +% information.} % \item The rendition to be used in the printed apparatus criticus, % which also will be found within the |<sourceDesc>| element of the % \texttt{TEI} header where the description of the witness occurs, @@ -1258,8 +1425,8 @@ along with this program. If not, see % \end{enumerate} % Finally, the optional argument of \cs{DeclareWitness} accepts a % comma-separated list of the following \enquote{name=value} arguments -% that are used to collect items of information to be found within -% the |<msIdentifer>| element in the \texttt{TEI} +% the first six of which are used to collect items of information to +% be found within the |<msIdentifer>| element in the \texttt{TEI} % header:\footnote{See % \url{https://tei-c.org/release/doc/tei-p5-doc/en/html/MS.html\#msid} % for detailed information on these elements.}---\\ @@ -1276,13 +1443,17 @@ along with this program. If not, see % \DescribeOption{msName} |msName|$=$\meta{name}: The name commonly % used for the witness.\\ % \DescribeOption{origDate} |origDate|$=$\meta{date}: Any form of date -% used to identify the date of origin for the witness. +% used to identify the date of origin for the witness.\\ +% \DescribeOption{locus} |locus|$=$\meta{locus}\newfeature[v1.3]: The +% sequence of folio references where the edition text is found in the +% manuscript. % % \phts\label{ref:marcianus-b} % To take here one example, a witness such as the \emph{Marcianus % Graecus}~269, referred to as manuscript \enquote*{M} in the % editions, which contains sixty treatises transmitted under the name -% of Hippocrates, could be declared as follows:--- +% of Hippocrates, could be declared as follows:\footnote{The locus +% specified refers to Hippocrates' \emph{Epidemics}, Book~6.}--- % %\iffalse %<*example> @@ -1293,7 +1464,8 @@ along with this program. If not, see institution=Marciana Library, msName=Marcianus Gr., idno=269, - origDate=s. X] + origDate=s. X, + locus=fol. 416\textsuperscript{v}–426\textsuperscript{v}] \end{minted} % \iffalse %</example> @@ -1308,7 +1480,7 @@ along with this program. If not, see % \begin{enumerate} % \item The unique identifier of the hand to be used both in the % |.tex| source file and as an |xml:id| in the \texttt{TEI xml} output -% if any. +% if any.\footnote{See \vpageref{ref:xmlid} for more information.} % \item The unique identifier of the witness the hand is related % to. Of course, this witness must have been declared beforehand. % \item The rendition to be used in the printed apparatus criticus, @@ -1442,7 +1614,7 @@ along with this program. If not, see % \begin{enumerate} % \item The unique identifier of the scholar to be used both in the % |.tex| source file and as an |xml:id| in the \texttt{TEI xml} output -% if any. +% if any.\footnote{See \vpageref{ref:xmlid} for more information.} % \item The rendition to be used in the apparatus criticus in print, % which also will be found within the |<sourceDesc>| element of the % \texttt{TEI} header where the description of the persons cited @@ -1554,10 +1726,12 @@ along with this program. If not, see % \vpageref{ref:declarewitness}.} a line ready to be inserted in a % table set to print a Conspectus Siglorum with the following items of % information separated by the symbol |&|: the siglum referring to the -% witness, the contents of the |description| field and the contents of -% the |origDate| field. An example of how one could print the -% Conspectus Siglorum of the manuscripts of Caesar's \emph{Gallic War} -% from the list provided \vpageref{ref:caesar-bg-sigla} follows:--- +% witness, the contents of the |description| field, followed if +% applicable by the sequence of folios that refers to the edition +% text, and the contents of the |origDate| field. An example of how +% one could print the Conspectus Siglorum of the manuscripts of +% Caesar's \emph{Gallic War} from the list provided +% \vpageref{ref:caesar-bg-sigla} follows:--- % % \captof{Conspectus Siglorum of Caesar's \emph{Gallic War}} % \iffalse @@ -1731,6 +1905,8 @@ yesterday. % |nosep| must be used when for some reason no \cs{rdg} command % follows a \cs{lem} command that has just been used, as shown below % in \vref{lst:emend-coni-corr}, l.~7. +% +% \needspace{2\baselineskip} % \danger \DescribeMacro{\ekdsep} If |nosep| be used so as to insert % an explanatory note after the lemma text with the \cs{note} command % described below \vpageref{ref:editorial-notes}, then \cs{ekdsep} can @@ -1749,6 +1925,19 @@ yesterday. % orthographical and the like may apply. Obviously, |type=emendation| % should be restricted to lemma texts and |type=conjecture| to variant % readings recorded by means of \cs{rdg} described below. +% +% \needspace{2\baselineskip} +% \noindent +% \DescribeOption{num} (no-value +% argument)\phts\label{ref:lem-num}\newfeature[v1.3]\\ +% |num| takes no value. If used, this argument instructs to print any +% line number that \pkg{ekdosis} may have decided not to print in the +% apparatus criticus before the lemma text.\\ +% \DescribeOption{nonum} (no-value +% argument)\phts\label{ref:lem-nonum}\newfeature[v1.3]\\ +% Compared to |num|, |nonum| does the opposite. If used, any number +% that \pkg{ekdosis} may have decided to print before the lemma text +% is suppressed. % % \needspace{11\baselineskip} % Finally, four named arguments can be used to insert words at the @@ -2040,6 +2229,19 @@ friend %</example> % \fi % +% \danger It must be noted that from a technical standpoint, albeit +% the nested lemmas are printed \emph{before} their parents in the +% apparatus criticus, they are seen by \pkg{ekdosis} \emph{after} the +% latter as the source file is compiled. As a result, notably when the +% whole nested group of lemmas falls on the same line without being +% preceded by an apparatus entry on this line, it may be needed to +% suppress redundant numbers that \pkg{ekdosis} may have decided to +% print in the appartus criticus. Conversely, it may be needed to +% print numbers that \pkg{ekdosis} may have decided not to print. To +% both ends, the |num| and |nonum| optional arguments of the \cs{lem} +% command can be used as described above +% \vpagerefrange{ref:lem-num}{ref:lem-nonum}. +% % \subsubsection{Explicit Grouping} % \label{sec:explicit-grouping} % \DescribeMacro{\rdgGrp} \cs{rdgGrp}\oarg{options}\marg{lemma text @@ -2447,11 +2649,11 @@ friend % \iffalse %</example> % \fi -% +% +% \needspace{11\baselineskip} % PDF output:--- % \medskip % -% \needspace{7\baselineskip} % \resetlinenumber % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] % \begin{specimen} @@ -3119,18 +3321,56 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \DescribeOption{initialrule} |initialrule|$=$\meta{command} % \phts\label{ref:initialrule}\hfill\bgroup\footnotesize % \tcboxverb{Default: \rule{0.4\columnwidth}{0.4pt} (initially not set)}% -% \egroup -% \newfeature[v1.2] |initialrule| draws a separating rule between the -% edition text and all subsequent layers of critical notes. Of course, -% this option only makes sense when multiple-layer apparatus criticus -% are set. Therefore, it has no effect on single-layer apparatus +% \egroup \newfeature[v1.2] |initialrule| draws a separating rule +% between the edition text and all subsequent layers of critical +% notes. Of course, this option only makes sense when multiple-layer +% apparatus criticus are set. Therefore, it has no effect on +% single-layer apparatus % criticus.\\ % \DescribeOption{noinitialrule}\hfill\tcboxverb{Default: not set}\\ % This is a no-value option. It removes any previously set % |initialrule|. -% +% % An example of the way these hooks may be used is provided below in % \vref{lst:shak-sonnet1}. +% +% \noindent\textbf{Option Specific to the |layout=keyfloat| Global +% Setting}\footnote{See above \vref{ref:keyfloat-opt}.}\\ +% \DescribeOption{keyparopts}% +% \phts\label{ref:keyparopts}|keyparopts|$=$\meta{csv options} +% \hfill\tcboxverb{Default: empty}\\ +% \newfeature[v1.3] The comma-separated options that can be used are +% those described in the documentation of the \pkg{keyfloat} +% package.\footcite[sect.~2.3, \ppno~\pnfmt{13--15}]{keyfloat} As an +% example, |keyparopts={ft, tr={made with ekdosis},| % +% \allowbreak|lw=1.2}| will draw a tight frame around the apparatus +% block, have the words \enquote{made with \pkg{ekdosis}} printed +% below this block on the +% right and set its width to |1.2\linewidth|.\\ +% \textbf{Options Specific to the |layout=fitapp| Global +% Setting}\footnote{See above \vref{ref:fitapp-opt}.}\\ +% \DescribeOption{appheight}% +% \phts\label{ref:appheight}|appheight|$=$\meta{dimension} +% \hfill\tcboxverb{Default: 0.5\textheight}\\ +% \newfeature[v1.3] This option is used to change the maximum height +% up to which the apparatus block is allowed to grow before the size +% of the characters is reduced to allow for more entries. The value +% must be a dimension, namely a number followed by a length unit, such +% as |0.65\textheight|, |18cm| or |6in|.\\ +% \DescribeOption{fitalgorithm}% +% \phts\label{ref:fitalgorithm} +% \unskip|fitalgorithm|$=$\verb+fontsize|hybrid|areasize|squeeze+ +% \hfill\tcboxverb{Default: fontsize}\\ +% \newfeature[v1.3] The four algorithms that can be used to have the +% entries inserted in the apparatus criticus fit to the selected +% height are presented here from the tightest to the loosest, that is, +% the slowest to the fastest.\footnote{See \cite[446--449]{tcolorbox} +% for details and illustrative examples.} While it is advisable to +% limit the use of |fontsize| to high quality typesetting for +% camera-ready copies, |areasize| offers a satisfactory settlement +% when speed must be given an advantage for intermediate or draft +% copies. |squeeze| should be avoided as it gives results that are +% offensive to the sight and unacceptable to any reader. % % \subsection{Single-Layer Apparatus Criticus} % \label{sec:single-layer-app} @@ -3190,6 +3430,15 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % needed to apply in the apparatus criticus a language different from % the one that is selected in the edition text. % +% \DescribeMacro{\SetApparatusNoteLanguage} +% \phts\label{ref:app-note-lang}\newfeature[v1.3] +% \cs{SetApparatusNoteLanguage}\marg{languagename} can be used when it +% is needed to apply in text entries introduced by the mandatory +% argument of the \cs{note} command as described in +% \vref{ref:type-note}\===namely +% \cs{note}\oarg{options}\marg{text}\===a language different from the +% one that is selected in the edition text. +% % \paragraph{General Command} % \DescribeMacro{\SetApparatus} \cs{SetApparatus}\marg{csv list of % apparatus settings}\phts\label{ref:apparatus-settings-b}\\ @@ -3215,23 +3464,31 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \hfill\tcboxverb{Default: empty}\\ % The characters to be appended at the end of the apparatus % block.\footnote{See also n.~\vref{fn:rm-dots}.}\\ -% \DescribeOption{rule} |rule|$=$\meta{command}\verb+|+|none| +% \DescribeOption{rule} |rule|$=$\meta{command} % \hfill\tcboxverb{Default: \rule{0.4\columnwidth}{0.4pt}}\\ % As described above, |rule| is used to draw the separating line -% between the edition text and the apparatus criticus. |rule=none| can -% also be used to remove the line.\\ +% between the edition text and the apparatus criticus.\\ % \DescribeOption{norule}\hfill\tcboxverb{Default: not set}\\ -% |norule| does not accept any value and has the same effect as -% |rule=none|.\phts\label{ref:apparatus-settings-e}\\ +% |norule| does not accept any value and is used to remove the +% line.\phts\label{ref:apparatus-settings-e}\\ % \DescribeOption{lang} |lang|$=$\meta{languagename} % \newfeature[v1.2]\phts\label{ref:app-lang-opt} % \hfill\tcboxverb{Default: not set}\\ -% \needspace{3\baselineskip}\noindent % |lang=<languagename>| is used as described % \vpageref[above]{ref:app-lang} when it is needed to apply in the % apparatus criticus a language different from the one that is % selected in the edition text. |languagename| can be any value % accepted by \pkg{babel} or \pkg{polyglossia}. +% \DescribeOption{notelang} |notelang|$=$\meta{languagename} +% \newfeature[v1.3]\phts\label{ref:app-note-lang-opt} +% \hfill\tcboxverb{Default: not set}\\ +% |notelang=<languagename>| is used as described +% \vpageref[above]{ref:app-note-lang} when is needed to apply in text +% entries introduced by the mandatory argument of the \cs{note} +% command as described in \vref{ref:type-note}\===namely +% \cs{note}\oarg{options}\marg{text}\===a language different from the +% one that is selected in the edition text. |languagename| can be any +% value accepted by \pkg{babel} or \pkg{polyglossia}. % % As an example, an apparatus criticus with references to line numbers % printed in normal font, a colon as a separator between lemma texts @@ -3327,6 +3584,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \DescribeOption{rule} % \DescribeOption{norule} % \DescribeOption{lang}\phts\label{ref:apps-lang-opt} +% \DescribeOption{notelang} % With regard to layout, any declared layer inherits the default values % described above in \vref{sec:single-layer-app}. That said, as the % optional argument of \cs{DeclareApparatus} accepts the exact same @@ -3498,6 +3756,7 @@ Some \app[type=rec2]{ % they are related to. As a result of this rule, all spaces subsequent % to \cs{note} are ignored. % +% \needspace{2\baselineskip} % \DescribeMacro{\note} \cs{note}\oarg{options}\marg{text}\\ % As said above, \cs{note}, when found outside \cs{app}|{}|, is used % to insert in additional layers of the apparatus short comments or @@ -3517,6 +3776,14 @@ Some \app[type=rec2]{ % \DescribeOption{lem} |lem|$=$\meta{lemma text}\\ % |lem| is the span of text the note is about. It may consist of one % or more words, or of an abridged lemma text.\\ +% \DescribeOption{num} (no-value argument)\newfeature[v1.3]\\ +% |num| takes no value. If used, this argument instructs to print any +% line number that \pkg{ekdosis} may have decided not to print in the +% apparatus criticus before the note.\\ +% \DescribeOption{nonum} (no-value argument)\\ +% Compared to |num|, |nonum| does the opposite. If used, any number +% that \pkg{ekdosis} may have decided to print before the note +% is suppressed.\\ % \DescribeOption{labelb} |labelb|$=$\meta{label} % \hfill\tcboxverb{Mandatory}\\ % |labelb| is the unique label to serve as a reference for the point @@ -3524,7 +3791,12 @@ Some \app[type=rec2]{ % \pkg{ekdosis} to print the line numbers in the apparatus criticus % and to set the |left()| XPointer should \texttt{TEI} output be % required. Therefore, it must be specified. Otherwise, \pkg{ekdosis} -% will issue an error message.\\ +% will issue an error message. However, two strictly consecutive +% \cs{note} commands are allowed to share the same |labelb| value for +% it may happen that consecutive notes need to refer to spans of text +% that begin at the exact same location. In this case, \pkg{ekdosis} +% generates only one \cs{linelabel} and one corresponding +% |<anchor>| element in the \texttt{TEI xml} file.\\ % \DescribeOption{labele} |labele|$=$\meta{label}\\ % |labele| is the unique label to serve as a reference for the point % immediately following the lemma text. Contrary to |labelb|, |labele| @@ -3686,6 +3958,7 @@ argument of the % element (ll.~5--7). Otherwise, the \texttt{TEI} output would not be % valid. % +% \needspace{4\baselineskip} % \section{Poetry} % \label{sec:poetry} % \subsection[The Standard \textsf{verse} Environment]{The Standard @@ -3837,7 +4110,7 @@ argument of the % \DescribeOption{width} |width|$=$\meta{length} % \hfill\tcboxverb{Default: \linewidth}\\ % If |width| be supplied, it is taken as a length in relation to which -% the entire contents of the environment is to be horizontally +% the entire contents of the environment are to be horizontally % centered. If given, this dimension may correspond to an average line % or to the longest line of the line group. To this end, the standard % \LaTeX\ command \cs{settowidth} can be used, like so:--- % @@ -4171,7 +4444,7 @@ substantiall fewell,} % |Hudson1856|, |Butler1899| and |Walsh1908| have been declared as % sources.\footnote{See above \vpageref{ref:declare-source} and % below \vref{sec:references-cited-works}.} |God| and |Stee|, -% resp.\ Godwin and Steevens, have been decalred as +% resp.\ Godwin and Steevens, have been declared as % scholars.\footnote{See above \vpageref{ref:declare-scholar}.} % \item \cs{ekdlettrine} (l.~23) is a specific command for the % \pkg{lettrine} package does not work in list @@ -4396,11 +4669,13 @@ substantiall fewell,} % to set lineation preferences. Its argument processes the |key=value| % options that follow:---\\ % \textbf{General Options}\\ -% \DescribeOption{lineation} |lineation|$=$\verb+page|document+ +% \DescribeOption{lineation} |lineation|$=$\verb+page|document|none+ % \hfill\tcboxverb{Default: document}\\ % |lineation=document| has the lines numbered continuously throughout % the document while |lineation=page| instructs \pkg{ekdosis} that the -% numbering should start afresh at the top of each page.\\ +% numbering should start afresh at the top of each page. |none| does +% the same as |page| but prevents the numbers from being printed in +% the margins while keeping them in use in the apparatus criticus.\\ % \DescribeOption{modulo} |modulo| \hfill\tcboxverb{Default: not set}\\ % |modulo| does not accept any value. When this option is set, every % fifth line is numbered.\\ @@ -4536,8 +4811,9 @@ substantiall fewell,} % \pkg{babel},\footcite[See][3.2 \pno~14]{polyglossia} the general % advice given above in \vref{sec:alignment-hooks} applies in all % cases. As regards setting languages in the \texttt{TEI xml} output -% file, the reader is invited to refer to point \vref{it:lang-subopt} -% and \vref{sec:teixml-output}. +% file, the reader is invited to refer to point \vref{it:lang-subopt}, +% and \vref{sec:teixml-output} including the example provided +% \vpageref{ref:ancientgreek-ex}. % % \danger In some cases, it may be needed to apply in the apparatus % criticus a language different from the one that is selected in the @@ -4971,7 +5247,7 @@ subtype="arabtex">'inna 'abI kAna mina %</example> % \fi % -% \subsection{Using \texttt{TEI} Un-numbered Divisions} +% \subsection{\texttt{TEI} Un-numbered Divisions} % \label{sec:ekddiv} % \danger As already described \vpageref{ref:divs-opt}, the % un-numbered style of division is the one that is set by default. It @@ -5016,9 +5292,14 @@ subtype="arabtex">'inna 'abI kAna mina % being |1| and the smallest being |9|.\\ % \DescribeOption{toc} % |toc|$=$\verb+book|part|chapter|section|subsection|subsubsection|paragraph|+\\ -% |subparagraph|\hfill\tcboxverb{Default: not set}\\ +% \phantom{|toc|$=$}|subparagraph|\hfill\tcboxverb{Default: not set}\\ % If |toc| be set, the title of the division goes into the table of -% contents at the hierarchic level that is specified as value. +% contents at the hierarchic level that is specified as value.\\ +% \DescribeOption{mark} \newfeature[v1.3] |mark|$=$\meta{signpost} +% \hfill\tcboxverb{Default: none}\\ +% |mark| holds the signpost to be emitted as marker for headers and +% footers. Its value is recalled by \cs{ekdmark} as described below in +% \vref{sec:headers-footers}. % % \paragraph{Formatting the Titles} % \DescribeMacro{\FormatDiv} By design, \pkg{ekdosis} does @@ -5046,10 +5327,11 @@ subtype="arabtex">'inna 'abI kAna mina % here follows how the first three hierarchical levels could be % formatted as un-numbered divisions:--- % +% \captof{Divisions of the body text}[\label{lst:ekddiv-ex}] % \iffalse %<*example> % \fi -\begin{minted}[linenos=false]{latex} +\begin{minted}{latex} % Preamble: \FormatDiv{1}{\begin{center}\Large}{\end{center}} \FormatDiv{2}{\begin{center}\large}{\end{center}} @@ -5159,6 +5441,126 @@ subtype="arabtex">'inna 'abI kAna mina %</example> % \fi % +% \subsection{Headers and Footers} +% \label{sec:headers-footers} +% \newfeature[v1.3] \pkg{ekdosis} provides a mechanism of its own for +% emitting header and footer marks. The first operation consists in +% recording the information to be printed as signpost by means of the +% |mark| optional argument of the \cs{ekddiv} command described above +% in \vref{sec:ekddiv}. +% +% \DescribeMacro{\ekdmark} Once this is done, \cs{ekdmark} can be +% inserted in commands used to make headers and footers where the mark +% is to be printed. +% +% A common layout is that of headers in which one finds printed in +% sequence on even pages the page number, then the author's name, and +% on odd pages the title of the edited text, then the current +% division, then the page number, like so:--- +% +% \needspace{5\baselineskip} +% \begin{xltabular}{1.0\linewidth}{|XcX|} +% \multicolumn{3}{l}{Even pages:}\\ +% \hline +% \cs{thepage} & Hippocratis & \\ +% \hline +% \multicolumn{3}{l}{Odd pages:}\\ +% \hline +% & Epidemiarum liber II, \cs{ekdmark} & \hfill\cs{thepage}\\ +% \hline +% \end{xltabular} +% +% To return to the example provided by \vref{lst:ekddiv-ex}, the mark +% of the current division would be inserted in the third-level +% \cs{ekddiv} command printed at line~28 like so:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[firstnumber=28,linenos]{latex} + \ekddiv{head=1, type=paragraph, depth=3, n=II.1.1, mark={1, 1}} +\end{minted} +% \iffalse +%</example> +% \fi +% +% The following example finally illustrates how the corresponding +% headers and footers can be prepared in a straightforward way with +% the help of the \pkg{titleps} package:\footcite{titleps}--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{latex} +% Preamble: +\usepackage{titleps} +\newpagestyle{edition}{ + \sethead[\thepage][Hippocratis][] + {}{Epidemiarum liber II, \ekdmark}{\thepage} +} +% Apply the page style: +\pagestyle{edition} +\end{minted} +% \iffalse +%</example> +% \fi +% +% \DescribeMacro{\endmark} It must be noted that \cs{ekdmark} is +% designed to print the first mark that is emitted on a given page and +% ignore the mark corresponding to any portion of text that may be +% printed between the top of the page and the point where the first +% mark is called. \cs{endmark} is an argument-less command that can be +% used just at the end of that portion of text to instruct +% \pkg{ekdosis} to print the last-emitted mark of the preceding page +% instead of the first-emitted mark of the current page. +% +% \paragraph{Removing Headers and Footers} +% Pages such as title pages must be printed with empty headers and +% footers. \pkg{ekdosis} must be given control over every item of +% information inserted in these areas beforehand. +% +% \DescribeMacro{\ekdprintmark} +% \cs{ekdprintmark}\marg{selector}\marg{signpost} The signposts +% printed in headers and footers must be passed as second argument of +% \cs{ekdprintmark} so that \pkg{ekdosis} can remove them on pages +% where printing them is not desirable. \meta{selector} refers to +% three symbolic letters where the first can be either |H| or +% |F|\===for \underLine{h}eader or \underLine{f}ooter\===, the second +% |E| or |O|\===for \underLine{o}dd or \underLine{e}ven\===and the +% third |L|, |C| or |R|\===for \underLine{l}eft, \underLine{c}enter or +% \underLine{r}ight. The example provided above would then read as +% follows:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos=false]{latex} +% Preamble: +\usepackage{titleps} +\newpagestyle{edition}{ + \sethead[\ekdprintmark{HEL}{\thepage}] + [\ekdprintmark{HEC}{Hippocratis}] + [] + {} + {\ekdprintmark{HOC}{Epidemiarum liber II, \ekdmark}} + {\ekdprintmark{HOR}{\thepage}} +} +% Apply the page style: +\pagestyle{edition} +\end{minted} +% \iffalse +%</example> +% \fi +% +% \DescribeMacro{\ekdnohfmarks} Once all signposts are marked with +% \cs{ekdprintmark}, \cs{ekdnohfmarks} can be used at any point of the +% document with the same effect as the \LaTeX\ standard command +% \cs{thispagestyle}|{empty}|. +% +% \DescribeMacro{\ekdresethfmarks} Finally, \cs{ekdresethfmarks} is +% provided in rare cases when it is needed to reset headers and +% footers to their original, viz.\ printable state. +% % \section{The Tricks of the Trade} % \label{sec:tricks-of-trade} % As the |.tex| source file is compiled, \pkg{ekdosis} has to compute @@ -5206,7 +5608,9 @@ subtype="arabtex">'inna 'abI kAna mina % pages may result in pages that break just after they begin. % % \paragraph{Conditional page breaks} -% \DescribeMacro{\ekdpb} \cs{ekdpb}\oarg{page no}\marg{line no} +% \phts\label{ref:ekdpb} \DescribeMacro{\ekdpb}\DescribeMacro{\ekdpb*} +% \cs{ekdpb}\oarg{page no}\marg{line no} +% \cs{ekdpb*}|{}| \cs{ekdpb*}|\| % \newfeature[v1.2]\\ % One way to avoid this inconvenience is to use \cs{ekdpb} instead of % the standard \cs{pagebreak} command provided by \LaTeX\ to insert @@ -5216,7 +5620,17 @@ subtype="arabtex">'inna 'abI kAna mina % the page number where the page break should occur. The value that is % expected is the page number as it is printed\===e.g.\ an Arabic, % Roman or alphanumeric number. If the specified conditions be not -% met, then the page break is not triggered. +% met, then the page break is not triggered. Finally, the +% \enquote{starred} version of this command forces the page break, +% irrespective of the values specified as page or line numbers. Unlike +% \cs{ekdpb}, which requires the lines to be numbered, \cs{ekdpb*} is +% allowed at any point of the document: as \cs{ekdpb*} disregards the +% number given as argument, it is equivalent to the standard \LaTeX\ +% \cs{pagebreak} command. Yet it can be used instead of the latter to +% have marks further printed in the margins so as to spot with a +% fleeting glance the locations where induced page breaks +% occur.\footnote{This requires the |showpagebreaks| option to be set +% to |true| as described above \vpageref{ref:showpagebreaks-opt}.} % % \paragraph{Using \texttt{maxentries}} % Another way\---should the edition text fall into the vicious circle @@ -5264,6 +5678,17 @@ subtype="arabtex">'inna 'abI kAna mina % many of them and \pkg{ekdosis} still oscillates between different % sets of page decisions. % +% \paragraph{The \texttt{fitapp} Global Option} +% \newfeature[v1.3] The rationale of this option is discussed above +% (see \vref{ref:fitapp-opt}). As this mechanism has the characters of +% the apparatus block scaled down to allow for more entries once a +% predefined height has been reached, \pkg{ekdosis} should settle down +% in most of the contentious cases.\footnote{That is, cases that arise +% \emph{after} the predefined height has been reached.} However, it is +% advisable to use |fitapp| conjointly with |maxentries| to prevent +% the number of allowed entries from being too high, which would +% result in the characters being too small or even illegible. +% % \subsection{Variae Quaestiones} % \label{sec:variae-quaestiones} % This section is about issues that are not strictly speaking part of @@ -5532,18 +5957,19 @@ subtype="arabtex">'inna 'abI kAna mina % |false| by means of \cs{SetTEIxmlExport} described above. % % \paragraph{The \texttt{xml:id} Attribute} -% As a general rule, the |xml:id| global attribute must be unique for -% the element that bears the attribute. Furthermore, it must begin -% with a letter or an underscore and contain no characters other that -% letters, digits, hyphens, underscores and full stops. \pkg{ekdosis} -% issues a warning when it finds that any \meta{unique id} of -% \meta{unique label} expected in the first argument of -% \cs{DeclareWitness}, \cs{DeclareHand}, \cs{DeclareSource} or -% \cs{DeclareScholar} is not unique or breaks the rules just -% described, but does not prevent the |.tex| source file from -% compiling. Instead, it prints the string |<??>| in place of the -% expected formatted siglum so that the error in the |.tex| source -% file can be easily spotted and corrected. +% \phts\label{ref:xmlid} As a general rule, the |xml:id| global +% attribute must be unique for the element that bears the +% attribute. Furthermore, it must begin with a letter or an underscore +% and contain no characters other than letters of the Latin +% alphabet\--- from |a| to |z|, either upper or lower case\---digits, +% hyphens, underscores and full stops. \pkg{ekdosis} issues a warning +% when it finds that any \meta{unique id} of \meta{unique label} +% expected in the first argument of \cs{DeclareWitness}, +% \cs{DeclareHand}, \cs{DeclareSource} or \cs{DeclareScholar} is not +% unique or breaks the rules just described, but does not prevent the +% |.tex| source file from compiling. Instead, it prints the string +% |<??>| in place of the expected formatted siglum so that the error +% in the |.tex| source file can be easily spotted and corrected. % % \danger As the \meta{unique id} declared with \cs{DeclareShorthand} % is not to be exported in the \texttt{TEI xml} output file, @@ -5790,7 +6216,8 @@ many mathematical writings and to the sense of % example illustrates how \cs{EnvtoTEI} can be used conjointly with % \pkg{babel} to convey information about the languages used from % \LaTeX\ to \texttt{TEI}:--- -% +% +% \phts\label{ref:ancientgreek-ex} % \iffalse %<*example> % \fi @@ -5841,6 +6268,14 @@ many mathematical writings and to the sense of % strings captured are inserted where each of them is expected in % the \texttt{TEI} element. % +% \danger If the entire string to be captured be enclosed in square or +% curly brackets, it is advisable to use |@b|\texttt{\emph{n}} (for +% curly brackets) or |@s|\texttt{\emph{n}} (for square brackets) +% instead of |#|\texttt{\emph{n}}, where \texttt{\emph{n}} is the +% number that is expected in the sequence. This will prevent any +% brackets that may be found in the captured string from being +% interpreted. +% % \danger Strings must be entered exactly as \pkg{ekdosis} will find % them as the |.tex| source file is compiled. Specifically, % \emph{control sequences}, namely the coded commands immediately @@ -5855,14 +6290,22 @@ many mathematical writings and to the sense of % \iffalse %<*example> % \fi -\begin{minted}[linenos=false]{latex} -\TeXtoTEIPat{\textcolor␣{#1}{#2}}{<hi rend="#1">#2</hi>} +\begin{minted}[linenos]{latex} +\TeXtoTEIPat{\textcolor␣{#1}@b2}{<hi rend="#1">@b2</hi>} Sample text with a \textcolor{red}{word} in red. \end{minted} % \iffalse %</example> % \fi +% +% \begin{remarks} +% \item[\textsc{Rem.}] As can be seen from l.~1, it is safe to use +% |#1| for the first string for color names are naturally formed of +% letters without braces. However, |@b2| is preferable to capture +% the whole second argument of \cs{textcolor} for it may contain +% words within braces. +% \end{remarks} % % \iffalse %<*example> @@ -5875,6 +6318,91 @@ Sample text with a \textcolor{red}{word} in red. %</example> % \fi % +% \subsection{Inserting Code in the \texttt{TEI xml} Ouput File} +% \label{sec:inserting-code-tei} +% It may be needed to insert code in the \texttt{TEI xml} output file +% only, for example when clear enough information is written in the +% apparatus criticus by means of such optional arguments as |pre|, +% |post|, |prewit| or |postwit| that are not processed for \texttt{TEI +% xml} ouput.\footnote{See above \vref{sec:single-text-editing}.} +% +% \needspace{2\baselineskip} +% \DescribeMacro{\teidirect} \newfeature[v1.3] \cs{teidirect}\oarg{xml +% attributes}\marg{xml element}\marg{code}\\ +% Two mandatory arguments are expected by \cs{teidirect}, namely the +% \texttt{TEI xml} element followed by the contents to be found in the +% ouput file between the opening and closing tags. Additionally, +% attribute-value pairs to be found inside the start-tag of the +% element can be specified in the optional argument of the command. An +% example follows: +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos]{latex} +% Preamble: +\DeclareWitness{GalE1.M}{Gal.E1(M)}{\emph{Monacencis Gr.} + 231}[origDate=s. XVI] +\DeclareWitness{GalE1.Q}{Gal.E1(Q)}{\emph{Parisinus Gr.} + 2174}[origDate=s. XIV] + \DeclareShorthand{GalE1.M.Q}{Gal.E1(MQ)}{GalE1.M,GalE1.Q} + +% Document: +ἐν \app{ + \lem[wit=codd]{καύμασιν} + \rdg[wit=GalE1.M.Q, postwit=\unskip(23.16)]{καύματι} + \teidirect{note}{p. 23, l. 16 Wenkebach}} +\end{minted} +% \iffalse +%</example> +% \fi +% +% \begin{remarks} +% \item |GalE1.M.Q| (l.~11) has been defined as a shorthand to denote +% the agreement of two otherwise defined manuscripts by means of +% \cs{DeclareWitness}: |GalE1.M| and |GalE1.Q|. (See ll.~2--6.) +% \item The |postwit| optional argument has been used to further +% specify the location where this variant reading can be found in +% the critical edition of Galen's Commentary on Hippocrates' +% \emph{Epidemics}, Book~1 (l.~11). But as the effect of |postwit| +% is limited to the PDF output, \cs{teidirect} has been used to +% convey this item of information to the \texttt{TEI xml} ouput file +% (l.~12). +% \end{remarks} +% +% PDF output:--- +% \medskip +% +% \needspace{7\baselineskip} +% \resetlinenumber +% \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] +% \begin{specimen} +% \begin{ancientgreek} +% ἐν \app{ +% \lem[wit=hcodd]{καύμασιν} +% \rdg[wit=hGalE1.M.Q, postwit=\unskip(23.16)]{καύματι} +% \teidirect{note}{p. 23, l. 16 Wenkebach}} +% \end{ancientgreek} +% \end{specimen} +% \end{alignment} +% +% \texttt{TEI xml} output:--- +% +% \iffalse +%<*example> +% \fi +\begin{minted}[linenos]{xml} +<p xml:lang="grc">ἐν +<app> + <lem wit="#V #I #R #H">καύμασιν</lem> + <rdg wit="#GalE1.#M #GalE1.Q">καύματι</rdg> + <note>p. 23, l. 16 Wenkebach</note> +</app></p> +\end{minted} +% \iffalse +%</example> +% \fi +% % \subsection{Specific \texttt{TEI} Modules} % \label{sec:specific-tei-modules} % The following example illustrates how \pkg{ekdosis} can be adapted @@ -6189,8 +6717,8 @@ Sample text with a \textcolor{red}{word} in red. % \pkg{ekdosis} can also convert into \texttt{TEI xml} references to % cited works. Depending on the optional arguments used in the % citation command, references will be converted into |<ptr>| or -% |<ref>| elements with the appropriate identifier supplied by means -% of the |target| attribute. +% |<bibl>| elements with the appropriate identifier supplied by means +% of the |target| or |corresp| attributes. % % Of course, for this mechanism to work, Bib\TeX\ or Bib\LaTeX\ must % be used and connected to some |.bib| bibliographical database @@ -6210,7 +6738,7 @@ Sample text with a \textcolor{red}{word} in red. % \fi \begin{minted}[linenos=false]{bibtex} @Book{ReynoldsWilson1991, - author = {Reynolds, L. D. and Wilson, N. G}, + author = {Reynolds, L. D. and Wilson, N. G.}, title = {Scribes and Scholars}, year = {1991}, subtitle = {A Guide to the Translation of Greek and Latin @@ -6306,7 +6834,9 @@ Sample text with a \textcolor{red}{word} in red. <text> <body> <p>On textual criticism, see - <ref target="#ReynoldsWilson1991">207--241</ref>.</p> + <bibl corresp="#ReynoldsWilson1991"> + <biblScope>207--241</biblScope> + </bibl>.</p> </body> <back> <listBibl> @@ -6376,8 +6906,6 @@ Sample text with a \textcolor{red}{word} in red. % \item Marginal edition texts: It may happen that the marginalia of % manuscripts contain texts worth editing in addition to and along % the main text to which they are linked by reference signs. -% \item Headers and footers: \cs{ekddiv} will provide top and bottom -% marks to be used in headers and footers. % \end{enumerate} % \item Short-term (months):--- % \begin{enumerate} @@ -7034,6 +7562,8 @@ Sample text with a \textcolor{red}{word} in red. \RequirePackage{expkv-def} \newif\if@pkg@float \newif\if@pkg@footins +\newif\if@pkg@keyfloat +\newif\if@pkg@fitfloat \newif\if@pkg@ekddivs \newif\if@parnotesroman \newif\if@pkg@parnotes @@ -7041,7 +7571,9 @@ Sample text with a \textcolor{red}{word} in red. \newif\if@pkg@poetry@verse \ekvdefinekeys{ekdosis}{ choice layout = {float = {\@pkg@floattrue}, - footins = {\@pkg@floatfalse\@pkg@footinstrue}}, + footins = {\@pkg@floatfalse\@pkg@footinstrue}, + keyfloat = {\@pkg@floatfalse\@pkg@keyfloattrue}, + fitfloat = {\@pkg@floatfalse\@pkg@fitfloattrue}}, initial layout = float, unknown-choice layout = \PackageError{ekdosis}{unknown layout=#1}{`layout' must be either `float' or `footins'.}, @@ -7089,7 +7621,21 @@ Sample text with a \textcolor{red}{word} in red. \RequirePackage{paracol} \RequirePackage{etoolbox} \RequirePackage{lineno} -\RequirePackage{keyfloat} +\if@pkg@float + \RequirePackage{trivfloat} + \trivfloat{ekdapparatus} +\fi +\if@pkg@keyfloat + \RequirePackage{keyfloat} + \def\ekd@keyparopts#1{% + \def\ekd@insert@keyparapp{% + \keyparbox[!b]{#1}{\ekd@insert@apparatus}}} + \ekd@keyparopts{} +\fi +\if@pkg@fitfloat + \RequirePackage{tcolorbox} + \tcbuselibrary{fitting,skins} +\fi \RequirePackage{refcount} \RequirePackage{zref-user} \RequirePackage{zref-abspage} @@ -7112,6 +7658,23 @@ Sample text with a \textcolor{red}{word} in red. \luadirect{ekdosis.closestream()} } % \end{macrocode} +% \paragraph{Setup} +% \begin{macro}{\ekdsetup} +% \changes{v1.3}{2021/08/18}{new command for global options} +% \cs{ekdsetup} is used to specify options that affect the general +% behavior of \pkg{ekdosis}. It is a preamble-only command. +% \begin{macrocode} +\ekvdefinekeys{ekd@setup}{ + bool showpagebreaks = \ifekd@showpb, + store spbmk = \ekd@spbmk, + initial spbmk = spb, + store hpbmk = \ekd@hpbmk, + initial hpbmk = hpb, +} +\NewDocumentCommand{\ekdsetup}{m}{\ekvset{ekd@setup}{#1}} +\@onlypreamble\ekdsetup +% \end{macrocode} +% \end{macro} % \begin{macro}{\SetHooks} \cs{SetHooks} is used to set % hooks meant to be shared by all declared apparatuses, such as the % font size, the format of numerals, \emph{\&c.} This command can be @@ -7120,6 +7683,8 @@ Sample text with a \textcolor{red}{word} in red. % \texttt{lemmastyle}} % \changes{v1.2}{2021/04/02}{general hooks: new option % \texttt{readingstyle}} +% \changes{v1.3}{2021/08/18}{general hooks: new options +% \texttt{keyparopts} and \texttt{appheight}} % \begin{macrocode} \ekvdefinekeys{ekd@hooks}{ store appfontsize = \ekd@appfontsize, @@ -7127,6 +7692,17 @@ Sample text with a \textcolor{red}{word} in red. store postrefnum = \ekd@postrefnum, store lemmastyle = \ekd@lemmastyle, store readingstyle = \ekd@readingstyle, + code keyparopts = \if@pkg@keyfloat\ekd@keyparopts{#1}\fi, + dimen appheight = \ekd@app@height, + initial appheight = .5\textheight, + choice fitalgorithm = {fontsize = \def\ekd@fit@algorithm{fontsize}, + hybrid = \def\ekd@fit@algorithm{hybrid}, + areasize = \def\ekd@fit@algorithm{areasize}, + squeeze = \def\ekd@fit@algorithm{squeeze}}, + initial fitalgorithm = fontsize, + unknown-choice fitalgorithm = \PackageError{ekdosis}{unknown + fitalgorithm=#1}{`fitalgorithm' must be either `fontsize', + `hybrid', `areasize' or `squeeze'.}, code initialrule = \def\ekd@initial@rule{#1\NLS}, default initialrule = \rule{0.4\columnwidth}{0.4pt}, noval noinitialrule = \undef\ekd@initial@rule, @@ -7148,7 +7724,8 @@ Sample text with a \textcolor{red}{word} in red. store collection = \collection@value, store idno = \idno@value, store msName = \msName@value, - store origDate = \origDate@value + store origDate = \origDate@value, + store locus = \locus@value } % \end{macrocode} % \begin{macro}{\DeclareWitness} \cs{DeclareWitness} is a @@ -7171,7 +7748,8 @@ Sample text with a \textcolor{red}{word} in red. \luastringO{\collection@value}, \luastringO{\idno@value}, \luastringO{\msName@value}, - \luastringO{\origDate@value})} + \luastringO{\origDate@value}, + \luastringO{\locus@value})} \egroup } \@onlypreamble\DeclareWitness @@ -7325,6 +7903,16 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{macro} +% \begin{macro}{\teidirect} +% \changes{v1.3}{2021/08/18}{direct insertion of elements in the +% \texttt{TEI xml} file} +% \cs{teidirect}\oarg{xml attributes}\marg{xml element}\marg{code} +% does nothing in \LaTeX. Its only use is to insert elements in the +% \texttt{TEI xml} output file. +% \begin{macrocode} +\NewDocumentCommand{\teidirect}{O{}mm}{\ignorespaces} +% \end{macrocode} +% \end{macro} % \begin{macro}{\EnvtoTEI} % \begin{macro}{\EnvtoTEI*} % \cs{EnvtoTEI}\meta{*}\marg{env name}\marg{TEI element}\oarg{TEI @@ -7390,8 +7978,20 @@ Sample text with a \textcolor{red}{word} in red. \@onlypreamble\AddxmlBibResource % \end{macrocode} % \end{macro} -% -%\paragraph{Multiple-layer apparatuses} +% \begin{macro}{\ekd@test@lang} +% \cs{ekd@test@lang} is used internally by \pkg{ekdosis}. This command +% returns \cs{ekd@lang@pkgtrue} if either \pkg{babel} or +% \pkg{polyglossia} be used so that \cs{languagename} can be inserted +% when and where needed in the apparatus criticus. +% \begin{macrocode} +\newif\ifekd@lang@pkg +\NewDocumentCommand{\ekd@test@lang}{}{% + \ltx@ifpackageloaded{babel}{\ekd@lang@pkgtrue}{}% + \ltx@ifpackageloaded{polyglossia}{\ekd@lang@pkgtrue}{}% +} +% \end{macrocode} +% \end{macro} +% \paragraph{Multiple-layer apparatuses} % \pkg{ekdosis} must know if an entry is to be processed in a single- % or multiple-layer context:--- % \begin{macrocode} @@ -7412,6 +8012,7 @@ Sample text with a \textcolor{red}{word} in red. store ehook = \ehook@val, store maxentries = \limit@val, store lang = \lang@val, + store notelang = \notelang@val, initial direction = LR, initial delim = {}, initial ehook = {\csname ekd@end@apparatus\endcsname} @@ -7444,7 +8045,8 @@ Sample text with a \textcolor{red}{word} in red. \luastringO{\bhook@val}, \luastringO{\ehook@val}, \luastringO{\limit@val}, - \luastringO{\lang@val} + \luastringO{\lang@val}, + \luastringO{\notelang@val} )} \egroup } @@ -7473,29 +8075,42 @@ Sample text with a \textcolor{red}{word} in red. % \cs{ekdpk}\oarg{page no}\marg{line no} is used to insert conditional % page breaks by specifying that the page break should occur only on a % given line and optionally a given page. If the specified conditions -% are met then this command triggers \cs{pagebreak}. +% be met then this command triggers \cs{pagebreak}. % \begin{macrocode} -\NewDocumentCommand{\ekdpb}{o m}{% - \def\@tmpoarg{#1}% - \def\@tmpmarg{#2}% - \luadirect{ekdosis.dolnlab(\luastringN{#2})}% - \linelabel{\luadirect{tex.sprint(ekdosis.getlnlab())}}% - \def\tmp@ln{% - \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% - \def\tmp@pg{% - \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% - \IfNoValueTF{#1} - {\ifnum - \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 - \pagebreak - \fi} - {\ifnum - \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0 - \ifnum - \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 - \pagebreak - \fi - \fi +\newcounter{ekd@pb} +\globalcounter{ekd@pb} +\NewDocumentCommand{\ekdpb}{s o m}{% + \IfBooleanTF{#1} + {\ifekd@showpb\marginpar{\ekd@hpbmk}\fi + \pagebreak} + {% + \def\@tmpoarg{#2}% + \def\@tmpmarg{#3}% + \stepcounter{ekd@pb}% + \linelabel{ekdpb:\theekd@pb}% + \def\tmp@ln{% + \getrefnumber{ekdpb:\theekd@pb}}% + \def\tmp@pg{% + \getpagerefnumber{ekdpb:\theekd@pb}}% + \IfNoValueTF{#2} + {\ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \ifekd@showpb\marginpar{\ekd@spbmk}\fi + \pagebreak + \else + \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi + \fi} + {\ifnum + \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0 + \ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \ifekd@showpb\marginpar{\ekd@spbmk}\fi + \pagebreak + \else + \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi + \fi + \fi + }% }\ignorespaces } % \end{macrocode} @@ -7507,6 +8122,7 @@ Sample text with a \textcolor{red}{word} in red. \newif\ifekd@state \newif\ifekd@isinapp \newif\ifekd@isinlem +\newif\ifekd@appinapp % \end{macrocode} % The next boolean is shared with \pkg{arabluatex}. \cs{LRnum} is used % internally to ensure that numerals referring to line spans are @@ -7581,7 +8197,11 @@ Sample text with a \textcolor{red}{word} in red. initial rule = \rule{0.4\columnwidth}{0.4pt}, noval norule = \def\ekd@default@rule{\mbox{}}, store lang = \ekd@singleapp@lang, - initial lang = \ltx@ifpackageloaded{babel}{\languagename}{} + initial lang = \ltx@ifpackageloaded{babel}{\languagename}{% + \ltx@ifpackageloaded{polyglossia}{\languagename}{}}, + store notelang = \ekd@singleapp@note@lang, + initial notelang = \ltx@ifpackageloaded{babel}{\languagename}{% + \ltx@ifpackageloaded{polyglossia}{\languagename}{}} } % \end{macrocode} % \begin{macro}{\SetApparatus} @@ -7650,6 +8270,18 @@ Sample text with a \textcolor{red}{word} in red. \def\ekd@singleapp@lang{#1}} % \end{macrocode} % \end{macro} +% \begin{macro}{\SetApparatusNoteLanguage} +% \changes{v1.3}{2021/08/18}{defines an alternate language to be +% applied in note apparatus entries} +% \cs{SetApparatusNoteLang}\marg{languagename} can be used when +% it is needed to apply in entries introduced by the \cs{note} command +% a language different from the one that is selected in the edition +% text. +% \begin{macrocode} +\NewDocumentCommand{\SetApparatusNoteLanguage}{m}{% + \def\ekd@singleapp@note@lang{#1}} +% \end{macrocode} +% \end{macro} % \begin{macro}{\footnoteruletrue} % \begin{macro}{\footnoterulefalse} % As \pkg{ekdosis} takes care of drawing a rule separating the main @@ -7723,6 +8355,42 @@ Sample text with a \textcolor{red}{word} in red. % apparatus criticus, a conditional is first defined. % \begin{macrocode} \newif\ifekd@inside@app +% \end{macrocode} +% Then \cs{ekd@fitapp} is defined for |layout=fitapp|:--- +% \begin{macrocode} +\if@pkg@fitfloat + \newtcboxfit{\ekd@fitapp}{% + blankest, + fit basedim = \f@size pt, + fit fontsize macros, + fit height from=0pt to \ekd@app@height, + fit algorithm = \ekd@fit@algorithm, + float=!b} +\fi +% \end{macrocode} +% Finally two commands are used to actually insert the apparatus +% depending on the value set in the |layout| global option. +% \begin{macrocode} +\long\def\ekd@insert@apparatus{% + \unless\ifekd@mapps + \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else + \pardir TLT\leavevmode\textdir TLT\fi + \fi + \if@pkg@parnotes + \if@parnotesroman + \renewcommand*{\theparnotemark}{\roman{parnotemark}}\fi + \parnoteclear\fi + \ekd@inside@apptrue + \ekd@appfontsize + \ifekd@mapps + \ifdefined\ekd@initial@rule + \ekd@initial@rule + \fi + \fi + \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi + \ekd@inside@appfalse + \if@pkg@parnotes\parnotes\parnotereset\fi +}% \def\add@@apparatus{% \if@pkg@parnotes\parnotes\else\fi \if@pkg@footins @@ -7750,26 +8418,15 @@ Sample text with a \textcolor{red}{word} in red. \egroup \fi \if@pkg@float - \keyparbox[!b]{}{% - \unless\ifekd@mapps - \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else - \pardir TLT\leavevmode\textdir TLT\fi - \fi - \if@pkg@parnotes - \if@parnotesroman - \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi - \parnoteclear\else\fi - \ekd@inside@apptrue - \ekd@appfontsize - \ifekd@mapps - \ifdefined\ekd@initial@rule - \ekd@initial@rule - \fi - \fi - \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi - \ekd@inside@appfalse - \if@pkg@parnotes\parnotes\parnotereset\else\fi - }% + \begin{ekdapparatus}[!b]% + \ekd@insert@apparatus + \end{ekdapparatus}% + \fi + \if@pkg@keyfloat + \ekd@insert@keyparapp + \fi + \if@pkg@fitfloat + \ekd@fitapp{\ekd@insert@apparatus}% \fi } % \end{macrocode} @@ -7802,7 +8459,7 @@ Sample text with a \textcolor{red}{word} in red. {\luadirect{tex.sprint(ekdosis.mdvappend(\luastringO{#2}, \luastringO{#1}))}}} % \end{macrocode} -% \paragraph{Lineation settings} +% \paragraph{Lineation Settings} % \begin{macro}{\outerlinenumbers} % \begin{macro}{\innerlinenumbers} % \pkg{ekdosis} does not use the \enquote{pagewise} numbering mode @@ -7849,7 +8506,9 @@ Sample text with a \textcolor{red}{word} in red. \newif\ifekd@elidednumbers \ekvdefinekeys{ekd@lineation}{ choice lineation = {page = \ekd@pagelineationtrue, - document = \ekd@pagelineationfalse}, + document = \ekd@pagelineationfalse, + none = \ekd@pagelineationtrue + \renewcommand\thelinenumber{}}, unknown-choice lineation = \PackageError{ekdosis}{unknown lineation=#1}{`lineation' must be either `page' or `document'.}, choice vlineation = {page = \ekd@pagevlineationtrue, @@ -7921,14 +8580,16 @@ Sample text with a \textcolor{red}{word} in red. \leavevmode \begingroup \ekvset{appnote}{#1}% - \ekd@isinapptrue% + \ifekd@isinapp\ekd@appinapptrue\fi + \ekd@isinapptrue \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% \luadirect{ekdosis.storeabspg( \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}% - \ifekd@state\add@apparatus\fi% + \ifekd@state\add@apparatus\fi \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% - \ekd@isinappfalse% + \ekd@isinappfalse + \ekd@appinappfalse \endgroup} % \end{macrocode} % \end{macro} @@ -7988,10 +8649,16 @@ Sample text with a \textcolor{red}{word} in red. \fi \fi% \else - \LRnum{\getrefnumber{#1}}--% - \LRnum{\getpagerefnumber{#2}}.% - \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos + \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} + {\LRnum{\getrefnumber{#1}}--% + \LRnum{\getpagerefnumber{#2}}.% + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos + {\LRnum{\getrefnumber{#1}}--% + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the nos \fi% + \ifekdn@forcenum + \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% force the no + \fi }% } % \end{macrocode} @@ -8021,6 +8688,28 @@ Sample text with a \textcolor{red}{word} in red. {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = 0 + %%%begin + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} + = + 0 + \ifekd@appinapp + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} + = + 0 + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + \fi + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + %%% end \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% \unexpanded\expandafter{\ekd@postrefnum}% issue the no @@ -8035,6 +8724,28 @@ Sample text with a \textcolor{red}{word} in red. {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = 0 + %%%begin + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} + = + 0 + \ifekd@appinapp + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} + = + 0 + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + \fi + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + %%% end \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% \unexpanded\expandafter{\ekd@postrefnum}% issue the no @@ -8059,17 +8770,27 @@ Sample text with a \textcolor{red}{word} in red. \fi \fi% \else - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% - \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% - \unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos + \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} + {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% + \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos + {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}}% issue the nos \fi% + \ifekdl@forcenum + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% force the no + \fi }% } % \end{macrocode} % Define keys to be used by the optional arguments of \cs{lem} and % \cs{rdg}:--- % \begin{macrocode} +\newif\ifekdl@forcenum +\newif\ifekdl@nonum \ekvdefinekeys{lem}{ code wit = \def\ekdlr@wit{#1}, code source = \def\ekdlr@source{#1}, @@ -8081,6 +8802,8 @@ Sample text with a \textcolor{red}{word} in red. code postwit = \def\ekdlr@postwit{#1}, store type = \ekdlr@type, store sep = \ekdl@sep, + noval nonum = \ekdl@nonumtrue, + noval num = \ekdl@forcenumtrue, bool nolem = \ifekdl@nolem, bool nosep = \ifekdl@nosep, initial sep = \ekdsep @@ -8113,8 +8836,9 @@ Sample text with a \textcolor{red}{word} in red. % \end{macrocode} % \end{macro} % \begin{macro}{\app@lang} -% This macro is used internally by \cs{lem}, \cs{rdg} and \cs{note} to -% set the language for apparatus entries. +% \begin{macro}{\app@note@lang} +% \cs{app@lang} is used internally by \cs{lem} and \cs{rdg} to set the +% language for apparatus entries. \cs{note} uses \cs{\app@note@lang}. % \begin{macrocode} \def\app@lang{% \ifekd@mapps @@ -8123,8 +8847,16 @@ Sample text with a \textcolor{red}{word} in red. \ekd@singleapp@lang \fi } +\def\app@note@lang{% + \ifekd@mapps + \luadirect{tex.sprint(ekdosis.getappnotelang(\luastring{\ekdan@type}))}% + \else + \ekd@singleapp@note@lang + \fi +} % \end{macrocode} % \end{macro} +% \end{macro} % \begin{macro}{\lem} % \cs{lem}\oarg{options}\marg{lemma text} inserts \meta{lemma text} % both in the edition text and in the apparatus criticus by default, @@ -8137,7 +8869,10 @@ Sample text with a \textcolor{red}{word} in red. \luadirect{ekdosis.dolnlab(\luastringN{#2})}% \null \bgroup% + \ekdl@forcenumfalse + \ekdl@nonumfalse \ekvset{lem}{#1}% + \ekd@test@lang \ifekd@mapps% \ifnum% \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} @@ -8157,7 +8892,7 @@ Sample text with a \textcolor{red}{word} in red. \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref}%\hskip .25em}% + \unless\ifekdl@nonum\current@ref\fi}%\hskip .25em}% \else% \ifbool{al@rlmode}{% \edef\lem@app{% @@ -8168,7 +8903,7 @@ Sample text with a \textcolor{red}{word} in red. \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref%\hskip .25em + \unless\ifekdl@nonum\current@ref\fi%\hskip .25em \ifdefined\ekdlr@alt% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi @@ -8203,11 +8938,11 @@ Sample text with a \textcolor{red}{word} in red. \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref%\hskip .25em + \unless\ifekdl@nonum\current@ref\fi%\hskip .25em \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -8218,7 +8953,7 @@ Sample text with a \textcolor{red}{word} in red. \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded{#2}}}{% @@ -8257,6 +8992,7 @@ Sample text with a \textcolor{red}{word} in red. \NewDocumentCommand{\rdg}{O{} m}{% \bgroup% \ekvset{rdg}{#1}% + \ekd@test@lang % \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If % % so, keep in mind \ifekd@mapps, % like so: @@ -8298,7 +9034,7 @@ Sample text with a \textcolor{red}{word} in red. \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -8309,7 +9045,7 @@ Sample text with a \textcolor{red}{word} in red. \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% {\unexpanded\expandafter{\ekd@readingstyle}\unexpanded{#2}}}% @@ -8338,6 +9074,7 @@ Sample text with a \textcolor{red}{word} in red. % Define keys to be used by the optional argument of \cs{note} when % this command is found outside \cs{app}:--- % \begin{macrocode} +\newif\ifekdn@forcenum \ekvdefinekeys{note}{ store type = \ekdan@type, store lem = \ekdn@lem, @@ -8346,7 +9083,9 @@ Sample text with a \textcolor{red}{word} in red. store sep = \ekdn@sep, bool nosep = \ifekdn@nosep, initial type = default, - initial sep = \ekdsep + initial sep = \ekdsep, + bool nonum = \ifekdn@nonum, + noval num = \ekdn@forcenumtrue } % \end{macrocode} % \cs{note@noapp} is used internally when a \cs{note} command is found @@ -8361,6 +9100,7 @@ Sample text with a \textcolor{red}{word} in red. \leavevmode \bgroup% \ekvset{note}{#1}% + \ekd@test@lang \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% \luadirect{ekdosis.storeabspg( @@ -8391,7 +9131,7 @@ Sample text with a \textcolor{red}{word} in red. \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em + \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em \ifdefined\ekdn@lem% {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% \unexpanded\expandafter{\ekdn@lem}}% @@ -8407,9 +9147,9 @@ Sample text with a \textcolor{red}{word} in red. \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em + \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em \ifdefined\ekdn@lem - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdn@lem}}}% @@ -8418,8 +9158,8 @@ Sample text with a \textcolor{red}{word} in red. \unless\ifekdn@nosep \unexpanded\expandafter{\ekdn@sep}\fi \else\fi% - \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% + \ifbool{ekd@lang@pkg}% + {{\noexpand\selectlanguage{\app@note@lang}\unexpanded{#2}}}{% {\unexpanded{#2}}}}}% \ifekd@mapps% \unconditional@appin[\ekdan@type]{\note@contents}% @@ -8466,25 +9206,25 @@ Sample text with a \textcolor{red}{word} in red. \egroup% } \NewDocumentCommand{\ekd@note@star}{O{} m}{% - \if@pkg@parnotes - \bgroup% - \ekvset{ekd@note}{#1}% - \edef\note@contents{% - \ekvifdefinedNoVal{ekd@note}{pre}{}{% - \unexpanded\expandafter{\pre@value}}% - \unskip\noexpand\parnote{\unexpanded{#2}}% - \ekvifdefinedNoVal{ekd@note}{post}{}{% - \unexpanded\expandafter{\post@value}}% - }% - \append@app{\note@contents}% - \egroup% - \else - \ifekd@mapps% + \bgroup + \ekvset{ekd@note}{#1}% + \edef\note@contents{% + \ekvifdefinedNoVal{ekd@note}{pre}{}{% + \unexpanded\expandafter{\pre@value}}% + \if@pkg@parnotes + \unskip\noexpand\parnote{\unexpanded{#2}}% + \else + \unskip\noexpand\footnote{\unexpanded{#2}}% + \fi + \ekvifdefinedNoVal{ekd@note}{post}{}{% + \unexpanded\expandafter{\post@value}}% + }% + \ifekd@mapps \append@app[\ekdan@type]{\note@contents}% - \else% + \else \append@app{\note@contents}% - \fi% - \fi% + \fi + \egroup } \NewDocumentCommand{\note@app}{s O{} +m}{% \ifbool{al@rlmode}{% @@ -8781,6 +9521,116 @@ Sample text with a \textcolor{red}{word} in red. } % \end{macrocode} % \end{environment} +% \paragraph{Headers and Footers} +% \pkg{ekdosis} provides a mechanism of its own for headers and +% footers as follows. Most of it is handled by \textsf{Lua} +% functions. +% \begin{macro}{\ekd@storemark} +% \cs{ekd@storemark} is used internally by the |mark| optional +% argument of \cs{ekddiv} described below to store marks to be +% printed at specific places in headers or footers. +% \begin{macrocode} +\NewDocumentCommand{\ekd@storemark}{m}{% + \stepcounter{ekd@lab}% + \label{ekd:\theekd@lab}% + \luadirect{ekdosis.storehfmark( + \luastring{\getpagerefnumber{ekd:\theekd@lab}}, + \luastringN{#1})}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\endmark} +% \changes{v1.3}{2021/08/18}{prints the last-emitted mark of the +% preceding page} +% By default, \cs{ekdmark} described below prints the first mark +% that is emitted on a given page and ignores the mark corresponding +% to any portion of text that may be printed between the top of the +% page and the point where the first mark is called. \cs{endmark} is +% an argument-less command that can be used just at the end of that +% portion of text to instruct \pkg{ekdosis} to print the last-emitted +% mark of the preceding page instead of the first-emitted mark of the +% current page. +% \begin{macrocode} +\NewDocumentCommand{\endmark}{}{% + \stepcounter{ekd@lab}% + \label{ekd:\theekd@lab}% + \luadirect{ekdosis.storehfmark( + \luastring{\getpagerefnumber{ekd:\theekd@lab}}, + "", "endmk")}% + \ifdefined\xspace\xspace\fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\edkmark} +% \changes{v1.3}{2021/08/18}{prints marks in headers or footers} +% \cs{ekdmark} is an argument-less command called in commands used to +% make headers and footers where the marks stored by means of the +% |mark| optional argument of \cs{ekddiv} are to be printed. +% \begin{macrocode} +\NewDocumentCommand{\ekdmark}{}{% + \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ekdprintmark} +% \changes{v1.3}{2021/08/18}{prints or removes the marks in headers +% and footers} \cs{ekdprintmark}\marg{selector}\marg{signpost} The +% signposts printed in headers and footers must be +% passed as second argument of \cs{ekdprintmark} so that \pkg{ekdosis} +% can remove them on pages where printing them is not +% desirable. \meta{selector} refers to three symbolic letters where +% the first can be either |H| or |F|\===for \underLine{h}eader or +% \underLine{f}ooter\===, the second |E| or |O|\===for \underLine{o}dd +% or \underLine{e}ven\===and the third |L|, |C| or |R|\===for +% \underLine{l}eft, \underLine{c}enter or \underLine{r}ight:--- +% \begin{macrocode} +\ekvdefinekeys{ekd@marks}{ + choice mark = {HEL = \def\ekd@mk{HEL}, + HEC = \def\ekd@mk{HEC}, + HER = \def\ekd@mk{HER}, + HOL = \def\ekd@mk{HOL}, + HOC = \def\ekd@mk{HOC}, + HOR = \def\ekd@mk{HOR}, + FEL = \def\ekd@mk{FEL}, + FEC = \def\ekd@mk{FEC}, + FEL = \def\ekd@mk{FER}, + FOL = \def\ekd@mk{FOL}, + FOC = \def\ekd@mk{FOC}, + FOL = \def\ekd@mk{FOR}}, + unknown-choice mark = \PackageError{ekdosis}{unknown mark=#1}{`mark' + must be either `HEL', `HEC', `HER', `HOL', `HOC', `HOR', `FEL', + \MessageBreak `FEC', `FER', `FOL', `FOC' or `FOR'.} +} +\NewDocumentCommand{\ekdprintmark}{m m}{% + \bgroup + \ekvset{ekd@marks}{mark = #1}% + \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2}, + \luastringO{\ekd@mk}))}% + \egroup +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ekdnofhmarks} +% \changes{v1.3}{2021/08/18}{removes headers and footers on specific +% pages} Once the signposts are marked with \cs{ekdprintmark}, +% \cs{ekdnohfmarks} has the same effect as the \LaTeX\ standard +% command \cs{thispagestyle}|{empty}|. +% \begin{macrocode} +\NewDocumentCommand{\ekdnohfmark}{}{% + \luadirect{ekdosis.nohfmark()}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ekdresethfmarks} +% \changes{v1.3}{2021/08/18}{marks headers and footers as printable} +% \cs{ekdresethfmarks} can be used in rare cases when it is needed to +% reset headers and footers to their original, viz.\ printable state. +% \begin{macrocode} +\NewDocumentCommand{\ekdresethfmarks}{}{% + \luadirect{ekdosis.resethfmark()}% +} +% \end{macrocode} +% \end{macro} % \paragraph{Divisions of the Body} % \pkg{ekdosis} can convert \cs{book}, \cs{part}, \cs{chapter}, % \cs{section}, \cs{subsec{\allowbreak}tion} and \cs{subsubsection} @@ -8817,6 +9667,7 @@ Sample text with a \textcolor{red}{word} in red. code head = \def\head@value{#1}, code barehead = \def\barehead@value{#1}, store depth = \depth@value, + code mark = \ekd@storemark{#1}, choice toc = {book = \def\toc@value{book}, part = \def\toc@value{part}, chapter = \def\toc@value{chapter}, @@ -9071,6 +9922,9 @@ local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1) local app = lpeg.Cs("app") local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) local note = lpeg.Cs("note") +local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" } +local inanchor = lpeg.Cs{ "<anchor" * ((1 - (lpeg.P"<" + lpeg.P">")) + lpeg.V(1))^0 * ">" } +local inopeningnote = lpeg.Cs{ "<note" * ((1 - (lpeg.P"<" + lpeg.P">")) + lpeg.V(1))^0 * ">" } local lnbrk = lpeg.Cs("\\\\") local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1 * spcenc^-1) local poemlinebreak = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.P(">") * bsqbrackets^-1 * spcenc^-1) @@ -9127,7 +9981,7 @@ end local function checkxmlid(str) if string.find(str, "^[0-9]") - or string.find(str, "[:; ]") + or string.find(str, "[%{%}%[%]%(%):; ]") then return false else @@ -9194,7 +10048,8 @@ function ekdosis.newwitness(id, Collection, Idno, MsName, - OrigDate) + OrigDate, + Locus) if xmlidfound(id) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" @@ -9230,6 +10085,10 @@ function ekdosis.newwitness(id, listWit[indexwit].history = {} listWit[indexwit].history.origin = {origDate = OrigDate} end + if Locus ~= "" then + listWit[indexwit].msContents = {} + listWit[indexwit].msContents.msItemStruct = {locus = Locus} + end end return true end @@ -9374,19 +10233,22 @@ function ekdosis.getsiglum(str, opt) ctrl = str if opt == "tei" then for i = 1,#shorthands do - str = string.gsub(str, shorthands[i].a, shorthands[i].c) + local tempa = string.gsub(shorthands[i].a, "([%-%.%_])", "%%%1") + str = string.gsub(str, tempa, shorthands[i].c) end for i = 1,#idsRend do - str = string.gsub(str, "(%f[%w])"..idsRend[i].xmlid.."(%,)", + local tempb = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1") + str = string.gsub(str, "(%f[%w%-%.%_])"..tempb.."(%,)", "%1#"..idsRend[i].xmlid.."%2") - ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "") + ctrl = string.gsub(ctrl, tempb.."%,", "") end str = string.gsub(str, "%,(%s-)([%#])", " %2") str = string.gsub(str, "%,$", "") else for i = 1,#idsRend do - str = string.gsub(str, idsRend[i].xmlid.."%,", idsRend[i].abbr) - ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "") + local tempc = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1") + str = string.gsub(str, tempc.."%,", idsRend[i].abbr) + ctrl = string.gsub(ctrl, tempc.."%,", "") end end -- if string.find(ctrl, "[A-Za-z0-9]") @@ -9409,14 +10271,18 @@ local cmdtotags = { {a="marginpar", b="note", c=" place=\"margin\""}, {a="footnote", b="note", c=" place=\"bottom\""}, {a="enquote", b="quote", c=""}, + {a="prname *", b="span", + c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, + {a="prname", b="span", + c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""}, {a="txtrans", b="s", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, {a="textbf", b="hi", c=" rend=\"bold\""}, {a="textit", b="hi", c=" rend=\"italic\""}, {a="textsc", b="hi", c=" rend=\"smallcaps\""}, {a="textsf", b="hi", c=" rend=\"sf\""}, {a="arbup", b="hi", c=" rend=\"sup\""}, - {a="txarb", b="s", c=" xml:lang=\"arb\""}, - {a="arb", b="foreign", + {a="txarb", b="foreign", c=" xml:lang=\"arb\""}, + {a="arb", b="span", c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""} } @@ -9428,22 +10294,31 @@ local texpatttotags = { {a="\\resetvlinenumber%s+", b=""}, {a="\\resetlinenumber%s+%[(.-)%]", b=""}, {a="\\resetlinenumber%s+", b=""}, + {a="\\ekdresethfmarks%s+", b=""}, {a="\\indentpattern%s+{(.-)}", b=""}, + {a="\\ekdnohfmark%s+", b=""}, {a="\\settowidth%s+{(.-)}{(.-)}", b=""}, {a="\\poemlines%s+{(.-)}", b=""}, {a="\\pagebreak%s+%[[1-4]%]", b=""}, {a="\\pagebreak%s+", b=""}, + {a="\\teidirect%s+(%b[]){(.-)}(%b{})", b="<%2 ekd@os%1ekd@cs>ekd@ob%3ekd@cb</%2>"}, + {a="\\teidirect%s+{(.-)}(%b{})", b="<%1>ekd@ob%2ekd@cb</%1>"}, {a="\\altrfont%s+", b=""}, - {a="\\mbox%s+{(.-)}", b="%1"}, - {a="\\LR%s+{(.-)}", b="%1"}, - {a="\\RL%s+{(.-)}", b="%1"}, + {a="\\endmark%s+", b=""}, + {a="\\ekdpb%s+%*?%[(.-)%]{(.-)}", b=""}, + {a="\\ekdpb%s+%*?{(.-)}", b=""}, + {a="\\ekdpb%s+%*\\?", b=""}, + {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, + {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, + {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"}, {a="\\%=%=%=%s?", b="—"}, {a="\\%-%-%-%s?", b="—"}, {a="\\%=%=%s?", b="–"}, {a="\\%-%-%s?", b="–"}, {a="\\%=%/%s?", b="‐"}, {a="\\%-%/%s?", b="‐"}, - {a="\\vin%s+", b=""} + {a="\\vin%s+", b=""}, + {a="\\uc%s+(%b{})", b="ekd@ob%1ekd@cb"} } local envtotags = { @@ -9487,8 +10362,12 @@ end function ekdosis.newpatttotag(pat, repl) pat = string.gsub(pat, "([%[%]])", "%%%1") + pat = string.gsub(pat, "%@b[1-9]", "(%%b{})") + pat = string.gsub(pat, "%@s[1-9]", "(%%b[])") pat = string.gsub(pat, "%#[1-9]", "(.-)") repl = string.gsub(repl, "%#([1-9])", "%%%1") + repl = string.gsub(repl, "%@b([1-9])", "ekd@ob%%%1ekd@cb") + repl = string.gsub(repl, "%@s([1-9])", "ekd@os%%%1ekd@cs") if isintable(texpatttotags, pat) then local index = get_a_index(pat, texpatttotags) @@ -9581,6 +10460,22 @@ local function note_totei(str) return str end +local function remove_extra_anchors(str) + str = gsub(str, lpeg.Cs("</note>") * inanchor * inopeningnote, function(enote, anchor, bnote) + local id_one = string.gsub(anchor, "(%<anchor )(.-)(/%>)", "%2") + id_one = string.sub(get_attr_value(id_one, "xml:id"), 2, -2) + local id_two = string.match(bnote, "target%=.-right%((.-)%)") + id_two = string.gsub(id_two, ".-right%((.-)%)", "%1") + if id_one == id_two + then + return string.format("%s%s", enote, bnote) + else + return string.format("%s%s%s", enote, anchor, bnote) + end + end) + return str +end + local function app_totei(str) str = gsub(str, dblbkslash * @@ -9667,7 +10562,16 @@ local function lem_rdg_totei(str) end local function relocate_notes(str) - str = string.gsub(str, "(%<lem.-%>.-)(%<note.->.-%<%/note%>)(.-%<%/lem%>)", "%1%3%2") + str = gsub(str, inlem, function(arg) + local notes = {} + for i in string.gmatch(arg, "%<note.-%>.-%<%/note%>") + do + table.insert(notes, i) + end + allnotes = table.concat(notes) + arg = string.gsub(arg, "%<note.->.-%<%/note%>", "") + return string.format("%s%s", arg, allnotes) + end) return str end @@ -9786,6 +10690,10 @@ end local function texpatttotei(str) for i = 1,#texpatttotags do str = string.gsub(str, texpatttotags[i].a, texpatttotags[i].b) + str = string.gsub(str, "ekd@ob%{", "") + str = string.gsub(str, "%}ekd@cb", "") + str = string.gsub(str, "ekd@os%[", "") + str = string.gsub(str, "%]ekd@cs", "") end return str end @@ -9811,7 +10719,8 @@ local function icitetotei(str) "Please pick another id.}}") else end - return string.format("%s <ref target=\"#%s\">%s</ref>", pre, body, post) + return string.format("%s <bibl corresp=\"#%s\"><biblScope>%s</biblScope></bibl>", + pre, body, post) end) str = gsub(str, lpeg.P("\\") * citecmds @@ -9831,7 +10740,7 @@ local function icitetotei(str) "Please pick another id.}}") else end - return string.format("<ref target=\"#%s\">%s</ref>", body, post) + return string.format("<bibl corresp=\"#%s\"><biblScope>%s</biblScope></bibl>", body, post) end) str = gsub(str, lpeg.P("\\") * citecmds @@ -9987,6 +10896,86 @@ local function self_close_tags(str) return str end +--headers and footers +local hfmarks = {} + +function ekdosis.storehfmark(page, mk, opt) + if opt == "endmk" + then + local emark = hfmarks[#hfmarks].mark + table.insert(hfmarks, {a = page, mark = emark}) + else + table.insert(hfmarks, {a = page, mark = mk}) + end + return true +end + +local printhfmarks = { + HEL = true, + HEC = true, + HER = true, + HOL = true, + HOC = true, + HOR = true, + FOL = true, + FOC = true, + FOR = true, + FEL = true, + FEC = true, + FER = true, +} + +function ekdosis.nohfmark() + printhfmarks.HEL = false + printhfmarks.HEC = false + printhfmarks.HER = false + printhfmarks.HOL = false + printhfmarks.HOC = false + printhfmarks.HOR = false + printhfmarks.FOL = false + printhfmarks.FOC = false + printhfmarks.FOR = false + printhfmarks.FEL = false + printhfmarks.FEC = false + printhfmarks.FER = false +end + +function ekdosis.resethfmark() + printhfmarks.HEL = true + printhfmarks.HEC = true + printhfmarks.HER = true + printhfmarks.HOL = true + printhfmarks.HOC = true + printhfmarks.HOR = true + printhfmarks.FOL = true + printhfmarks.FOC = true + printhfmarks.FOR = true + printhfmarks.FEL = true + printhfmarks.FEC = true + printhfmarks.FER = true +end + +function ekdosis.printmark(str, mk) + if printhfmarks[mk] + then + return str + else + printhfmarks[mk] = true + return "" + end +end + +function ekdosis.gethfmark(page) + local indexpage = get_a_index(page, hfmarks) + if hfmarks[indexpage] ~= nil + then + return hfmarks[indexpage].mark + else + return hfmarks[#hfmarks-1].mark or "" + end +end + +-- divisions of the body text local divdepth = { book = 1, part = 2, @@ -10195,7 +11184,7 @@ end local function close_ekddivs_in_between(str) local maxdepth = 1 - for i in string.gmatch(str, "<div.-depth=\"(%d)\".->", "%1") + for i in string.gmatch(str, "<div.-[Dd]epth=\"(%d)\".->", "%1") do if tonumber(i) > tonumber(maxdepth) then @@ -10220,9 +11209,9 @@ local function close_ekddivs_in_between(str) do closedivs = closedivs.."</div>" firstdivindex = firstdivindex - 1 + bdivii = string.gsub(bdivii, "depth", "Depth") end end - bdivii = string.gsub(bdivii, "depth", "Depth") return string.format("%s%s%s%s%s%s%s%s", bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) @@ -10255,9 +11244,9 @@ local function close_ndivs_in_between(str) do closedivs = closedivs.."</div"..used_ndivs[firstdivindex].a..">" firstdivindex = firstdivindex - 1 + bdivii = string.gsub(bdivii, "div", "Div") end end - bdivii = string.gsub(bdivii, "div", "Div") return string.format("%s%s%s%s%s%s%s%s", bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) @@ -10276,6 +11265,7 @@ local function textotei(str) str = xml_entities(str) str = texpatttotei(str) str = note_totei(str) + str = remove_extra_anchors(str) str = app_totei(str) str = rdgGrp_totei(str) str = lem_rdg_totei(str) @@ -10384,7 +11374,14 @@ function ekdosis.openteistream() end f:write("</handDesc>", "\n") f:write("</physDesc>", "\n") - else end + else end + if listWit[i].msContents ~= nil then + f:write("<msContents>", "\n") + f:write("<msItemStruct>", "\n") + f:write("<locus>", textotei(listWit[i].msContents.msItemStruct.locus), "</locus>", "\n") + f:write("</msItemStruct>", "\n") + f:write("</msContents>", "\n") + end if listWit[i].history ~= nil then f:write("<history>", "\n") f:write("<origin>", "\n") @@ -10525,7 +11522,15 @@ function ekdosis.basic_cs(msid) else date = "" end - return siglum.."&"..name.."&"..date + if listWit[indexwit].msContents ~= nil + and + listWit[indexwit].msContents.msItemStruct ~= nil + then + locus = listWit[indexwit].msContents.msItemStruct.locus + else + locus = "" + end + return siglum.."&"..name.." "..locus.."&"..date end -- end basic TeX Conspectus siglorum @@ -10804,7 +11809,8 @@ function ekdosis.newapparatus(teitype, appbhook, appehook, applimit, - applang) + applang, + appnotelang) if isintable(apparatuses, teitype) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" @@ -10819,7 +11825,8 @@ function ekdosis.newapparatus(teitype, bhook = appbhook, ehook = appehook, limit = applimit, - lang = applang}) + lang = applang, + notelang = appnotelang}) end bagunits[teitype] = 1 return true @@ -10835,6 +11842,16 @@ function ekdosis.getapplang(teitype) end end +function ekdosis.getappnotelang(teitype) + i = get_a_index(teitype, apparatuses) + if apparatuses[i].notelang ~= "" + then + return apparatuses[i].notelang + else + return "\\languagename" + end +end + function ekdosis.getappdelim(str) for i = 1,#apparatuses do @@ -10873,7 +11890,7 @@ end function ekdosis.limit_bagunits(teitype) local limit = tonumber(getapplimit(teitype)) - if limit >= 10 and bagunits[teitype] > limit + if limit >= 10 and bagunits[teitype] >= limit then bagunits[teitype] = 2 return "\\pagebreak" @@ -11129,6 +12146,8 @@ local lnlabs = {} local lnlab_salt = 0 local current_lnlab = nil local prev_lnlab = nil +local prev_prev_lnlab = nil +local notelabs = {} local current_notelab = nil local prev_notelab = nil local current_lemma = nil @@ -11142,6 +12161,7 @@ local function mdvisintable(table, value) end function ekdosis.dolnlab(str) + if prev_lnlab ~= nil then prev_prev_lnlab = prev_lnlab end prev_lnlab = current_lnlab current_lemma = str i = md5.sumhexa(str) @@ -11164,9 +12184,19 @@ function ekdosis.getprevlnlab() return prev_lnlab end +function ekdosis.getprevprevlnlab() + return prev_prev_lnlab +end + function ekdosis.setnotelab(str) current_notelab = str - return "\\linelabel{" .. current_notelab .. "}" + if isfound(notelabs, current_notelab) + then + return "" + else + table.insert(notelabs, current_notelab) + return "\\linelabel{" .. current_notelab .. "}" + end end function ekdosis.getnotelab() @@ -11182,8 +12212,12 @@ function ekdosis.getprevnotelab() return prev_notelab end -local function remove_note(str) - str = gsub(str, dblbkslash * lpeg.P("note") * cmdargs, "") +local cmdstorm = lpeg.P(lpeg.P("note") + + lpeg.P("linelabel") + + lpeg.P("index")) + +local function remove_from_app(str) + str = gsub(str, dblbkslash * cmdstorm * cmdargs, "") return str end @@ -11197,7 +12231,7 @@ function ekdosis.mdvappend(str, teitype) "\\linelabel{" .. current_lnlab .. "-e}" .. "\\csname append@app\\endcsname{" - .. remove_note(str) .. "}" + .. remove_from_app(str) .. "}" else return "\\linelabel{" .. current_lnlab .. "-b}\\wordboundary{}" .. @@ -11206,7 +12240,7 @@ function ekdosis.mdvappend(str, teitype) "\\linelabel{" .. current_lnlab .. "-e}" .. "\\csname append@app\\endcsname" .. "[" .. teitype .. "]{" - .. remove_note(str) .. "}" + .. remove_from_app(str) .. "}" end end diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua index 4916d9c586b..f5f9bd22c41 100644 --- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua +++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.lua @@ -51,6 +51,9 @@ local cmdargs = lpeg.Cs(spce^-1 * bsqbracketsii * bcbracesii * bsqbrackets^-1) local app = lpeg.Cs("app") local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) local note = lpeg.Cs("note") +local inlem = lpeg.Cs{ "<lem" * ((1 - (lpeg.P"<lem" + lpeg.P"</lem>")) + lpeg.V(1))^0 * "</lem>" } +local inanchor = lpeg.Cs{ "<anchor" * ((1 - (lpeg.P"<" + lpeg.P">")) + lpeg.V(1))^0 * ">" } +local inopeningnote = lpeg.Cs{ "<note" * ((1 - (lpeg.P"<" + lpeg.P">")) + lpeg.V(1))^0 * ">" } local lnbrk = lpeg.Cs("\\\\") local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1 * spcenc^-1) local poemlinebreak = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.P(">") * bsqbrackets^-1 * spcenc^-1) @@ -107,7 +110,7 @@ end local function checkxmlid(str) if string.find(str, "^[0-9]") - or string.find(str, "[:; ]") + or string.find(str, "[%{%}%[%]%(%):; ]") then return false else @@ -174,7 +177,8 @@ function ekdosis.newwitness(id, Collection, Idno, MsName, - OrigDate) + OrigDate, + Locus) if xmlidfound(id) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" @@ -210,6 +214,10 @@ function ekdosis.newwitness(id, listWit[indexwit].history = {} listWit[indexwit].history.origin = {origDate = OrigDate} end + if Locus ~= "" then + listWit[indexwit].msContents = {} + listWit[indexwit].msContents.msItemStruct = {locus = Locus} + end end return true end @@ -354,19 +362,22 @@ function ekdosis.getsiglum(str, opt) ctrl = str if opt == "tei" then for i = 1,#shorthands do - str = string.gsub(str, shorthands[i].a, shorthands[i].c) + local tempa = string.gsub(shorthands[i].a, "([%-%.%_])", "%%%1") + str = string.gsub(str, tempa, shorthands[i].c) end for i = 1,#idsRend do - str = string.gsub(str, "(%f[%w])"..idsRend[i].xmlid.."(%,)", + local tempb = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1") + str = string.gsub(str, "(%f[%w%-%.%_])"..tempb.."(%,)", "%1#"..idsRend[i].xmlid.."%2") - ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "") + ctrl = string.gsub(ctrl, tempb.."%,", "") end str = string.gsub(str, "%,(%s-)([%#])", " %2") str = string.gsub(str, "%,$", "") else for i = 1,#idsRend do - str = string.gsub(str, idsRend[i].xmlid.."%,", idsRend[i].abbr) - ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "") + local tempc = string.gsub(idsRend[i].xmlid, "([%-%.%_])", "%%%1") + str = string.gsub(str, tempc.."%,", idsRend[i].abbr) + ctrl = string.gsub(ctrl, tempc.."%,", "") end end -- if string.find(ctrl, "[A-Za-z0-9]") @@ -389,14 +400,18 @@ local cmdtotags = { {a="marginpar", b="note", c=" place=\"margin\""}, {a="footnote", b="note", c=" place=\"bottom\""}, {a="enquote", b="quote", c=""}, + {a="prname *", b="span", + c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, + {a="prname", b="span", + c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""}, {a="txtrans", b="s", c=" xml:lang=\"ar-Latn\" type=\"transliterated\""}, {a="textbf", b="hi", c=" rend=\"bold\""}, {a="textit", b="hi", c=" rend=\"italic\""}, {a="textsc", b="hi", c=" rend=\"smallcaps\""}, {a="textsf", b="hi", c=" rend=\"sf\""}, {a="arbup", b="hi", c=" rend=\"sup\""}, - {a="txarb", b="s", c=" xml:lang=\"arb\""}, - {a="arb", b="foreign", + {a="txarb", b="foreign", c=" xml:lang=\"arb\""}, + {a="arb", b="span", c=" xml:lang=\"ar-Latn\" type=\"transliterated\" subtype=\"arabtex\""} } @@ -408,22 +423,31 @@ local texpatttotags = { {a="\\resetvlinenumber%s+", b=""}, {a="\\resetlinenumber%s+%[(.-)%]", b=""}, {a="\\resetlinenumber%s+", b=""}, + {a="\\ekdresethfmarks%s+", b=""}, {a="\\indentpattern%s+{(.-)}", b=""}, + {a="\\ekdnohfmark%s+", b=""}, {a="\\settowidth%s+{(.-)}{(.-)}", b=""}, {a="\\poemlines%s+{(.-)}", b=""}, {a="\\pagebreak%s+%[[1-4]%]", b=""}, {a="\\pagebreak%s+", b=""}, + {a="\\teidirect%s+(%b[]){(.-)}(%b{})", b="<%2 ekd@os%1ekd@cs>ekd@ob%3ekd@cb</%2>"}, + {a="\\teidirect%s+{(.-)}(%b{})", b="<%1>ekd@ob%2ekd@cb</%1>"}, {a="\\altrfont%s+", b=""}, - {a="\\mbox%s+{(.-)}", b="%1"}, - {a="\\LR%s+{(.-)}", b="%1"}, - {a="\\RL%s+{(.-)}", b="%1"}, + {a="\\endmark%s+", b=""}, + {a="\\ekdpb%s+%*?%[(.-)%]{(.-)}", b=""}, + {a="\\ekdpb%s+%*?{(.-)}", b=""}, + {a="\\ekdpb%s+%*\\?", b=""}, + {a="\\mbox%s+(%b{})", b="ekd@ob%1ekd@cb"}, + {a="\\LR%s+(%b{})", b="ekd@ob%1ekd@cb"}, + {a="\\RL%s+(%b{})", b="ekd@ob%1ekd@cb"}, {a="\\%=%=%=%s?", b="—"}, {a="\\%-%-%-%s?", b="—"}, {a="\\%=%=%s?", b="–"}, {a="\\%-%-%s?", b="–"}, {a="\\%=%/%s?", b="‐"}, {a="\\%-%/%s?", b="‐"}, - {a="\\vin%s+", b=""} + {a="\\vin%s+", b=""}, + {a="\\uc%s+(%b{})", b="ekd@ob%1ekd@cb"} } local envtotags = { @@ -467,8 +491,12 @@ end function ekdosis.newpatttotag(pat, repl) pat = string.gsub(pat, "([%[%]])", "%%%1") + pat = string.gsub(pat, "%@b[1-9]", "(%%b{})") + pat = string.gsub(pat, "%@s[1-9]", "(%%b[])") pat = string.gsub(pat, "%#[1-9]", "(.-)") repl = string.gsub(repl, "%#([1-9])", "%%%1") + repl = string.gsub(repl, "%@b([1-9])", "ekd@ob%%%1ekd@cb") + repl = string.gsub(repl, "%@s([1-9])", "ekd@os%%%1ekd@cs") if isintable(texpatttotags, pat) then local index = get_a_index(pat, texpatttotags) @@ -561,6 +589,22 @@ local function note_totei(str) return str end +local function remove_extra_anchors(str) + str = gsub(str, lpeg.Cs("</note>") * inanchor * inopeningnote, function(enote, anchor, bnote) + local id_one = string.gsub(anchor, "(%<anchor )(.-)(/%>)", "%2") + id_one = string.sub(get_attr_value(id_one, "xml:id"), 2, -2) + local id_two = string.match(bnote, "target%=.-right%((.-)%)") + id_two = string.gsub(id_two, ".-right%((.-)%)", "%1") + if id_one == id_two + then + return string.format("%s%s", enote, bnote) + else + return string.format("%s%s%s", enote, anchor, bnote) + end + end) + return str +end + local function app_totei(str) str = gsub(str, dblbkslash * @@ -647,7 +691,16 @@ local function lem_rdg_totei(str) end local function relocate_notes(str) - str = string.gsub(str, "(%<lem.-%>.-)(%<note.->.-%<%/note%>)(.-%<%/lem%>)", "%1%3%2") + str = gsub(str, inlem, function(arg) + local notes = {} + for i in string.gmatch(arg, "%<note.-%>.-%<%/note%>") + do + table.insert(notes, i) + end + allnotes = table.concat(notes) + arg = string.gsub(arg, "%<note.->.-%<%/note%>", "") + return string.format("%s%s", arg, allnotes) + end) return str end @@ -766,6 +819,10 @@ end local function texpatttotei(str) for i = 1,#texpatttotags do str = string.gsub(str, texpatttotags[i].a, texpatttotags[i].b) + str = string.gsub(str, "ekd@ob%{", "") + str = string.gsub(str, "%}ekd@cb", "") + str = string.gsub(str, "ekd@os%[", "") + str = string.gsub(str, "%]ekd@cs", "") end return str end @@ -791,7 +848,8 @@ local function icitetotei(str) "Please pick another id.}}") else end - return string.format("%s <ref target=\"#%s\">%s</ref>", pre, body, post) + return string.format("%s <bibl corresp=\"#%s\"><biblScope>%s</biblScope></bibl>", + pre, body, post) end) str = gsub(str, lpeg.P("\\") * citecmds @@ -811,7 +869,7 @@ local function icitetotei(str) "Please pick another id.}}") else end - return string.format("<ref target=\"#%s\">%s</ref>", body, post) + return string.format("<bibl corresp=\"#%s\"><biblScope>%s</biblScope></bibl>", body, post) end) str = gsub(str, lpeg.P("\\") * citecmds @@ -967,6 +1025,86 @@ local function self_close_tags(str) return str end +--headers and footers +local hfmarks = {} + +function ekdosis.storehfmark(page, mk, opt) + if opt == "endmk" + then + local emark = hfmarks[#hfmarks].mark + table.insert(hfmarks, {a = page, mark = emark}) + else + table.insert(hfmarks, {a = page, mark = mk}) + end + return true +end + +local printhfmarks = { + HEL = true, + HEC = true, + HER = true, + HOL = true, + HOC = true, + HOR = true, + FOL = true, + FOC = true, + FOR = true, + FEL = true, + FEC = true, + FER = true, +} + +function ekdosis.nohfmark() + printhfmarks.HEL = false + printhfmarks.HEC = false + printhfmarks.HER = false + printhfmarks.HOL = false + printhfmarks.HOC = false + printhfmarks.HOR = false + printhfmarks.FOL = false + printhfmarks.FOC = false + printhfmarks.FOR = false + printhfmarks.FEL = false + printhfmarks.FEC = false + printhfmarks.FER = false +end + +function ekdosis.resethfmark() + printhfmarks.HEL = true + printhfmarks.HEC = true + printhfmarks.HER = true + printhfmarks.HOL = true + printhfmarks.HOC = true + printhfmarks.HOR = true + printhfmarks.FOL = true + printhfmarks.FOC = true + printhfmarks.FOR = true + printhfmarks.FEL = true + printhfmarks.FEC = true + printhfmarks.FER = true +end + +function ekdosis.printmark(str, mk) + if printhfmarks[mk] + then + return str + else + printhfmarks[mk] = true + return "" + end +end + +function ekdosis.gethfmark(page) + local indexpage = get_a_index(page, hfmarks) + if hfmarks[indexpage] ~= nil + then + return hfmarks[indexpage].mark + else + return hfmarks[#hfmarks-1].mark or "" + end +end + +-- divisions of the body text local divdepth = { book = 1, part = 2, @@ -1175,7 +1313,7 @@ end local function close_ekddivs_in_between(str) local maxdepth = 1 - for i in string.gmatch(str, "<div.-depth=\"(%d)\".->", "%1") + for i in string.gmatch(str, "<div.-[Dd]epth=\"(%d)\".->", "%1") do if tonumber(i) > tonumber(maxdepth) then @@ -1200,9 +1338,9 @@ local function close_ekddivs_in_between(str) do closedivs = closedivs.."</div>" firstdivindex = firstdivindex - 1 + bdivii = string.gsub(bdivii, "depth", "Depth") end end - bdivii = string.gsub(bdivii, "depth", "Depth") return string.format("%s%s%s%s%s%s%s%s", bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) @@ -1235,9 +1373,9 @@ local function close_ndivs_in_between(str) do closedivs = closedivs.."</div"..used_ndivs[firstdivindex].a..">" firstdivindex = firstdivindex - 1 + bdivii = string.gsub(bdivii, "div", "Div") end end - bdivii = string.gsub(bdivii, "div", "Div") return string.format("%s%s%s%s%s%s%s%s", bdivi, ndivi, edivi, between, closedivs, bdivii, ndivii, edivii) @@ -1256,6 +1394,7 @@ local function textotei(str) str = xml_entities(str) str = texpatttotei(str) str = note_totei(str) + str = remove_extra_anchors(str) str = app_totei(str) str = rdgGrp_totei(str) str = lem_rdg_totei(str) @@ -1364,7 +1503,14 @@ function ekdosis.openteistream() end f:write("</handDesc>", "\n") f:write("</physDesc>", "\n") - else end + else end + if listWit[i].msContents ~= nil then + f:write("<msContents>", "\n") + f:write("<msItemStruct>", "\n") + f:write("<locus>", textotei(listWit[i].msContents.msItemStruct.locus), "</locus>", "\n") + f:write("</msItemStruct>", "\n") + f:write("</msContents>", "\n") + end if listWit[i].history ~= nil then f:write("<history>", "\n") f:write("<origin>", "\n") @@ -1505,7 +1651,15 @@ function ekdosis.basic_cs(msid) else date = "" end - return siglum.."&"..name.."&"..date + if listWit[indexwit].msContents ~= nil + and + listWit[indexwit].msContents.msItemStruct ~= nil + then + locus = listWit[indexwit].msContents.msItemStruct.locus + else + locus = "" + end + return siglum.."&"..name.." "..locus.."&"..date end -- end basic TeX Conspectus siglorum @@ -1784,7 +1938,8 @@ function ekdosis.newapparatus(teitype, appbhook, appehook, applimit, - applang) + applang, + appnotelang) if isintable(apparatuses, teitype) then tex.print("\\unexpanded{\\PackageWarning{ekdosis}{\"" @@ -1799,7 +1954,8 @@ function ekdosis.newapparatus(teitype, bhook = appbhook, ehook = appehook, limit = applimit, - lang = applang}) + lang = applang, + notelang = appnotelang}) end bagunits[teitype] = 1 return true @@ -1815,6 +1971,16 @@ function ekdosis.getapplang(teitype) end end +function ekdosis.getappnotelang(teitype) + i = get_a_index(teitype, apparatuses) + if apparatuses[i].notelang ~= "" + then + return apparatuses[i].notelang + else + return "\\languagename" + end +end + function ekdosis.getappdelim(str) for i = 1,#apparatuses do @@ -1853,7 +2019,7 @@ end function ekdosis.limit_bagunits(teitype) local limit = tonumber(getapplimit(teitype)) - if limit >= 10 and bagunits[teitype] > limit + if limit >= 10 and bagunits[teitype] >= limit then bagunits[teitype] = 2 return "\\pagebreak" @@ -2109,6 +2275,8 @@ local lnlabs = {} local lnlab_salt = 0 local current_lnlab = nil local prev_lnlab = nil +local prev_prev_lnlab = nil +local notelabs = {} local current_notelab = nil local prev_notelab = nil local current_lemma = nil @@ -2122,6 +2290,7 @@ local function mdvisintable(table, value) end function ekdosis.dolnlab(str) + if prev_lnlab ~= nil then prev_prev_lnlab = prev_lnlab end prev_lnlab = current_lnlab current_lemma = str i = md5.sumhexa(str) @@ -2144,9 +2313,19 @@ function ekdosis.getprevlnlab() return prev_lnlab end +function ekdosis.getprevprevlnlab() + return prev_prev_lnlab +end + function ekdosis.setnotelab(str) current_notelab = str - return "\\linelabel{" .. current_notelab .. "}" + if isfound(notelabs, current_notelab) + then + return "" + else + table.insert(notelabs, current_notelab) + return "\\linelabel{" .. current_notelab .. "}" + end end function ekdosis.getnotelab() @@ -2162,8 +2341,12 @@ function ekdosis.getprevnotelab() return prev_notelab end -local function remove_note(str) - str = gsub(str, dblbkslash * lpeg.P("note") * cmdargs, "") +local cmdstorm = lpeg.P(lpeg.P("note") + + lpeg.P("linelabel") + + lpeg.P("index")) + +local function remove_from_app(str) + str = gsub(str, dblbkslash * cmdstorm * cmdargs, "") return str end @@ -2177,7 +2360,7 @@ function ekdosis.mdvappend(str, teitype) "\\linelabel{" .. current_lnlab .. "-e}" .. "\\csname append@app\\endcsname{" - .. remove_note(str) .. "}" + .. remove_from_app(str) .. "}" else return "\\linelabel{" .. current_lnlab .. "-b}\\wordboundary{}" .. @@ -2186,7 +2369,7 @@ function ekdosis.mdvappend(str, teitype) "\\linelabel{" .. current_lnlab .. "-e}" .. "\\csname append@app\\endcsname" .. "[" .. teitype .. "]{" - .. remove_note(str) .. "}" + .. remove_from_app(str) .. "}" end end diff --git a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty index c313fe5d29c..2bacb9f9159 100644 --- a/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty +++ b/Master/texmf-dist/tex/lualatex/ekdosis/ekdosis.sty @@ -41,13 +41,15 @@ %% Running "make inst" installs the files in the user's TeX tree. \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ekdosis} - [2021/04/02 v1.2 Typesetting TEI xml-compliant critical editions] + [2021/08/18 v1.3 Typesetting TEI xml-compliant critical editions] \RequirePackage{iftex} \RequireLuaTeX \RequirePackage{expkv-opt} \RequirePackage{expkv-def} \newif\if@pkg@float \newif\if@pkg@footins +\newif\if@pkg@keyfloat +\newif\if@pkg@fitfloat \newif\if@pkg@ekddivs \newif\if@parnotesroman \newif\if@pkg@parnotes @@ -55,7 +57,9 @@ \newif\if@pkg@poetry@verse \ekvdefinekeys{ekdosis}{ choice layout = {float = {\@pkg@floattrue}, - footins = {\@pkg@floatfalse\@pkg@footinstrue}}, + footins = {\@pkg@floatfalse\@pkg@footinstrue}, + keyfloat = {\@pkg@floatfalse\@pkg@keyfloattrue}, + fitfloat = {\@pkg@floatfalse\@pkg@fitfloattrue}}, initial layout = float, unknown-choice layout = \PackageError{ekdosis}{unknown layout=#1}{`layout' must be either `float' or `footins'.}, @@ -95,7 +99,21 @@ \RequirePackage{paracol} \RequirePackage{etoolbox} \RequirePackage{lineno} -\RequirePackage{keyfloat} +\if@pkg@float + \RequirePackage{trivfloat} + \trivfloat{ekdapparatus} +\fi +\if@pkg@keyfloat + \RequirePackage{keyfloat} + \def\ekd@keyparopts#1{% + \def\ekd@insert@keyparapp{% + \keyparbox[!b]{#1}{\ekd@insert@apparatus}}} + \ekd@keyparopts{} +\fi +\if@pkg@fitfloat + \RequirePackage{tcolorbox} + \tcbuselibrary{fitting,skins} +\fi \RequirePackage{refcount} \RequirePackage{zref-user} \RequirePackage{zref-abspage} @@ -112,12 +130,32 @@ \AtEndDocument{ \luadirect{ekdosis.closestream()} } +\ekvdefinekeys{ekd@setup}{ + bool showpagebreaks = \ifekd@showpb, + store spbmk = \ekd@spbmk, + initial spbmk = spb, + store hpbmk = \ekd@hpbmk, + initial hpbmk = hpb, +} +\NewDocumentCommand{\ekdsetup}{m}{\ekvset{ekd@setup}{#1}} +\@onlypreamble\ekdsetup \ekvdefinekeys{ekd@hooks}{ store appfontsize = \ekd@appfontsize, store refnumstyle = \ekd@refnumstyle, store postrefnum = \ekd@postrefnum, store lemmastyle = \ekd@lemmastyle, store readingstyle = \ekd@readingstyle, + code keyparopts = \if@pkg@keyfloat\ekd@keyparopts{#1}\fi, + dimen appheight = \ekd@app@height, + initial appheight = .5\textheight, + choice fitalgorithm = {fontsize = \def\ekd@fit@algorithm{fontsize}, + hybrid = \def\ekd@fit@algorithm{hybrid}, + areasize = \def\ekd@fit@algorithm{areasize}, + squeeze = \def\ekd@fit@algorithm{squeeze}}, + initial fitalgorithm = fontsize, + unknown-choice fitalgorithm = \PackageError{ekdosis}{unknown + fitalgorithm=#1}{`fitalgorithm' must be either `fontsize', + `hybrid', `areasize' or `squeeze'.}, code initialrule = \def\ekd@initial@rule{#1\NLS}, default initialrule = \rule{0.4\columnwidth}{0.4pt}, noval noinitialrule = \undef\ekd@initial@rule, @@ -135,7 +173,8 @@ store collection = \collection@value, store idno = \idno@value, store msName = \msName@value, - store origDate = \origDate@value + store origDate = \origDate@value, + store locus = \locus@value } \NewDocumentCommand{\DeclareWitness}{m m m O{}}{% \bgroup @@ -150,7 +189,8 @@ \luastringO{\collection@value}, \luastringO{\idno@value}, \luastringO{\msName@value}, - \luastringO{\origDate@value})} + \luastringO{\origDate@value}, + \luastringO{\locus@value})} \egroup } \@onlypreamble\DeclareWitness @@ -214,6 +254,7 @@ \luastringN{#2}, \luastringN{#3})} } +\NewDocumentCommand{\teidirect}{O{}mm}{\ignorespaces} \NewDocumentCommand{\EnvtoTEI}{s m m O{}}{% \IfBooleanTF{#1}{% \luadirect{ekdosis.newenvtotag(\luastringN{#2}, @@ -237,6 +278,11 @@ \luadirect{ekdosis.addxmlbibresource(\luastringN{#1})} } \@onlypreamble\AddxmlBibResource +\newif\ifekd@lang@pkg +\NewDocumentCommand{\ekd@test@lang}{}{% + \ltx@ifpackageloaded{babel}{\ekd@lang@pkgtrue}{}% + \ltx@ifpackageloaded{polyglossia}{\ekd@lang@pkgtrue}{}% +} \newif\ifekd@mapps \ekvdefinekeys{ekd@newapp}{ choice direction = {LR = \def\direction@val{LR}, @@ -251,6 +297,7 @@ store ehook = \ehook@val, store maxentries = \limit@val, store lang = \lang@val, + store notelang = \notelang@val, initial direction = LR, initial delim = {}, initial ehook = {\csname ekd@end@apparatus\endcsname} @@ -270,7 +317,8 @@ \luastringO{\bhook@val}, \luastringO{\ehook@val}, \luastringO{\limit@val}, - \luastringO{\lang@val} + \luastringO{\lang@val}, + \luastringO{\notelang@val} )} \egroup } @@ -279,33 +327,47 @@ \luadirect{ekdosis.addto_bagunits(\luastringO{#1}, \luastringN{#2})}% \ignorespaces } -\NewDocumentCommand{\ekdpb}{o m}{% - \def\@tmpoarg{#1}% - \def\@tmpmarg{#2}% - \luadirect{ekdosis.dolnlab(\luastringN{#2})}% - \linelabel{\luadirect{tex.sprint(ekdosis.getlnlab())}}% - \def\tmp@ln{% - \getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% - \def\tmp@pg{% - \getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}}}% - \IfNoValueTF{#1} - {\ifnum - \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 - \pagebreak - \fi} - {\ifnum - \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0 - \ifnum - \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 - \pagebreak - \fi - \fi +\newcounter{ekd@pb} +\globalcounter{ekd@pb} +\NewDocumentCommand{\ekdpb}{s o m}{% + \IfBooleanTF{#1} + {\ifekd@showpb\marginpar{\ekd@hpbmk}\fi + \pagebreak} + {% + \def\@tmpoarg{#2}% + \def\@tmpmarg{#3}% + \stepcounter{ekd@pb}% + \linelabel{ekdpb:\theekd@pb}% + \def\tmp@ln{% + \getrefnumber{ekdpb:\theekd@pb}}% + \def\tmp@pg{% + \getpagerefnumber{ekdpb:\theekd@pb}}% + \IfNoValueTF{#2} + {\ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \ifekd@showpb\marginpar{\ekd@spbmk}\fi + \pagebreak + \else + \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi + \fi} + {\ifnum + \pdf@strcmp{\@tmpoarg}{\tmp@pg} = 0 + \ifnum + \pdf@strcmp{\@tmpmarg}{\tmp@ln} = 0 + \ifekd@showpb\marginpar{\ekd@spbmk}\fi + \pagebreak + \else + \ifekd@showpb\marginpar{[\ekd@spbmk]}\fi + \fi + \fi + }% }\ignorespaces } \newbool{do@app} \newif\ifekd@state \newif\ifekd@isinapp \newif\ifekd@isinlem +\newif\ifekd@appinapp \providebool{al@rlmode} \@ifpackageloaded{arabluatex}{}{% \def\setRL{\booltrue{al@rlmode}\pardir TRT\textdir TRT} @@ -356,7 +418,11 @@ initial rule = \rule{0.4\columnwidth}{0.4pt}, noval norule = \def\ekd@default@rule{\mbox{}}, store lang = \ekd@singleapp@lang, - initial lang = \ltx@ifpackageloaded{babel}{\languagename}{} + initial lang = \ltx@ifpackageloaded{babel}{\languagename}{% + \ltx@ifpackageloaded{polyglossia}{\languagename}{}}, + store notelang = \ekd@singleapp@note@lang, + initial notelang = \ltx@ifpackageloaded{babel}{\languagename}{% + \ltx@ifpackageloaded{polyglossia}{\languagename}{}} } \NewDocumentCommand{\SetApparatus}{m}{ \ekvset{default@app}{#1} @@ -369,6 +435,8 @@ \NewDocumentCommand{\SetUnitDelimiter}{m}{\def\ekd@unit@delim{#1}} \NewDocumentCommand{\SetApparatusLanguage}{m}{% \def\ekd@singleapp@lang{#1}} +\NewDocumentCommand{\SetApparatusNoteLanguage}{m}{% + \def\ekd@singleapp@note@lang{#1}} \newif\iffootnoterule \footnoteruletrue \let\dflt@footnoterule\footnoterule @@ -401,6 +469,35 @@ \newif\ifsubsq@unit \subsq@unittrue \newif\ifekd@inside@app +\if@pkg@fitfloat + \newtcboxfit{\ekd@fitapp}{% + blankest, + fit basedim = \f@size pt, + fit fontsize macros, + fit height from=0pt to \ekd@app@height, + fit algorithm = \ekd@fit@algorithm, + float=!b} +\fi +\long\def\ekd@insert@apparatus{% + \unless\ifekd@mapps + \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else + \pardir TLT\leavevmode\textdir TLT\fi + \fi + \if@pkg@parnotes + \if@parnotesroman + \renewcommand*{\theparnotemark}{\roman{parnotemark}}\fi + \parnoteclear\fi + \ekd@inside@apptrue + \ekd@appfontsize + \ifekd@mapps + \ifdefined\ekd@initial@rule + \ekd@initial@rule + \fi + \fi + \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi + \ekd@inside@appfalse + \if@pkg@parnotes\parnotes\parnotereset\fi +}% \def\add@@apparatus{% \if@pkg@parnotes\parnotes\else\fi \if@pkg@footins @@ -428,26 +525,15 @@ \egroup \fi \if@pkg@float - \keyparbox[!b]{}{% - \unless\ifekd@mapps - \ifrtl@app\pardir TRT\leavevmode\textdir TRT\else - \pardir TLT\leavevmode\textdir TLT\fi - \fi - \if@pkg@parnotes - \if@parnotesroman - \renewcommand*{\theparnotemark}{\roman{parnotemark}}\else\fi - \parnoteclear\else\fi - \ekd@inside@apptrue - \ekd@appfontsize - \ifekd@mapps - \ifdefined\ekd@initial@rule - \ekd@initial@rule - \fi - \fi - \apparatus\unless\ifekd@mapps\ekd@end@apparatus\fi - \ekd@inside@appfalse - \if@pkg@parnotes\parnotes\parnotereset\else\fi - }% + \begin{ekdapparatus}[!b]% + \ekd@insert@apparatus + \end{ekdapparatus}% + \fi + \if@pkg@keyfloat + \ekd@insert@keyparapp + \fi + \if@pkg@fitfloat + \ekd@fitapp{\ekd@insert@apparatus}% \fi } \def\add@apparatus{% @@ -498,7 +584,9 @@ \newif\ifekd@elidednumbers \ekvdefinekeys{ekd@lineation}{ choice lineation = {page = \ekd@pagelineationtrue, - document = \ekd@pagelineationfalse}, + document = \ekd@pagelineationfalse, + none = \ekd@pagelineationtrue + \renewcommand\thelinenumber{}}, unknown-choice lineation = \PackageError{ekdosis}{unknown lineation=#1}{`lineation' must be either `page' or `document'.}, choice vlineation = {page = \ekd@pagevlineationtrue, @@ -544,14 +632,16 @@ \leavevmode \begingroup \ekvset{appnote}{#1}% - \ekd@isinapptrue% + \ifekd@isinapp\ekd@appinapptrue\fi + \ekd@isinapptrue \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% \luadirect{ekdosis.storeabspg( \luastring{\zref@extract{ekd:\theekd@lab}{abspage}})}% - \ifekd@state\add@apparatus\fi% + \ifekd@state\add@apparatus\fi \luadirect{tex.sprint(ekdosis.removesp(\luastringN{#2}))}% - \ekd@isinappfalse% + \ekd@isinappfalse + \ekd@appinappfalse \endgroup} \def\current@ref@arg#1#2{{%\textdir TLT% \unexpanded\expandafter{\ekd@refnumstyle}% @@ -604,10 +694,16 @@ \fi \fi% \else - \LRnum{\getrefnumber{#1}}--% - \LRnum{\getpagerefnumber{#2}}.% - \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos + \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} + {\LRnum{\getrefnumber{#1}}--% + \LRnum{\getpagerefnumber{#2}}.% + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos + {\LRnum{\getrefnumber{#1}}--% + \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}}% issue the nos \fi% + \ifekdn@forcenum + \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% force the no + \fi }% } \def\current@ref{{%\textdir TLT% @@ -632,6 +728,28 @@ {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = 0 + %%%begin + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} + = + 0 + \ifekd@appinapp + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} + = + 0 + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + \fi + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + %%% end \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% \unexpanded\expandafter{\ekd@postrefnum}% issue the no @@ -646,6 +764,28 @@ {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-b}} = 0 + %%%begin + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevlnlab())}-e}} + = + 0 + \ifekd@appinapp + \ifnum% + \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} + = + 0 + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + \fi + \else + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% issue the no + \fi + %%% end \else \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% \unexpanded\expandafter{\ekd@postrefnum}% issue the no @@ -670,13 +810,23 @@ \fi \fi% \else - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% - \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% - \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% - \unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos + \ifboolexpr{bool {ekd@pagelineation} or bool {ekd@pagevlineation}} + {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% + \LRnum{\getpagerefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}.% + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}}% issue pg and ln nos + {\LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}--% + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% + \unexpanded\expandafter{\ekd@postrefnum}}% issue the nos \fi% + \ifekdl@forcenum + \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% + \unexpanded\expandafter{\ekd@postrefnum}% force the no + \fi }% } +\newif\ifekdl@forcenum +\newif\ifekdl@nonum \ekvdefinekeys{lem}{ code wit = \def\ekdlr@wit{#1}, code source = \def\ekdlr@source{#1}, @@ -688,6 +838,8 @@ code postwit = \def\ekdlr@postwit{#1}, store type = \ekdlr@type, store sep = \ekdl@sep, + noval nonum = \ekdl@nonumtrue, + noval num = \ekdl@forcenumtrue, bool nolem = \ifekdl@nolem, bool nosep = \ifekdl@nosep, initial sep = \ekdsep @@ -714,12 +866,22 @@ \ekd@singleapp@lang \fi } +\def\app@note@lang{% + \ifekd@mapps + \luadirect{tex.sprint(ekdosis.getappnotelang(\luastring{\ekdan@type}))}% + \else + \ekd@singleapp@note@lang + \fi +} \NewDocumentCommand{\lem}{O{} m}{% \ekd@isinlemtrue% \luadirect{ekdosis.dolnlab(\luastringN{#2})}% \null \bgroup% + \ekdl@forcenumfalse + \ekdl@nonumfalse \ekvset{lem}{#1}% + \ekd@test@lang \ifekd@mapps% \ifnum% \luadirect{tex.sprint(ekdosis.get_bagunits(\luastringO{\ekdan@type}))} @@ -739,7 +901,7 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref}%\hskip .25em}% + \unless\ifekdl@nonum\current@ref\fi}%\hskip .25em}% \else% \ifbool{al@rlmode}{% \edef\lem@app{% @@ -750,7 +912,7 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref%\hskip .25em + \unless\ifekdl@nonum\current@ref\fi%\hskip .25em \ifdefined\ekdlr@alt% \ifdefined\ekdlr@post% \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi @@ -785,11 +947,11 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref%\hskip .25em + \unless\ifekdl@nonum\current@ref\fi%\hskip .25em \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -800,7 +962,7 @@ \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded{#2}}}{% @@ -831,6 +993,7 @@ \NewDocumentCommand{\rdg}{O{} m}{% \bgroup% \ekvset{rdg}{#1}% + \ekd@test@lang % \ifekdr@nordg\append@app{}\else% do we need \append@app{} here? If % % so, keep in mind \ifekd@mapps, % like so: @@ -872,7 +1035,7 @@ \ifdefined\ekdlr@alt% \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdlr@alt}}}% @@ -883,7 +1046,7 @@ \else \ifdefined\ekdlr@pre% \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@readingstyle}% \noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% {\unexpanded\expandafter{\ekd@readingstyle}\unexpanded{#2}}}% @@ -907,6 +1070,7 @@ \fi% \egroup% } +\newif\ifekdn@forcenum \ekvdefinekeys{note}{ store type = \ekdan@type, store lem = \ekdn@lem, @@ -915,12 +1079,15 @@ store sep = \ekdn@sep, bool nosep = \ifekdn@nosep, initial type = default, - initial sep = \ekdsep + initial sep = \ekdsep, + bool nonum = \ifekdn@nonum, + noval num = \ekdn@forcenumtrue } \NewDocumentCommand{\note@noapp}{O{} +m}{% \leavevmode \bgroup% \ekvset{note}{#1}% + \ekd@test@lang \stepcounter{ekd@lab}% \zlabel{ekd:\theekd@lab}% \luadirect{ekdosis.storeabspg( @@ -951,7 +1118,7 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em + \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em \ifdefined\ekdn@lem% {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% \unexpanded\expandafter{\ekdn@lem}}% @@ -967,9 +1134,9 @@ \else% \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% \fi% - \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em + \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em \ifdefined\ekdn@lem - \ltx@ifpackageloaded{babel}% + \ifbool{ekd@lang@pkg}% {{\unexpanded\expandafter{\ekd@lemmastyle}% \noexpand\selectlanguage{\app@lang}% \unexpanded\expandafter{\ekdn@lem}}}% @@ -978,8 +1145,8 @@ \unless\ifekdn@nosep \unexpanded\expandafter{\ekdn@sep}\fi \else\fi% - \ltx@ifpackageloaded{babel}% - {{\noexpand\selectlanguage{\app@lang}\unexpanded{#2}}}{% + \ifbool{ekd@lang@pkg}% + {{\noexpand\selectlanguage{\app@note@lang}\unexpanded{#2}}}{% {\unexpanded{#2}}}}}% \ifekd@mapps% \unconditional@appin[\ekdan@type]{\note@contents}% @@ -1013,25 +1180,25 @@ \egroup% } \NewDocumentCommand{\ekd@note@star}{O{} m}{% - \if@pkg@parnotes - \bgroup% - \ekvset{ekd@note}{#1}% - \edef\note@contents{% - \ekvifdefinedNoVal{ekd@note}{pre}{}{% - \unexpanded\expandafter{\pre@value}}% - \unskip\noexpand\parnote{\unexpanded{#2}}% - \ekvifdefinedNoVal{ekd@note}{post}{}{% - \unexpanded\expandafter{\post@value}}% - }% - \append@app{\note@contents}% - \egroup% - \else - \ifekd@mapps% + \bgroup + \ekvset{ekd@note}{#1}% + \edef\note@contents{% + \ekvifdefinedNoVal{ekd@note}{pre}{}{% + \unexpanded\expandafter{\pre@value}}% + \if@pkg@parnotes + \unskip\noexpand\parnote{\unexpanded{#2}}% + \else + \unskip\noexpand\footnote{\unexpanded{#2}}% + \fi + \ekvifdefinedNoVal{ekd@note}{post}{}{% + \unexpanded\expandafter{\post@value}}% + }% + \ifekd@mapps \append@app[\ekdan@type]{\note@contents}% - \else% + \else \append@app{\note@contents}% - \fi% - \fi% + \fi + \egroup } \NewDocumentCommand{\note@app}{s O{} +m}{% \ifbool{al@rlmode}{% @@ -1207,6 +1374,54 @@ \luadirect{ekdosis.flushenvdata()} \luadirect{ekdosis.flushcolnums()} } +\NewDocumentCommand{\ekd@storemark}{m}{% + \stepcounter{ekd@lab}% + \label{ekd:\theekd@lab}% + \luadirect{ekdosis.storehfmark( + \luastring{\getpagerefnumber{ekd:\theekd@lab}}, + \luastringN{#1})}% +} +\NewDocumentCommand{\endmark}{}{% + \stepcounter{ekd@lab}% + \label{ekd:\theekd@lab}% + \luadirect{ekdosis.storehfmark( + \luastring{\getpagerefnumber{ekd:\theekd@lab}}, + "", "endmk")}% + \ifdefined\xspace\xspace\fi +} +\NewDocumentCommand{\ekdmark}{}{% + \luadirect{tex.sprint(ekdosis.gethfmark(\luastring{\thepage}))}% +} +\ekvdefinekeys{ekd@marks}{ + choice mark = {HEL = \def\ekd@mk{HEL}, + HEC = \def\ekd@mk{HEC}, + HER = \def\ekd@mk{HER}, + HOL = \def\ekd@mk{HOL}, + HOC = \def\ekd@mk{HOC}, + HOR = \def\ekd@mk{HOR}, + FEL = \def\ekd@mk{FEL}, + FEC = \def\ekd@mk{FEC}, + FEL = \def\ekd@mk{FER}, + FOL = \def\ekd@mk{FOL}, + FOC = \def\ekd@mk{FOC}, + FOL = \def\ekd@mk{FOR}}, + unknown-choice mark = \PackageError{ekdosis}{unknown mark=#1}{`mark' + must be either `HEL', `HEC', `HER', `HOL', `HOC', `HOR', `FEL', + \MessageBreak `FEC', `FER', `FOL', `FOC' or `FOR'.} +} +\NewDocumentCommand{\ekdprintmark}{m m}{% + \bgroup + \ekvset{ekd@marks}{mark = #1}% + \luadirect{tex.sprint(ekdosis.printmark(\luastringN{#2}, + \luastringO{\ekd@mk}))}% + \egroup +} +\NewDocumentCommand{\ekdnohfmark}{}{% + \luadirect{ekdosis.nohfmark()}% +} +\NewDocumentCommand{\ekdresethfmarks}{}{% + \luadirect{ekdosis.resethfmark()}% +} \NewDocumentCommand{\MkBodyDivs}{mmmmmm}{ \luadirect{ekdosis.mkdivdepths( \luastringN{#1}, @@ -1224,6 +1439,7 @@ code head = \def\head@value{#1}, code barehead = \def\barehead@value{#1}, store depth = \depth@value, + code mark = \ekd@storemark{#1}, choice toc = {book = \def\toc@value{book}, part = \def\toc@value{part}, chapter = \def\toc@value{chapter}, |