diff options
author | Robert Alessi <alessi@robertalessi.net> | 2021-04-24 16:50:54 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2021-04-24 16:50:54 +0200 |
commit | 6219ac62c9c11fa4bf11a78c8a27d7b23045bf0c (patch) | |
tree | 2fbf948b6eda160a40a6e55e428a87fab443cc73 | |
parent | 7584e65460d4ce4340a755fdad9586fae4f031ee (diff) | |
download | ekdosis-6219ac62c9c11fa4bf11a78c8a27d7b23045bf0c.tar.gz |
better handling of line numbers of nested apps (2/2). added 'num' and 'nonum' optional arguments to \lem and \note
-rw-r--r-- | ekdosis.dtx | 100 |
1 files changed, 85 insertions, 15 deletions
diff --git a/ekdosis.dtx b/ekdosis.dtx index c2e8e42..513483e 100644 --- a/ekdosis.dtx +++ b/ekdosis.dtx | |||
@@ -1761,6 +1761,19 @@ yesterday. | |||
1761 | % orthographical and the like may apply. Obviously, |type=emendation| | 1761 | % orthographical and the like may apply. Obviously, |type=emendation| |
1762 | % should be restricted to lemma texts and |type=conjecture| to variant | 1762 | % should be restricted to lemma texts and |type=conjecture| to variant |
1763 | % readings recorded by means of \cs{rdg} described below. | 1763 | % readings recorded by means of \cs{rdg} described below. |
1764 | % | ||
1765 | % \needspace{2\baselineskip} | ||
1766 | % \noindent | ||
1767 | % \DescribeOption{num} (no-value | ||
1768 | % argument)\phts\label{ref:lem-num}\newfeature[v1.3]\\ | ||
1769 | % |num| takes no value. If used, this argument instructs to print any | ||
1770 | % line number that \pkg{ekdosis} may have decided not to print in the | ||
1771 | % apparatus criticus before the lemma text.\\ | ||
1772 | % \DescribeOption{nonum} (no-value | ||
1773 | % argument)\phts\label{ref:lem-nonum}\newfeature[v1.3]\\ | ||
1774 | % Compared to |num|, |nonum| does the opposite. If used, any number | ||
1775 | % that \pkg{ekdosis} may have decided to print before the lemma text | ||
1776 | % is suppressed. | ||
1764 | % | 1777 | % |
1765 | % \needspace{11\baselineskip} | 1778 | % \needspace{11\baselineskip} |
1766 | % Finally, four named arguments can be used to insert words at the | 1779 | % Finally, four named arguments can be used to insert words at the |
@@ -2052,6 +2065,19 @@ friend | |||
2052 | %</example> | 2065 | %</example> |
2053 | % \fi | 2066 | % \fi |
2054 | % | 2067 | % |
2068 | % \danger It must be noted that from a technical standpoint, albeit | ||
2069 | % the nested lemmas are printed \emph{before} their parents in the | ||
2070 | % apparatus criticus, they are seen by \pkg{ekdosis} \emph{after} the | ||
2071 | % latter as the source file is compiled. As a result, notably when the | ||
2072 | % whole nested group of lemmas fall on the same line without being | ||
2073 | % preceded by an apparatus entry on this line, it may be needed to | ||
2074 | % suppress redundant numbers that \pkg{ekdosis} may have decided to | ||
2075 | % print in the appartus criticus. Conversely, it may be needed to | ||
2076 | % print numbers that \pkg{ekdosis} may have decided not to print. To | ||
2077 | % both ends, the |num| and |nonum| optional arguments of the \cs{lem} | ||
2078 | % command can be used as described above | ||
2079 | % \vpagerefrange{ref:lem-num}{ref:lem-nonum}. | ||
2080 | % | ||
2055 | % \subsubsection{Explicit Grouping} | 2081 | % \subsubsection{Explicit Grouping} |
2056 | % \label{sec:explicit-grouping} | 2082 | % \label{sec:explicit-grouping} |
2057 | % \DescribeMacro{\rdgGrp} \cs{rdgGrp}\oarg{options}\marg{lemma text | 2083 | % \DescribeMacro{\rdgGrp} \cs{rdgGrp}\oarg{options}\marg{lemma text |
@@ -2459,11 +2485,11 @@ friend | |||
2459 | % \iffalse | 2485 | % \iffalse |
2460 | %</example> | 2486 | %</example> |
2461 | % \fi | 2487 | % \fi |
2462 | % | 2488 | % |
2489 | % \needspace{11\baselineskip} | ||
2463 | % PDF output:--- | 2490 | % PDF output:--- |
2464 | % \medskip | 2491 | % \medskip |
2465 | % | 2492 | % |
2466 | % \needspace{7\baselineskip} | ||
2467 | % \resetlinenumber | 2493 | % \resetlinenumber |
2468 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] | 2494 | % \begin{alignment}[flush,tcols=1,texts=specimen,apparatus=specimen] |
2469 | % \begin{specimen} | 2495 | % \begin{specimen} |
@@ -3548,6 +3574,14 @@ Some \app[type=rec2]{ | |||
3548 | % \DescribeOption{lem} |lem|$=$\meta{lemma text}\\ | 3574 | % \DescribeOption{lem} |lem|$=$\meta{lemma text}\\ |
3549 | % |lem| is the span of text the note is about. It may consist of one | 3575 | % |lem| is the span of text the note is about. It may consist of one |
3550 | % or more words, or of an abridged lemma text.\\ | 3576 | % or more words, or of an abridged lemma text.\\ |
3577 | % \DescribeOption{num} (no-value argument)\newfeature[v1.3]\\ | ||
3578 | % |num| takes no value. If used, this argument instructs to print any | ||
3579 | % line number that \pkg{ekdosis} may have decided not to print in the | ||
3580 | % apparatus criticus before the note.\\ | ||
3581 | % \DescribeOption{nonum} (no-value argument)\\ | ||
3582 | % Compared to |num|, |nonum| does the opposite. If used, any number | ||
3583 | % that \pkg{ekdosis} may have decided to print before the note | ||
3584 | % is suppressed.\\ | ||
3551 | % \DescribeOption{labelb} |labelb|$=$\meta{label} | 3585 | % \DescribeOption{labelb} |labelb|$=$\meta{label} |
3552 | % \hfill\tcboxverb{Mandatory}\\ | 3586 | % \hfill\tcboxverb{Mandatory}\\ |
3553 | % |labelb| is the unique label to serve as a reference for the point | 3587 | % |labelb| is the unique label to serve as a reference for the point |
@@ -5880,7 +5914,7 @@ many mathematical writings and to the sense of | |||
5880 | % \danger If the entire string to be captured be enclosed in square or | 5914 | % \danger If the entire string to be captured be enclosed in square or |
5881 | % curly brackets, it is advisable to use |@b|\texttt{\emph{n}} (for | 5915 | % curly brackets, it is advisable to use |@b|\texttt{\emph{n}} (for |
5882 | % curly brackets) or |@s|\texttt{\emph{n}} (for square brackets) | 5916 | % curly brackets) or |@s|\texttt{\emph{n}} (for square brackets) |
5883 | % instead of |#|\texttt{\emph{n}}, where \texttt{\emph{n}} is the the | 5917 | % instead of |#|\texttt{\emph{n}}, where \texttt{\emph{n}} is the |
5884 | % number that is expected in the sequence. This will prevent any | 5918 | % number that is expected in the sequence. This will prevent any |
5885 | % brackets that may be found in the captured string from being | 5919 | % brackets that may be found in the captured string from being |
5886 | % interpreted. | 5920 | % interpreted. |
@@ -8174,6 +8208,9 @@ Sample text with a \textcolor{red}{word} in red. | |||
8174 | \LRnum{\getpagerefnumber{#2}}.% | 8208 | \LRnum{\getpagerefnumber{#2}}.% |
8175 | \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos | 8209 | \LRnum{\getrefnumber{#2}}\unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos |
8176 | \fi% | 8210 | \fi% |
8211 | \ifekdn@forcenum | ||
8212 | \LRnum{\getrefnumber{#1}}\unexpanded\expandafter{\ekd@postrefnum}% force the no | ||
8213 | \fi | ||
8177 | }% | 8214 | }% |
8178 | } | 8215 | } |
8179 | % \end{macrocode} | 8216 | % \end{macrocode} |
@@ -8210,14 +8247,21 @@ Sample text with a \textcolor{red}{word} in red. | |||
8210 | = | 8247 | = |
8211 | 0 | 8248 | 0 |
8212 | \ifekd@appinapp | 8249 | \ifekd@appinapp |
8250 | \ifnum% | ||
8251 | \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | ||
8252 | {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} | ||
8253 | = | ||
8254 | 0 | ||
8255 | \else | ||
8213 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | 8256 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% |
8214 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no | 8257 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no |
8258 | \fi | ||
8215 | \fi | 8259 | \fi |
8216 | \else | 8260 | \else |
8217 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | 8261 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% |
8218 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no | 8262 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no |
8219 | \fi | 8263 | \fi |
8220 | %%%end | 8264 | %%% end |
8221 | \else | 8265 | \else |
8222 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | 8266 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% |
8223 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no | 8267 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no |
@@ -8239,14 +8283,21 @@ Sample text with a \textcolor{red}{word} in red. | |||
8239 | = | 8283 | = |
8240 | 0 | 8284 | 0 |
8241 | \ifekd@appinapp | 8285 | \ifekd@appinapp |
8286 | \ifnum% | ||
8287 | \pdf@strcmp{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | ||
8288 | {\getrefnumber{\luadirect{tex.sprint(ekdosis.getprevprevlnlab())}-b}} | ||
8289 | = | ||
8290 | 0 | ||
8291 | \else | ||
8242 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | 8292 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% |
8243 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no | 8293 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no |
8294 | \fi | ||
8244 | \fi | 8295 | \fi |
8245 | \else | 8296 | \else |
8246 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | 8297 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% |
8247 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no | 8298 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no |
8248 | \fi | 8299 | \fi |
8249 | %%%end | 8300 | %%% end |
8250 | \else | 8301 | \else |
8251 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | 8302 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% |
8252 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no | 8303 | \unexpanded\expandafter{\ekd@postrefnum}% issue the no |
@@ -8276,12 +8327,18 @@ Sample text with a \textcolor{red}{word} in red. | |||
8276 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% | 8327 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-e}}% |
8277 | \unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos | 8328 | \unexpanded\expandafter{\ekd@postrefnum}% issue pg and ln nos |
8278 | \fi% | 8329 | \fi% |
8330 | \ifekdl@forcenum | ||
8331 | \LRnum{\getrefnumber{\luadirect{tex.sprint(ekdosis.getlnlab())}-b}}% | ||
8332 | \unexpanded\expandafter{\ekd@postrefnum}% force the no | ||
8333 | \fi | ||
8279 | }% | 8334 | }% |
8280 | } | 8335 | } |
8281 | % \end{macrocode} | 8336 | % \end{macrocode} |
8282 | % Define keys to be used by the optional arguments of \cs{lem} and | 8337 | % Define keys to be used by the optional arguments of \cs{lem} and |
8283 | % \cs{rdg}:--- | 8338 | % \cs{rdg}:--- |
8284 | % \begin{macrocode} | 8339 | % \begin{macrocode} |
8340 | \newif\ifekdl@forcenum | ||
8341 | \newif\ifekdl@nonum | ||
8285 | \ekvdefinekeys{lem}{ | 8342 | \ekvdefinekeys{lem}{ |
8286 | code wit = \def\ekdlr@wit{#1}, | 8343 | code wit = \def\ekdlr@wit{#1}, |
8287 | code source = \def\ekdlr@source{#1}, | 8344 | code source = \def\ekdlr@source{#1}, |
@@ -8293,6 +8350,8 @@ Sample text with a \textcolor{red}{word} in red. | |||
8293 | code postwit = \def\ekdlr@postwit{#1}, | 8350 | code postwit = \def\ekdlr@postwit{#1}, |
8294 | store type = \ekdlr@type, | 8351 | store type = \ekdlr@type, |
8295 | store sep = \ekdl@sep, | 8352 | store sep = \ekdl@sep, |
8353 | noval nonum = \ekdl@nonumtrue, | ||
8354 | noval num = \ekdl@forcenumtrue, | ||
8296 | bool nolem = \ifekdl@nolem, | 8355 | bool nolem = \ifekdl@nolem, |
8297 | bool nosep = \ifekdl@nosep, | 8356 | bool nosep = \ifekdl@nosep, |
8298 | initial sep = \ekdsep | 8357 | initial sep = \ekdsep |
@@ -8358,6 +8417,8 @@ Sample text with a \textcolor{red}{word} in red. | |||
8358 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% | 8417 | \luadirect{ekdosis.dolnlab(\luastringN{#2})}% |
8359 | \null | 8418 | \null |
8360 | \bgroup% | 8419 | \bgroup% |
8420 | \ekdl@forcenumfalse | ||
8421 | \ekdl@nonumfalse | ||
8361 | \ekvset{lem}{#1}% | 8422 | \ekvset{lem}{#1}% |
8362 | \ekd@test@lang | 8423 | \ekd@test@lang |
8363 | \ifekd@mapps% | 8424 | \ifekd@mapps% |
@@ -8379,7 +8440,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8379 | \else% | 8440 | \else% |
8380 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | 8441 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% |
8381 | \fi% | 8442 | \fi% |
8382 | \current@ref}%\hskip .25em}% | 8443 | \unless\ifekdl@nonum\current@ref\fi}%\hskip .25em}% |
8383 | \else% | 8444 | \else% |
8384 | \ifbool{al@rlmode}{% | 8445 | \ifbool{al@rlmode}{% |
8385 | \edef\lem@app{% | 8446 | \edef\lem@app{% |
@@ -8390,7 +8451,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8390 | \else% | 8451 | \else% |
8391 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | 8452 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% |
8392 | \fi% | 8453 | \fi% |
8393 | \current@ref%\hskip .25em | 8454 | \unless\ifekdl@nonum\current@ref\fi%\hskip .25em |
8394 | \ifdefined\ekdlr@alt% | 8455 | \ifdefined\ekdlr@alt% |
8395 | \ifdefined\ekdlr@post% | 8456 | \ifdefined\ekdlr@post% |
8396 | \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi | 8457 | \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi |
@@ -8425,7 +8486,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8425 | \else% | 8486 | \else% |
8426 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | 8487 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% |
8427 | \fi% | 8488 | \fi% |
8428 | \current@ref%\hskip .25em | 8489 | \unless\ifekdl@nonum\current@ref\fi%\hskip .25em |
8429 | \ifdefined\ekdlr@alt% | 8490 | \ifdefined\ekdlr@alt% |
8430 | \ifdefined\ekdlr@pre% | 8491 | \ifdefined\ekdlr@pre% |
8431 | \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi | 8492 | \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi |
@@ -8561,6 +8622,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8561 | % Define keys to be used by the optional argument of \cs{note} when | 8622 | % Define keys to be used by the optional argument of \cs{note} when |
8562 | % this command is found outside \cs{app}:--- | 8623 | % this command is found outside \cs{app}:--- |
8563 | % \begin{macrocode} | 8624 | % \begin{macrocode} |
8625 | \newif\ifekdn@forcenum | ||
8564 | \ekvdefinekeys{note}{ | 8626 | \ekvdefinekeys{note}{ |
8565 | store type = \ekdan@type, | 8627 | store type = \ekdan@type, |
8566 | store lem = \ekdn@lem, | 8628 | store lem = \ekdn@lem, |
@@ -8569,7 +8631,9 @@ Sample text with a \textcolor{red}{word} in red. | |||
8569 | store sep = \ekdn@sep, | 8631 | store sep = \ekdn@sep, |
8570 | bool nosep = \ifekdn@nosep, | 8632 | bool nosep = \ifekdn@nosep, |
8571 | initial type = default, | 8633 | initial type = default, |
8572 | initial sep = \ekdsep | 8634 | initial sep = \ekdsep, |
8635 | bool nonum = \ifekdn@nonum, | ||
8636 | noval num = \ekdn@forcenumtrue | ||
8573 | } | 8637 | } |
8574 | % \end{macrocode} | 8638 | % \end{macrocode} |
8575 | % \cs{note@noapp} is used internally when a \cs{note} command is found | 8639 | % \cs{note@noapp} is used internally when a \cs{note} command is found |
@@ -8615,7 +8679,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8615 | \else% | 8679 | \else% |
8616 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | 8680 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% |
8617 | \fi% | 8681 | \fi% |
8618 | \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em | 8682 | \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em |
8619 | \ifdefined\ekdn@lem% | 8683 | \ifdefined\ekdn@lem% |
8620 | {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% | 8684 | {\textdir TRT\unexpanded\expandafter{\ekd@lemmastyle}% |
8621 | \unexpanded\expandafter{\ekdn@lem}}% | 8685 | \unexpanded\expandafter{\ekdn@lem}}% |
@@ -8631,7 +8695,7 @@ Sample text with a \textcolor{red}{word} in red. | |||
8631 | \else% | 8695 | \else% |
8632 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% | 8696 | \ifsubsq@unit\unexpanded\expandafter{\ekd@unit@delim}\fi% |
8633 | \fi% | 8697 | \fi% |
8634 | \current@ref@arg{\ekdn@labelb}{\ekdn@labele}%\hskip .25em | 8698 | \unless\ifekdn@nonum\current@ref@arg{\ekdn@labelb}{\ekdn@labele}\fi%\hskip .25em |
8635 | \ifdefined\ekdn@lem | 8699 | \ifdefined\ekdn@lem |
8636 | \ifbool{ekd@lang@pkg}% | 8700 | \ifbool{ekd@lang@pkg}% |
8637 | {{\unexpanded\expandafter{\ekd@lemmastyle}% | 8701 | {{\unexpanded\expandafter{\ekd@lemmastyle}% |
@@ -11455,6 +11519,7 @@ local lnlabs = {} | |||
11455 | local lnlab_salt = 0 | 11519 | local lnlab_salt = 0 |
11456 | local current_lnlab = nil | 11520 | local current_lnlab = nil |
11457 | local prev_lnlab = nil | 11521 | local prev_lnlab = nil |
11522 | local prev_prev_lnlab = nil | ||
11458 | local notelabs = {} | 11523 | local notelabs = {} |
11459 | local current_notelab = nil | 11524 | local current_notelab = nil |
11460 | local prev_notelab = nil | 11525 | local prev_notelab = nil |
@@ -11469,6 +11534,7 @@ local function mdvisintable(table, value) | |||
11469 | end | 11534 | end |
11470 | 11535 | ||
11471 | function ekdosis.dolnlab(str) | 11536 | function ekdosis.dolnlab(str) |
11537 | if prev_lnlab ~= nil then prev_prev_lnlab = prev_lnlab end | ||
11472 | prev_lnlab = current_lnlab | 11538 | prev_lnlab = current_lnlab |
11473 | current_lemma = str | 11539 | current_lemma = str |
11474 | i = md5.sumhexa(str) | 11540 | i = md5.sumhexa(str) |
@@ -11491,6 +11557,10 @@ function ekdosis.getprevlnlab() | |||
11491 | return prev_lnlab | 11557 | return prev_lnlab |
11492 | end | 11558 | end |
11493 | 11559 | ||
11560 | function ekdosis.getprevprevlnlab() | ||
11561 | return prev_prev_lnlab | ||
11562 | end | ||
11563 | |||
11494 | function ekdosis.setnotelab(str) | 11564 | function ekdosis.setnotelab(str) |
11495 | current_notelab = str | 11565 | current_notelab = str |
11496 | if isfound(notelabs, current_notelab) | 11566 | if isfound(notelabs, current_notelab) |