From 67361972da8072e57f1afe3226bf387de99c5bb8 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sun, 7 Mar 2021 13:47:53 +0100 Subject: improved makefile. new command/options for setting the language in the apparatus. new command \resetvlinenumber. improving verse patterns and documenting for v1.2 --- Makefile | 34 +++++++++++------- ekdosis.dtx | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 122 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 694b884..649af77 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,10 @@ SAMPLES := samples exts := md html ins dtx el findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)") +define do_documentation + $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx >/dev/null +endef + all: sty $(NAME).pdf testsamples: @@ -23,24 +27,26 @@ sty: clean $(NAME).pdf: testsamples $(NAME).dtx @ echo "Making the sample files first..." - $(MAKE) --directory=$(SAMPLES) - @ echo "Building the documentation of $(NAME)..." - $(CMP) --shell-escape --recorder --interaction=batchmode $(NAME).dtx >/dev/null - biber $(NAME) >/dev/null - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi - if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null - $(CMP) --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null + @ $(MAKE) --directory=$(SAMPLES) >/dev/null + @ echo "Done making samples" + @ echo "Building the documentation of $(NAME). Please be patient..." + @ $(do_documentation) + @ echo "Now calling biber" + @ biber $(NAME) >/dev/null + @ echo "Returning to lualatex..." + @ for run in {1..4}; do $(do_documentation); done + @ echo "Building indexes..." + @ if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi + @ if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi + @ echo "Final runs of lualatex..." + @ for run in {1..3}; do $(call do_documentation); done + @ echo "Done" samples: clean sty $(MAKE) --directory=$(SAMPLES) clean: testsamples + @ echo "Cleaning $(NAME) directory" rm -rf auto rm -f $(NAME).bib $(PWD)/TMP/*.bib rm -rf .backup @@ -66,12 +72,14 @@ uninst: rm -rf $(HOMEDIR)/.emacs.d/auctex/auto/$(NAME).{el,elc} inst: uninst auctex all + @ echo "Installing $(NAME) locally" mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) cp $(NAME).dtx $(UTREE)/source/lualatex/$(NAME) cp $(NAME).sty $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).lua $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).pdf $(UTREE)/doc/lualatex/$(NAME) cp -r samples/ $(UTREE)/doc/lualatex/$(NAME) + @ echo "Installation complete. Happy TeXing!" local: uninst auctex $(CMP) $(NAME).ins diff --git a/ekdosis.dtx b/ekdosis.dtx index 6f85753..36d6e8c 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx @@ -145,6 +145,16 @@ along with this program. If not, see publisher = {Harper \& Brothers}, location = {New York}} +@MVBook{HomerMurray, + author = {{Homer}}, + title = {The Odyssey}, + date = 1919, + editor = {Murray, A.T\adddot}, + volumes = 2, + publisher = {Harvard University Press -- William Heinemann}, + location = {Cambridge, MA. -- London} +} + @Book{ReynoldsWilson1991, author = {Reynolds, L. D. and Wilson, N. G}, title = {Scribes and Scholars}, @@ -245,6 +255,15 @@ along with this program. If not, see version = {3.47} } +@Software{verse, + title = {The Verse package}, + subtitle = {Aids for typesetting simple verse}, + author = {Wilson, Peter R. and Robertson, Will}, + url = {http://www.ctan.org/pkg/verse}, + date = {2014-05-10}, + version = {2.4b} +} + @Software{arabluatex, title = {The Arabluatex package}, titleaddon = {ArabTeX for LuaLaTeX}, @@ -358,6 +377,8 @@ along with this program. If not, see \DeclareWitness{sV}{V}{Vaticanus lat. 1652}[ origDate=s. XV] \DeclareSource{sDrak}{\emph{Drakenborch}} +% Homer, Odyssey +\DeclareScholar{Zen}{Zen.}[rawname=Zenodotus] \end{filecontents} \documentclass{ltxdoc} %\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} @@ -988,7 +1009,17 @@ along with this program. If not, see % % \danger It must be noted that the two styles are mutually exclusive. % \vskip\baselineskip -% +% +% \DescribeOption{verse}\label{ref:verse-opt} +% |verse|$=$\verb+true|false+ +% \hfill\tcboxverb{Default: false}\\ +% This named argument does not need a value as it defaults to |true| +% if it is used. |verse| instructs \pkg{ekdosis} to load and use the +% facilites supplied by the \pkg{verse} package for typesetting lines +% of poetry. The \env{ekdverse} environment must then be used instead +% of the \env{verse} environment that is provided by the \pkg{verse} +% package as described below in \vref{sec:poetry}. +% % \DescribeOption{parnotes}\label{ref:parnotes-opt} % |parnotes|$=$\verb+true|false|roman+% % \hfill\tcboxverb{Default: not set}\\ @@ -2981,7 +3012,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % % \DescribeMacro{\SetApparatusLanguage} % \label{ref:app-lang}\newfeature[v1.2] -% \cs{SetApparatusLang}\marg{languagename} can be used when it is +% \cs{SetApparatusLanguage}\marg{languagename} can be used when it is % needed to apply in the apparatus criticus a language different from % the one that is selected in the edition text. % @@ -3019,7 +3050,8 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % |norule| does not accept any value and has the same effect as % |rule=none|.\label{ref:apparatus-settings-e}\\ % \DescribeOption{lang} |lang|$=$\meta{languagename} -% \newfeature[v1.2]\hfill\tcboxverb{Default: not set}\\ +% \newfeature[v1.2]\label{ref:app-lang-opt} +% \hfill\tcboxverb{Default: not set}\\ % |lang=| is used as described \vpageref{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 @@ -3119,7 +3151,7 @@ texts=latin[xml:lang="la"]+\textcolor{red}{;}+ % \DescribeOption{ehook} % \DescribeOption{rule} % \DescribeOption{norule} -% \DescribeOption{lang} +% \DescribeOption{lang}\label{ref:apps-lang-opt} % 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 @@ -3470,6 +3502,40 @@ argument of the % \section{Poetry} % \label{sec:poetry} % +% \begingroup +% \setcolumnwidth{0.6\textwidth} +% \setlength{\leftmargini}{0em} +% \needspace{7\baselineskip} +% \resetlinenumber +% \begin{alignment}[flush, +% lcols=2, +% texts=homer[xml:lang="grc"];murray, +% apparatus=homer] +% \AtBeginEnvironment{homer}{\selectlanguage{greek}} +% \setlength{\vrightskip}{0.25em} +% \setverselinenums{1}{0} +% \begin{homer} +% \begin{ekdverse} +% Ἄνδρα μοι ἔννεπε, Μοῦσα, πολύτροπον, ὃς μάλα πολλὰ \\ +% πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν· \\ +% πολλῶν δ' ἀνθρώπων ἴδεν ἄστεα καὶ +% \app{\lem{νόον} +% \rdg[resp=Zen]{νόμον} +% \note{Cf. Schol.}} ἔγνω, \\ +% πολλὰ δ' ὅ γ' ἐν πόντῳ πάθεν ἄλγεα ὃν κατὰ θυμόν, \\ +% ἀρνύμενος ἥν τε ψυχὴν καὶ νόστον ἑταίρων. \\ +% \end{ekdverse} +% \end{homer} +% \begin{murray} +% Tell me, O Muse, of the man of many devices, who wandered full +% many ways after he had sacked the sacred citadel of Troy. Many +% were the men whose cities he saw and whose mind he learned, aye, +% and many the woes he suffered in his heart upon the sea, seeking +% to win his own life and the return of his +% comrades.\footcite{HomerMurray} +% \end{murray} +% \end{alignment} +% \endgroup % % \section{Lineation Settings} % \label{sec:lineation} @@ -3591,6 +3657,14 @@ argument of the % file, the reader is invited to refer to point \vref{it:lang-subopt} % and \vref{sec:teixml-output}. % +% \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 +% edition text. To this end, \pkg{ekdosis} provides a set of +% facilities which are described +% \vpagerefrange{ref:app-lang}{ref:app-lang-opt} for single-layer +% apparatus and \vpageref{ref:apps-lang-opt} for multiple-layer +% apparatus. +% % \subsection{Languages Written From Right to Left} % \label{sec:rtl-languages} % As said above, \pkg{polyglossia} is not supported by \pkg{ekdosis} @@ -6856,9 +6930,9 @@ Sample text with a \textcolor{red}{word} in red. lineation=#1}{`lineation' must be either `page' or `document'.}, code modulonum = \chardef\c@linenumbermodulo#1\relax, noval modulo = \modulolinenumbers, - code vmodulonum = \if@pkg@verse\poemlines{#1}\fi, - initial vmodulonum = 1, - noval vmodulo = \if@pkg@verse\poemlines{5}\fi, + code vmodulo = \if@pkg@verse\poemlines{#1}\fi, + initial vmodulo = 1, + default vmodulo = 5, bool continuousvnum = \if@continuous@vnum, choice numbers = {elided = \ekd@elidednumberstrue, full = \ekd@elidednumbersfalse}, @@ -7915,6 +7989,17 @@ Sample text with a \textcolor{red}{word} in red. \fi % \end{macrocode} % \end{environment} +% \begin{macro}{\resetvlinenumber} +% \changes{v1.2}{2021/03/06}{resets line numbers in poetry environments} +% This command is the equivalent of \cs{resetlinenumber} for lines of +% poetry. It takes an integer (which is |1| by default) as optional +% argument. +% \begin{macrocode} +\NewDocumentCommand{\resetvlinenumber}{O{1}}{% + \setverselinenums{#1}{0}% +} +% \end{macrocode} +% \end{macro} % \begin{environment}{ekdpar} % When |autopar| is set to |false| by means of \cs{SetTEIxmlExport}, % \env{ekdpar}\---or any other environment set to be inserted within @@ -7965,7 +8050,8 @@ local app = lpeg.Cs("app") local lemrdg = lpeg.Cs(lpeg.Cs("lem") + lpeg.Cs("rdg")) local note = lpeg.Cs("note") local lnbrk = lpeg.Cs("\\\\") -local poemline = lpeg.Cs(lnbrk * bsqbrackets^-1) +local poemline = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.S("*!")^-1 * bsqbrackets^-1) +local poemlineb = lpeg.Cs(lnbrk * spcenc^-1 * lpeg.P(">") * bsqbrackets^-1) local endpoem = lpeg.Cs(lnbrk * lpeg.S("*!") * bsqbrackets^-1) local sections = lpeg.Cs(lpeg.P("book") + lpeg.P("part") + lpeg.P("chapter") + lpeg.P("section") + lpeg.P("subsection") @@ -8314,6 +8400,8 @@ local texpatttotags = { {a="\\addentries%s+%[(.-)%]{(.-)}", b=""}, {a="\\addentries%s+{(.-)}", b=""}, {a="\\setverselinenums%s+{(.-)}{(.-)}", b=""}, + {a="\\resetvlinenumber%s+%[(.-)%]", b=""}, + {a="\\resetvlinenumber%s+", b=""}, {a="\\resetlinenumber%s+%[(.-)%]", b=""}, {a="\\resetlinenumber%s+", b=""}, {a="\\poemlines%s+{(.-)}", b=""}, @@ -8559,11 +8647,12 @@ local function relocate_notes(str) end local function linestotei(str) --- str = "\n"..str - str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n%1\n") + str = "\n"..str +-- str = string.gsub(str, "^%s?(.-)\\\\[%!%*]?%s?$", "\n%1\n") + str = gsub(str, poemline * spcenc^-1 * -1, "\n") -- str = gsub(str, endpoem, "\n") - str = gsub(str, poemline * spcenc^-1 * lpeg.P(">"), "\n") - str = gsub(str, poemline * spcenc^-1, "\n") + str = gsub(str, poemlineb, "\n") + str = gsub(str, poemline, "\n") -- str = str.."\n" return str end -- cgit v1.2.3