From 8806b2d6c55426cb0ba19311d2acf7c4f522a291 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 28 Dec 2023 03:00:45 +0000 Subject: CTAN sync 202312280300 --- macros/latex/contrib/eolang/DEPENDS.txt | 2 + macros/latex/contrib/eolang/eolang.dtx | 74 +- macros/latex/contrib/eolang/eolang.pdf | Bin 1931964 -> 1933472 bytes macros/latex/contrib/pgfkeysearch/README.md | 39 + .../contrib/pgfkeysearch/doc/pgfkeysearch.pdf | Bin 0 -> 158924 bytes .../contrib/pgfkeysearch/doc/pgfkeysearch.tex | 86 ++ .../contrib/pgfkeysearch/latex/pgfkeysearch.sty | 238 +++ macros/latex/contrib/scripture/scripture.dtx | 1627 +++++++++++--------- macros/latex/contrib/scripture/scripture.pdf | Bin 956076 -> 965221 bytes 9 files changed, 1267 insertions(+), 799 deletions(-) create mode 100644 macros/latex/contrib/pgfkeysearch/README.md create mode 100644 macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.pdf create mode 100644 macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.tex create mode 100644 macros/latex/contrib/pgfkeysearch/latex/pgfkeysearch.sty (limited to 'macros') diff --git a/macros/latex/contrib/eolang/DEPENDS.txt b/macros/latex/contrib/eolang/DEPENDS.txt index ea34111dee..d4273d3323 100644 --- a/macros/latex/contrib/eolang/DEPENDS.txt +++ b/macros/latex/contrib/eolang/DEPENDS.txt @@ -18,6 +18,7 @@ soft cmap soft comment soft docshots soft environ +soft float soft href-ul soft hypdoc soft hyperxmp @@ -25,6 +26,7 @@ soft iexec soft ifmtarg soft l3build soft libertine +soft microtype soft ncctools soft scheme-basic soft setspace diff --git a/macros/latex/contrib/eolang/eolang.dtx b/macros/latex/contrib/eolang/eolang.dtx index 32a617a083..8df6d7b2f3 100644 --- a/macros/latex/contrib/eolang/eolang.dtx +++ b/macros/latex/contrib/eolang/eolang.dtx @@ -50,7 +50,7 @@ %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{eolang} %<*package> -[2023-08-10 0.15.0 Formulas and Graphs for EO Programming Language] +[2023-12-27 0.16.0 Formulas and Graphs for EO Programming Language] % %<*driver> \documentclass{ltxdoc} @@ -820,7 +820,7 @@ $macro = $ARGV[0]; open(my $fh, '<', $ARGV[1]); my $tex; { local $/; $tex = <$fh>; } -print "% This file is auto-generated by 0.15.0\n"; +print "% This file is auto-generated by 0.16.0\n"; print '% There are ', length($tex), ' chars in the input: ', $ARGV[1], "\n"; print '% ---', "\n"; @@ -1003,21 +1003,27 @@ print '\endinput'; % \end{macro} % \begin{macro}{phiquation} +% \changes{0.16.0}{2023/12/27}{The processing of \texttt{phiquation} data is done only if it's the first time processing, otherwise cache is used, thus making processing faster.} % Then, we define the |phiquation| and the |phiquation*| environments through a supplementary % |\eolang@process| command: % \begin{macrocode} \makeatletter\newcommand\eolang@process[1]{ \def\hash{\eolang@mdfive {\eolang@tmpdir/\jobname/phiquation.tex}}% - \iexec[null]{cp "\eolang@tmpdir/\jobname/phiquation.tex" - "\eolang@tmpdir/\jobname/\hash.tex"}% - \message{Start parsing 'phi' at line no. \the\inputlineno^^J} - \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{ - perl "\eolang@tmpdir/eolang-phi.pl" - '#1' - "\eolang@tmpdir/\jobname/\hash.tex" - \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi - \ifdefined\eolang@phiSaveTo > \eolang@phiSaveTo\fi}% + \IfFileExists + {\eolang@tmpdir/\jobname/\hash-post.tex} + {\input{\eolang@tmpdir/\jobname/\hash-post.tex}} + {% + \iexec[null]{cp "\eolang@tmpdir/\jobname/phiquation.tex" + "\eolang@tmpdir/\jobname/\hash.tex"}% + \message{Start parsing 'phi' at line no. \the\inputlineno^^J} + \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{ + perl "\eolang@tmpdir/eolang-phi.pl" + '#1' + "\eolang@tmpdir/\jobname/\hash.tex" + \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi + \ifdefined\eolang@phiSaveTo > \eolang@phiSaveTo\fi}% + }% \setcounter{FancyVerbLine}{\value{eolang@lineno}}% \def\eolang@phiSaveTo{\relax}% } @@ -1046,17 +1052,21 @@ print '\endinput'; \RequirePackage{xstring} \makeatletter\newcommand\phiq[1]{% \StrSubstitute{\detokenize{#1}}{'}{'"'"'}[\clean]% - \iexec[log,trace,quiet,stdout=\eolang@tmpdir/\jobname/phiq.tex]{ - /bin/echo '\clean'}% - \def\hash{\eolang@mdfive - {\eolang@tmpdir/\jobname/phiq.tex}}% - \iexec[null]{cp "\eolang@tmpdir/\jobname/phiq.tex" - "\eolang@tmpdir/\jobname/\hash.tex"}% + \def\hash{\pdf@mdfivesum{\clean}}% \ifdefined\eolang@nodollar\else\catcode`\$=3 \fi% - \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{ - perl \eolang@tmpdir/eolang-phi.pl 'phiq' - "\eolang@tmpdir/\jobname/\hash.tex" - \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi}% + \IfFileExists + {\eolang@tmpdir/\jobname/\hash-phiq-post.tex} + {\input{\eolang@tmpdir/\jobname/\hash-phiq-post.tex}} + {% + \iexec[log,trace,quiet,stdout=\eolang@tmpdir/\jobname/phiq.tex]{ + /bin/echo '\clean'}% + \iexec[null]{cp "\eolang@tmpdir/\jobname/phiq.tex" + "\eolang@tmpdir/\jobname/\hash.tex"}% + \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-phiq-post.tex]{ + perl \eolang@tmpdir/eolang-phi.pl 'phiq' + "\eolang@tmpdir/\jobname/\hash.tex" + \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g' \fi}% + }% \ifdefined\eolang@nodollar\else\catcode`\$\active\fi% }\makeatother % \end{macrocode} @@ -1495,6 +1505,7 @@ print '\endinput'; % \begin{macro}{sodg} % \changes{0.0.2}{2022/10/20}{The environment \texttt{phigure} renamed to \texttt{sodg} for the sake of better semantic. The graph in the picture is solely a SODG graph, that's why the name \texttt{sodg} is better.} +% \changes{0.16.0}{2023/12/27}{The processing of \texttt{sodg} data is done only if it's the first time processing, otherwise cache is used, thus making processing faster.} % Then, we create a new environment |sodg|, as suggested % \href{https://tex.stackexchange.com/questions/661056}{here}: % \begin{macrocode} @@ -1506,15 +1517,20 @@ print '\endinput'; {\end{VerbatimOut}% \def\hash{\eolang@mdfive {\eolang@tmpdir/\jobname/sodg.tex}}% - \iexec[null]{cp "\eolang@tmpdir/\jobname/sodg.tex" - "\eolang@tmpdir/\jobname/\hash.tex"}% \catcode`\$=3 % - \message{Start parsing `sodg' at line no. \the\inputlineno^^J} - \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{ - perl "\eolang@tmpdir/eolang-sodg.pl" - "\eolang@tmpdir/\jobname/\hash.tex" - \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi - \ifdefined\eolang@sodgSaveTo > \eolang@sodgSaveTo\fi}% + \IfFileExists + {\eolang@tmpdir/\jobname/\hash-sodg-post.tex} + {\input{\eolang@tmpdir/\jobname/\hash-sodg-post.tex}} + {% + \iexec[null]{cp "\eolang@tmpdir/\jobname/sodg.tex" + "\eolang@tmpdir/\jobname/\hash.tex"}% + \message{Start parsing `sodg' at line no. \the\inputlineno^^J} + \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-sodg-post.tex]{ + perl "\eolang@tmpdir/eolang-sodg.pl" + "\eolang@tmpdir/\jobname/\hash.tex" + \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi + \ifdefined\eolang@sodgSaveTo > \eolang@sodgSaveTo\fi}% + } \catcode`\$\active% \setcounter{FancyVerbLine}{\value{eolang@lineno}}% \def\eolang@sodgSaveTo{\relax}% diff --git a/macros/latex/contrib/eolang/eolang.pdf b/macros/latex/contrib/eolang/eolang.pdf index 612b3eda53..29ec974711 100644 Binary files a/macros/latex/contrib/eolang/eolang.pdf and b/macros/latex/contrib/eolang/eolang.pdf differ diff --git a/macros/latex/contrib/pgfkeysearch/README.md b/macros/latex/contrib/pgfkeysearch/README.md new file mode 100644 index 0000000000..58a12659fc --- /dev/null +++ b/macros/latex/contrib/pgfkeysearch/README.md @@ -0,0 +1,39 @@ +pgfkeysearch +========== + +This package offers a way to find keys in a given path 'recursively', unlike pgfkeysvalueof. + +-------------- + +## Requirements +* none besides a fairly recent LaTeX distribution as recent as 2022/06/01 +(with the new in kernel *\ProcessKeyOptions* and *\NewDocumentCommand*) +and pgfkeys. + + +## Contacting Author + +For bug reports and enhancement suggestions, the preferred way is to use +[the project's issue page](https://github.com/alceu-frigeri/pgfkeysearch/issues). +Please be ready to provide an example code showing the bug, if any. + +Please do not use the issue page for generic help on how to use the package. + +* git: https://github.com/alceu-frigeri/pgfkeysearch + +------------- +Copyright 2023-present by Alceu Frigeri + + This work may be distributed and/or modified under the + conditions of + + * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), version 1.3c (or later), and/or + * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html), version 3 (or later) + +This work has the LPPL maintenance status *maintained*. + +The Current Maintainer of this work is Alceu Frigeri + + +* Version 1.0 + - Initial setup. diff --git a/macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.pdf b/macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.pdf new file mode 100644 index 0000000000..ce036e2a6e Binary files /dev/null and b/macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.pdf differ diff --git a/macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.tex b/macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.tex new file mode 100644 index 0000000000..5ebd18a090 --- /dev/null +++ b/macros/latex/contrib/pgfkeysearch/doc/pgfkeysearch.tex @@ -0,0 +1,86 @@ +%%%============================================================================== +%% Copyright 2023 by Alceu Frigeri +%% +%% This work may be distributed and/or modified under the conditions of +%% +%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), +%% version 1.3c (or later), and/or +%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html), +%% version 3 (or later) +%% +%% This work has the LPPL maintenance status *maintained*. +%% +%% The Current Maintainer of this work is Alceu Frigeri +%% +%% This is version {1.5} {2023/11/28} +%% +%% The list of files that compose this work can be found in the README.md file at +%% https://ctan.org/pkg/pgfkeysearch +%% +%%%============================================================================== +\documentclass[10pt]{article} +\RequirePackage[verbose,a4paper,marginparwidth=27.5mm,top=2.5cm,bottom=1.5cm,hmargin={40mm,20mm},marginparsep=2.5mm,columnsep=10mm,asymmetric]{geometry} +\usepackage{codedescribe} +\usepackage{pgfkeysearch} +\RequirePackage[inline]{enumitem} +\SetEnumitemKey{miditemsep}{parsep=0ex,itemsep=0.4ex} + +\RequirePackage{pgfkeys} + +\RequirePackage[hidelinks,hypertexnames=false]{hyperref} +\begin{document} +\tstitle{ + author={Alceu Frigeri\footnote{\tsverb{https://github.com/alceu-frigeri/pgfkeysearch}}}, + date={\tsdate}, + title={A Search Extension for pgfkeys\break Version \PkgInfo{pgfkeysearch}{version}} + } + +\begin{typesetabstract} + +The command \tsobj{\pgfkeysvalueof}, unlike other \tsobj{\pgfkeys} commands, doesn't have a \tsobj[keys]{.unknown} handler, or offers the option to search for a key. +That's exactly the aim of this, by having a way to find a key in a given path (or collection of paths). +\end{typesetabstract} + + +\section{Searching for a key} +\begin{codedescribe}{\pgfkeysearchvalueof,\pgfkeysearchvalueofTF} +\begin{codesyntax}% +\tsmacro{\pgfkeysearchvalueof}{path-list,key,macro} +\tsmacro{\pgfkeysearchvalueofTF}{path-list,key,macro,if-found,if-not} +\end{codesyntax} +\tsobj[marg]{path-list} is a comma separated list (clist) of paths (can be a single one). \tsobj[marg]{key} is the desired key and \tsobj[marg]{macro} is the macro/command that will receive (store) the key value (if one was found). + +For instance, given a path /A/B/C/D it will look first at /A/B/C/D/\tsobj[marg]{key}, them /A/B/C/\tsobj[marg]{key}, and so on, until /A/\tsobj[marg]{key}, +Stopping at the first hit, returning the value found in the \tsobj[marg]{macro}. +The branch version will also execute either \tsobj[marg,sep={or}]{if-found,if-not}. + +\end{codedescribe} +\begin{tsremark} + Those commands aren't expandable, that's the reason to have them storing the key value in a macro and not just 'placing the value in the input stream'. +\end{tsremark} + +\begin{codestore}[keyval.demo] + \pgfkeys{/tikz/A/.cd, + keyA/.initial={A keyA}, + keyB/.initial={A keyB}, + B/.cd, + keyA/.initial={B keyA}, + keyC/.initial={B keyC}, + C/.cd, + keyX/.initial={C keyX} } + \pgfkeysearchvalueof{/tikz/A/B/C}{keyA}{\VALkeyA} + \pgfkeysearchvalueof{/tikz/A/B/C}{keyB}{\VALkeyB} + \pgfkeysearchvalueof{/tikz/A/B/C}{keyC}{\VALkeyC} + \pgfkeysearchvalueof{/tikz/A/B/C}{keyX}{\VALkeyX} + + I got for keyA: \textbf{\VALkeyA} \par + I got for keyB: \textbf{\VALkeyB} \par + I got for keyC: \textbf{\VALkeyC} \par + I got for keyX: \textbf{\VALkeyX} \par + +\end{codestore} + +\tsdemo[emph={pgfkeysearchvalueof}]{keyval.demo} + + +\end{document} \ No newline at end of file diff --git a/macros/latex/contrib/pgfkeysearch/latex/pgfkeysearch.sty b/macros/latex/contrib/pgfkeysearch/latex/pgfkeysearch.sty new file mode 100644 index 0000000000..bc1da1ae03 --- /dev/null +++ b/macros/latex/contrib/pgfkeysearch/latex/pgfkeysearch.sty @@ -0,0 +1,238 @@ +%%%============================================================================== +%% Copyright 2023-present by Alceu Frigeri +%% +%% This work may be distributed and/or modified under the conditions of +%% +%% * The [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), +%% version 1.3c (or later), and/or +%% * The [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html), +%% version 3 (or later) +%% +%% This work has the LPPL maintenance status *maintained*. +%% +%% The Current Maintainer of this work is Alceu Frigeri +%% +%% This is version {1.0} {2023/12/27} +%% +%% The list of files that compose this work can be found in the README.md file at +%% https://ctan.org/pkg/pgfkeysearch +%% +%%%============================================================================== +\NeedsTeXFormat{LaTeX2e}[2022/06/01] + + +\ProvidesExplPackage + {pgfkeysearch} + {2023/12/27} + {1.0} + {pgfkeys Search Extension} + +\ExplSyntaxOn +%%%%%%% +%%% +%%% Just an attempt of having my packages info in a regular way +%%% Idea being: { / pkg info } for each and all. +%%% +%%%%%%% +\keys_define:nn { pgfkeysearch / pkg info} + { + name .code:n = {pgfkeysearch} , + prefix .code:n = {pgfkeysearch} , + date .code:n = {2023/12/27}, + version .code:n = {1.0} , + description .code:n = {pgfkeys Search Extension} + } +\cs_if_exist:NF \__codedesc_pkg_info:nn + { + \cs_new_protected:Npn \__codedesc_pkg_info:nn #1#2 + { \keys_set:nn {#1 / pkg info}{#2} } + } +\cs_if_exist:NF \PkgInfo + { \NewDocumentCommand \PkgInfo {mm} { \keys_set:nn {#1 / pkg info}{#2} } } +\cs_if_exist:NF \PkgDescription + { + \NewDocumentCommand \PkgDescription {m} + { + \noindent Package~ \textbf{\PkgInfo{#1}{name}}~Version:~\PkgInfo{#1}{version}~ -~ \PkgInfo{#1}{date}\par \emph{\PkgInfo{#1}{description}}~\par + } + } +%%%%%%% +%%% End of cut-n-paste +%%%%%%% + + +%%%%%%%%%%%%%%% +%%% +%%% Expl3 machinery. _keysearch_ allows to find a key, +%%% if it's defined from 'anywhere' in the tree. I mean, upwards until, likely, /tikz/ +%%% if it isn't defined, returns nothing (no error triggered) +%%% +%%%%%%%%%%%%%%% +\seq_new:N \l__ctikzext_pathterms_seq +\seq_new:N \l__ctikzext_pathtree_seq +\tl_new:N \l__ctikzext_key_tl +\tl_new:N \l__ctikzext_path_tl + + +%%%%%%%%%%%%%%%% +%%%% +%%%% This works BUT, it isn't expandable and not a 1-to-1 replacement for pgfkeysvalueof (which is fully expandable) +%%%% don't use this unless you know what you are doing. To avoid trouble tickets headaches, it's commeted out +%%%% +%%%%%%%%%%%%%%%% +%\cs_new_protected:Npn \__ctikzext_keysearch:n #1 +% { +% \seq_set_split:Nne \l__ctikzext_pathterms_seq {/} {#1} +% \seq_pop_right:NN \l__ctikzext_pathterms_seq \l__ctikzext_key_tl +% \seq_remove_all:Nn \l__ctikzext_pathterms_seq {} +% \tl_clear:N \l__ctikzext_path_tl +% \seq_clear:N \l__ctikzext_pathtree_seq +% \seq_map_inline:Nn \l__ctikzext_pathterms_seq +% { +% \tl_put_right:Ne \l__ctikzext_path_tl {/##1} +% \seq_put_right:Ne \l__ctikzext_pathtree_seq {\l__ctikzext_path_tl} +% } +% \seq_reverse:N \l__ctikzext_pathtree_seq +% \seq_map_inline:Nn \l__ctikzext_pathtree_seq +% { +% \cs_if_exist:cT {pgfk@##1/\l__ctikzext_key_tl} +% { +% \exp_args:Ne \use:c {pgfk@##1/\l__ctikzext_key_tl} +% \seq_map_break: +% } +% } +% } + + + +%%%%%%%%%%%%%%% +%%% +%%% Deplecated... single path key search (just a bit faster if a single path) +%%% +%%%%%%%%%%%%%%% +%\prg_new_protected_conditional:Npnn \__ctikzext_keysearch:nn #1#2 {TF,T,F} +% { +% \seq_set_split:Nne \l__ctikzext_pathterms_seq {/} {#1} +% \seq_pop_right:NN \l__ctikzext_pathterms_seq \l__ctikzext_key_tl +% \seq_remove_all:Nn \l__ctikzext_pathterms_seq {} +% \tl_clear:N \l__ctikzext_path_tl +% \seq_clear:N \l__ctikzext_pathtree_seq +% \seq_map_inline:Nn \l__ctikzext_pathterms_seq +% { +% \tl_put_right:Ne \l__ctikzext_path_tl {/##1} +% \seq_put_right:Ne \l__ctikzext_pathtree_seq {\l__ctikzext_path_tl} +% } +% \seq_reverse:N \l__ctikzext_pathtree_seq +% \bool_set_false:N \l__ctikzext_valuefound_bool +% \seq_map_inline:Nn \l__ctikzext_pathtree_seq +% { +% \cs_if_exist:cT {pgfk@##1/\l__ctikzext_key_tl} +% { +% \tl_set:Ne #2 {\exp_not:N \use:c{pgfk@##1/\l__ctikzext_key_tl}} +% \bool_set_true:N \l__ctikzext_valuefound_bool +% \seq_map_break: +% } +% } +% \bool_if:nTF {\l__ctikzext_valuefound_bool} +% { \prg_return_true: } +% { \prg_return_false: } +% } + + + +%%%%%%%%%%%%%%% +%%% +%%% Given a path /A/B/C/D it will look after +%%% /A/B/C/D/ +%%% /A/B/C/ +%%% /A/B/ +%%% /A/ +%%% stoping at the first hit +%%% +%%%%%%%%%%%%%%% + +\bool_new:N \l__ctikzext_valuefound_bool +\prg_new_protected_conditional:Npnn \__ctikzext_keysearch:nnn #1#2#3 {TF,T,F} + { + \seq_set_split:Nne \l__ctikzext_pathterms_seq {/} {#1} + \seq_remove_all:Nn \l__ctikzext_pathterms_seq {} + \tl_clear:N \l__ctikzext_path_tl + \seq_clear:N \l__ctikzext_pathtree_seq + \seq_map_inline:Nn \l__ctikzext_pathterms_seq + { + \tl_put_right:Ne \l__ctikzext_path_tl {/##1} + \seq_put_right:Ne \l__ctikzext_pathtree_seq {\l__ctikzext_path_tl} + } + \seq_reverse:N \l__ctikzext_pathtree_seq + \bool_set_false:N \l__ctikzext_valuefound_bool + \seq_map_inline:Nn \l__ctikzext_pathtree_seq + { + \cs_if_exist:cT {pgfk@##1/#2} + { + \tl_set:Ne #3 {\exp_not:N \use:c{pgfk@##1/#2}} + \bool_set_true:N \l__ctikzext_valuefound_bool + \seq_map_break: + } + } + \bool_if:nTF {\l__ctikzext_valuefound_bool} + { \prg_return_true: } + { \prg_return_false: } + } + + + + +%%%%%%%%%%%%%%% +%%% +%%% #1 shall be a comma separated list of paths (can be a single one) +%%% it searchs for the key in every path, stoping at the first hit. +%%% +%%%%%%%%%%%%%%% + +\bool_new:N \l__ctikzext_multisearch_bool +\prg_new_protected_conditional:Npnn \__ctikzext_multipath_keysearch:nnn #1#2#3 {T,F,TF} + { + \bool_set_false:N \l__ctikzext_multisearch_bool + \clist_map_inline:nn {#1} + { + \__ctikzext_keysearch:nnnT {##1}{#2}{#3} + { + \bool_set_true:N \l__ctikzext_multisearch_bool + \clist_map_break: + } + } + \bool_if:nTF {\l__ctikzext_multisearch_bool} + { \prg_return_true: } + { \prg_return_false: } + } + +\cs_generate_variant:Nn \tl_set:Nn {Ne} + +%%%%%%%%%%%%%%% +%%% +%%% The caveats: this ins't expandable. +%%% +%%%%%%%%%%%%%%% +%%% +%%% This is the more generic one. +%%% #1 is the path (or list of paths) +%%% #2 is the +%%% #3 is the macro that will receive the key value (if any) +%%% +%%%%%%%%%%%%%%% + +\NewDocumentCommand{\pgfkeysearchvalueof}{mmm} + { + \__ctikzext_multipath_keysearch:nnnF {#1}{#2}{#3} + { \tl_set:Nn #3 {} } + } + +\NewDocumentCommand{\pgfkeysearchvalueofTF}{mmmmm} + { + \__ctikzext_multipath_keysearch:nnnTF {#1}{#2}{#3} + { #4 } + { + \tl_set:Nn #3 {} + #5 + } + } diff --git a/macros/latex/contrib/scripture/scripture.dtx b/macros/latex/contrib/scripture/scripture.dtx index c54a361a5a..f4a4f6c6a0 100644 --- a/macros/latex/contrib/scripture/scripture.dtx +++ b/macros/latex/contrib/scripture/scripture.dtx @@ -185,10 +185,13 @@ % \changes{v1.1}{2022/08/27}{Bug fixes} % \changes{v1.2}{2022/11/02}{Bug fixes} % \changes{v1.3}{2023/01/08}{Bug fixes} +% \changes{v2.0}{2023/12/26}{Switch \env{scripture} to a \LaTeX{} \env{list} +% based environment} +% \changes{v2.0}{2023/12/27}{Bug fixes} % % \title{The \pkg{scripture} package} % \author{David Purton\thanks{Email: \url{dcpurton@marshwiggle.net}}} -% \date{2023/01/08 v1.3} +% \date{2023/12/27 v2.0} % % \maketitle % @@ -248,7 +251,7 @@ % more stretchable space on the page before the incorrect break is enough to % obtain acceptable output. % -% At least version 2022-06-01 of the \LaTeX\ format is required. +% At least version 2022-11-01 of the \LaTeX\ format is required. % % \section{Documentation} % @@ -301,6 +304,37 @@ % % \subsubsection{Functions} % +% \changes{v1.3}{2022/11/15}{Add feature to highlight translator added words} +% \begin{function}[added=2022-11-15]{\added} +% \begin{syntax} +% |\added|\marg{words} +% \end{syntax} +% Some Bible translations mark out words added for clarity not found in the +% original language (e.g., in italics). This can be done using the \cs{added} +% function. The font and format can be set using the \opt{added/font} and +% \opt{added/format} options. +% \end{function} +% +% \begin{scriptureexample} +% \begin{verbatim} +% \begin{scripture}[John 1:18][verse/font=\bfseries, +% verse/format=#1, verse/sep=0.5em, version=KJV] +% \vs{18}No man hath seen God at any time, the +% only begotten Son, which is in the bosom of the +% Father, he hath declared \added{him}. +% \end{scripture} +% \end{verbatim} +% +% \tcblower +% +% \begin{scripture}[John 1:18][verse/font=\bfseries, +% verse/format=#1, verse/sep=0.5em, version=KJV] +% \vs{18}No man hath seen God at any time, the +% only begotten Son, which is in the bosom of the +% Father, he hath declared \added{him}. +% \end{scripture} +% \end{scriptureexample} +% % \begin{function}{\ch, \ch*} % \begin{syntax} % |\ch|\marg{chapter number} @@ -409,37 +443,6 @@ % \end{scripture} % \end{scriptureexample} % -% \changes{v1.3}{2022/11/15}{Add feature to highlight translator added words} -% \begin{function}[added=2022-11-15]{\added} -% \begin{syntax} -% |\added|\marg{words} -% \end{syntax} -% Some Bible translations mark out words added for clarity not found in the -% original language (e.g., in italics). This can be done using the \cs{added} -% function. The font and format can be set using the \opt{added/font} and -% \opt{added/format} options. -% \end{function} -% -% \begin{scriptureexample} -% \begin{verbatim} -% \begin{scripture}[John 1:18][verse/font=\bfseries, -% verse/format=#1, verse/sep=0.5em, version=KJV] -% \vs{18}No man hath seen God at any time, the -% only begotten Son, which is in the bosom of the -% Father, he hath declared \added{him}. -% \end{scripture} -% \end{verbatim} -% -% \tcblower -% -% \begin{scripture}[John 1:18][verse/font=\bfseries, -% verse/format=#1, verse/sep=0.5em, version=KJV] -% \vs{18}No man hath seen God at any time, the -% only begotten Son, which is in the bosom of the -% Father, he hath declared \added{him}. -% \end{scripture} -% \end{scriptureexample} -% % \changes{v1.2}{2022/09/01}{Add divine name feature} % \begin{function}[added=2022-09-01]{\name, \LORD, \GOD} % \begin{syntax} @@ -592,14 +595,6 @@ % \end{scripture} % \end{scriptureexample} % -% \begin{function}{\scripturesetup} -% \begin{syntax} -% |\scripturesetup|\marg{options} -% \end{syntax} -% Set default format for quotations. See section \ref{options} for -% supported formatting \meta{|options|}. -% \end{function} -% % \changes{v1.1}{2022/08/07}{Add \cs{scripturecurrentchapter} and % \cs{scripturecurrentverse} variables} % \begin{function}[added=2022-08-07]{\scripturecurrentchapter, @@ -614,6 +609,25 @@ % example. % \end{function} % +% \begin{function}{\scripturesetup} +% \begin{syntax} +% |\scripturesetup|\marg{options} +% \end{syntax} +% Set default format for quotations. See section \ref{options} for +% supported formatting \meta{|options|}. +% \end{function} +% +% \changes{v2.0}{2023/12/27}{Add \cs{scripturestyle} function} +% \begin{function}[added=2023/12/27]{\scripturestyle, \scripturestyle*} +% \begin{syntax} +% |\scripturestyle|\marg{name}\marg{options} +% |\scripturestyle*|\marg{name}\marg{options} +% \end{syntax} +% Set \meta{|options|} which are saved as style with \meta{|name|}. These +% can later be set with the \opt{style} option. The starred version appends +% \meta{|options|} to an existing style rather than overwriting all options. +% \end{function} +% % \changes{v1.1}{2022/07/29}{Add \cs{selah} function} % \begin{function}[added=2022-07-29]{\selah} % \begin{syntax} @@ -645,14 +659,6 @@ % \end{scripture} % \end{scriptureexample} % -% \begin{function}{\scripturesetup} -% \begin{syntax} -% |\scripturesetup|\marg{options} -% \end{syntax} -% Set default format for quotations. See section \ref{options} for -% supported formatting \meta{|options|}. -% \end{function} -% % \changes{v1.2}{2022/08/30}{Add \cs{textright} function} % \begin{function}[added=2022-08-30]{\textright} % \begin{syntax} @@ -693,15 +699,16 @@ % \end{syntax} % \cs{textscripture} sets an inline scripture quotation. The quotation is % surrounded be the values of \opt{inline/begin} and \opt{inline/end} which -% default to |``\,| and |\,''|, respectively. This function also changes the -% defaults of some options as follows: +% default to |``\,| and |\,''|, respectively. This function also sets the +% \opt{compact} option and places the \val{reference} inline. The reference +% format can be controlled using the following options: % \begin{itemize} -% \item \opt{compact} is set -% \item \opt{reference/align} is set to |inline| -% \item \opt{reference/sep} is set to |0.5em| -% \item \opt{reference/format} is set to |(#1)| -% \item \opt{version/format} is set to |#1| +% \item \opt{inline/reference/format} +% \item \opt{inline/reference/sep} +% \item \opt{inline/version/delim} +% \item \opt{inline/version/format} % \end{itemize} +% Other \val{reference} and \val{version} options are inherited. % % This function is equivalent to using the \env{scripture} environment with % the \opt{inline} option. @@ -925,7 +932,8 @@ % \end{environment} % % \noindent Environment for typesetting narrow sections of scripture -% quotations. +% quotations. If there is no blank line before the start of a \env{narrow} +% environment the indent will be suppressed. % % See section \ref{narrowoptions} for supported formatting \meta{|options|}. % @@ -939,6 +947,7 @@ % % \vs{19}The field commander said to them, `Tell % Hezekiah: +% % \begin{narrow} % `\thinspace``This is what the great king, the % king of Assyria, says: on what are you basing @@ -957,6 +966,7 @@ % % \vs{19}The field commander said to them, `Tell % Hezekiah: +% % \begin{narrow} % `\thinspace``This is what the great king, the % king of Assyria, says: on what are you basing @@ -1090,8 +1100,7 @@ % \lhead{\textbf{\rightmark}} % \rhead{\textbf{\leftmark} \textbar\ \thepage} % \begin{document} -% \noindent -% \begin{scripture} +% \begin{scripture}[][noindent] % \vs{45}Instead he went out and began to talk % freely, spreading the news. As a result, Jesus % could no longer enter a town openly but stayed @@ -1113,8 +1122,7 @@ % % \rule[2mm]{\linewidth}{0.4pt} % -% \noindent -% \begin{scripture} +% \begin{scripture}[][noindent] % \vs{45}Instead he went out and began to talk % freely, spreading the news. As a result, Jesus % could no longer enter a town openly but stayed @@ -1139,13 +1147,6 @@ % \cs{scripturesetup}|{|\meta{|options|}|}|. Local formatting \meta{|options|} % can be set by passing them to the various environments described above. % -% \textbf{Note:} It's not possible to pass non-expandable macros as key-value -% options to the optional argument of \cs{usepackage}. So if you want to set -% |font=|\cs{bfseries} as the default, you must use -% \cs{scripturesetup}|{font=|\cs{bfseries}|}|. It is not possible to use -% \cs{usepackage}|[font=|\cs{bfseries}|]{scripture}| (you will get a compile -% error). -% % \begin{option}{aboveskip} % \begin{syntax} % aboveskip = \meta{skip} \hfill Default: 0pt @@ -1409,19 +1410,20 @@ % \changes{v1.3}{2023/01/07}{Add \opt{inline} option} % \begin{option}[added=2023-01-07]{inline} % \begin{syntax} -% inline +% inline = \meta{boolean} \hfill Default: false % \end{syntax} % Set the scripture quotation inline. The quotation is surrounded be the % values of \opt{inline/begin} and \opt{inline/end} which default to |``\,| -% and |\,''|, respectively. This option also changes the defaults of some -% other options as follows: +% and |\,''|, respectively. This option also sets the \opt{compact} option +% set sets the \val{reference} inline. The reference format can be +% controlled using the following options: % \begin{itemize} -% \item \opt{compact} is set -% \item \opt{reference/align} is set to |inline| -% \item \opt{reference/sep} is set to |0.5em| -% \item \opt{reference/format} is set to |(#1)| -% \item \opt{version/format} is set to |#1| +% \item \opt{inline/reference/format} +% \item \opt{inline/reference/sep} +% \item \opt{inline/version/delim} +% \item \opt{inline/version/format} % \end{itemize} +% Other \val{reference} and \val{version} options are inherited. % % \textbf{Warning:} \cs{par} is redefined to \cs{relax} when the % \opt{inline} option is set. If you have anything other than expected @@ -1448,6 +1450,43 @@ % (if specified). % \end{option} % +% \changes{v2.0}{2023/12/27}{Add \opt{inline/reference/format} option} +% \begin{option}[added=2023-12-27]{inline/reference/format} +% \begin{syntax} +% inline/reference/format = \meta{macro} \hfill Default: (\#1) +% \end{syntax} +% \meta{|macro|} used to format the \val{reference} for an inline +% \env{scripture} quotation. |#1| contains the text of the \val{reference} +% and \val{version} (if specified). +% \end{option} +% +% \changes{v2.0}{2023/12/27}{Add \opt{inline/reference/sep} option} +% \begin{option}[added=2023-12-27]{inline/reference/sep} +% \begin{syntax} +% inline/reference/sep = \meta{dimen} \hfill Default: 0.5em +% \end{syntax} +% The \meta{|dimen|} between the end of an inline \env{scripture} quotation +% and its \val{reference}. +% \end{option} +% +% \changes{v2.0}{2023/12/27}{Add \opt{inline/version/delim} option} +% \begin{option}[added=2023-12-27]{inline/version/delim} +% \begin{syntax} +% inline/version/delim = \meta{delim} \hfill Default: \{\ \} +% \end{syntax} +% \meta{|delim|} to use between the \val{reference} and the \val{version} of +% an inline \env{scripture} quotation. +% \end{option} +% +% \changes{v2.0}{2023/12/27}{Add \opt{inline/version/format} option} +% \begin{option}[added=2023-12-27]{inline/version/format} +% \begin{syntax} +% inline/version/format = \meta{macro} \hfill Default: \#1 +% \end{syntax} +% \meta{|macro|} used to format the \val{version} for an inline +% \env{scripture} quotation. |#1| contains the text of the \val{version}. +% \end{option} +% % \begin{option}{indent} % \begin{syntax} % indent = \meta{boolean} \hfill Default: true @@ -1578,10 +1617,10 @@ % \changes{v1.3}{2023/01/08}{Add \opt{reference/align} option} % \begin{option}[added=2023-01-08]{reference/align} % \begin{syntax} -% reference/align = inline \textbar\ left \textbar\ right \hfill Default: right +% reference/align = left \textbar\ right \hfill Default: right % \end{syntax} -% Set the alignment of the reference. For |left| and |right| the reference -% will not break across lines, but a line break is permitted for |inline|. +% Set the alignment of the reference. Note that in neither case will the +% reference break across lines. % \end{option} % % \changes{v1.2}{2022/09/07}{Add \opt{reference/colour} option} @@ -1669,6 +1708,15 @@ % \meta{|text|} used to for \cs{selah} in a \env{poetry} environment. % \end{option} % +% \changes{v2.0}{2023/12/27}{Add \opt{style} option} +% \begin{option}[added=2023/12/27]{style} +% \begin{syntax} +% style = \meta{name} +% \end{syntax} +% Set options previously saved with \cs{scripturestyle}. An error occurs if +% the style isn't defined. +% \end{option} +% % \changes{v1.2}{2022/08/30}{Add \opt{textright/sep} option} % \begin{option}[added=2022-08-30]{textright/sep} % \begin{syntax} @@ -1814,7 +1862,7 @@ % \changes{v1.1}{2022/07/28}{Add \opt{verse/sep} option with small default} % \begin{option}[added=2022-07-28]{verse/sep} % \begin{syntax} -% verse/sep = \meta{dimen} \hfill Default: 0.05 em +% verse/sep = \meta{dimen} \hfill Default: 0.05em % \end{syntax} % \meta{|dimen|} used to separate a \cs{vs} from the following text. % \end{option} @@ -2211,8 +2259,8 @@ % \end{macrocode} % % \begin{macrocode} -\NeedsTeXFormat{LaTeX2e}[2022-06-01] -\ProvidesExplPackage{scripture}{2023/01/08}{1.3} +\NeedsTeXFormat{LaTeX2e}[2022-11-01] +\ProvidesExplPackage{scripture}{2023/12/27}{2.0} {Format Scripture Quotations (DCP)} % \end{macrocode} % @@ -2247,6 +2295,16 @@ have~been~loaded~and~set~up.~Ignoring~option~language=#1. } % \end{macrocode} % +% Error if an unknown \opt{style} is requested. +% +% \begin{macrocode} +\msg_new:nnnn { scripture } { unknown-style } + { Style~#1~not~defined. } + { You~have~requested~style=#1,~but~it~has~not~been~defined.~ + You~can~define~it~using~\token_to_str:N \scripturestyle.~ + Ignoring~option~style=#1. } +% \end{macrocode} +% % \subsection{Options} % % Key-value settings for the \env{scripture} environment and its inner @@ -2254,284 +2312,293 @@ % \begin{macrocode} \keys_define:nn { scripture } { - , aboveskip .tl_set:N = \l_@@_aboveskip_tl - , aboveskip .value_required:n = true - , aboveskip .initial:n = \c_zero_skip - , added / font .tl_set:N = \l_@@_added_font_tl - , added / font .value_required:n = true - , added / font .initial:n = - , added / format .cs_set:Np = \@@_added_format:n #1 - , added / format .value_required:n = true - , added / format .initial:n = \emph { #1 } - , belowskip .tl_set:N = \l_@@_belowskip_tl - , belowskip .value_required:n = true - , belowskip .initial:n = \c_zero_skip - , colour .tl_set:N = \l_@@_colour_tl - , colour .value_required:n = true - , colour .initial:n = . - , color .meta:n = { colour = { #1 } } - , compact .bool_set:N = \l_@@_compact_bool - , compact .default:n = true - , compact .initial:n = false - , chapter / font .tl_set:N = \l_@@_chap_font_tl - , chapter / font .value_required:n = true - , chapter / font .initial:n = \bfseries - , chapter / colour .tl_set:N = \l_@@_chapter_colour_tl - , chapter / colour .value_required:n = true - , chapter / colour .initial:n = . - , chapter / color .meta:n = { chapter / colour = { #1 } } - , chapter / drop .bool_set:N = \l_@@_chap_drop_bool - , chapter / drop .default:n = true - , chapter / drop .initial:n = true - , chapter / format .cs_set:Np = \@@_chap_format:n #1 - , chapter / format .value_required:n = true - , chapter / format .initial:n = #1 - , chapter / hide .bool_set_inverse:N = \l_@@_chap_show_bool - , chapter / hide .default:n = true - , chapter / nodrop .bool_set_inverse:N = \l_@@_chap_drop_bool - , chapter / nodrop .default:n = true - , chapter / sep .tl_set:N = \l_@@_chap_sep_tl - , chapter / sep .value_required:n = true - , chapter / sep .initial:n = 0.5 em - , chapter / show .bool_set:N = \l_@@_chap_show_bool - , chapter / show .default:n = true - , chapter / show .initial:n = true - , chapter / showverse .bool_set:N = \l_@@_chap_show_verse_bool - , chapter / showverse .default:n = true - , chapter / showverse .initial:n = false - , extraskip .tl_set:N = \l_@@_extraskip_tl - , extraskip .value_required:n = true - , extraskip .initial:n = \medskipamount - , font .tl_set:N = \l_@@_font_tl - , font .value_required:n = true - , font .initial:n = - , indent .bool_set:N = \l_@@_indent_bool - , indent .default:n = true - , indent .initial:n = true - , _inline .bool_set:N = \l_@@_inline_bool - , _inline .initial:n = false - , inline .meta:n = { - _inline = true , - compact , - reference / format = (##1) , - reference / align = inline , - reference / sep = 0.5 em, - version / format = ##1 - } - , inline .value_forbidden:n = true - , inline / begin .tl_set:N = \l_@@_inline_begin_tl - , inline / begin .value_required:n = true - , inline / begin .initial:n = ``\, - , inline / end .tl_set:N = \l_@@_inline_end_tl - , inline / end .value_required:n = true - , inline / end .initial:n = \,'' - , language .tl_set:N = \l_@@_language_tl - , language .value_required:n = true - , language .initial:n = - , language / variant .tl_set:N = \l_@@_language_variant_tl - , language / variant .value_required:n = true - , language / variant .initial:n = - , leftmargin .tl_set:N = \l_@@_leftmargin_tl - , leftmargin .value_required:n = true - , leftmargin .initial:n = \c_zero_dim - , name / font .tl_set:N = \l_@@_name_font_tl - , name / font .value_required:n = true - , name / font .initial:n = \scshape - , name / format .cs_set:Np = \@@_name_format:n #1 - , name / format .value_required:n = true - , name / format .initial:n = #1 - , noindent .bool_set_inverse:N = \l_@@_indent_bool - , noindent .default:n = true - , parindent .tl_set:N = \l_@@_parindent_tl - , parindent .value_required:n = true - , parindent .initial:n = \parindent - , parskip .tl_set:N = \l_@@_parskip_tl - , parskip .value_required:n = true - , parskip .initial:n = \parskip - , redletter .bool_set:N = \l_@@_red_letter_bool - , redletter .default:n = true - , redletter .initial:n = false - , redletter / colour .tl_set:N = \l_@@_red_letter_colour_tl - , redletter / colour .value_required:n = true - , redletter / colour .initial:n = red!80!black - , redletter / color .meta:n = { redletter / colour = { #1 } } - , reference / align .choices:nn = { inline, left, right } - { - \tl_if_exist:NF \l_@@_ref_align_tl - { \tl_new:N \l_@@_ref_align_tl } - \tl_set_eq:NN \l_@@_ref_align_tl \l_keys_choice_tl - } - , reference / align .value_required:n = true - , reference / align .initial:n = right - , reference / colour .tl_set:N = \l_@@_ref_colour_tl - , reference / colour .value_required:n = true - , reference / colour .initial:n = . - , reference / color .meta:n = { reference / colour = { #1 } } - , reference / font .tl_set:N = \l_@@_ref_font_tl - , reference / font .value_required:n = true - , reference / font .initial:n = \bfseries - , reference / format .cs_set:Np = \@@_ref_format:n #1 - , reference / format .value_required:n = true - , reference / format .initial:n = #1 - , reference / newline .meta:n = { reference / sep = \linewidth } - , reference / newline .value_forbidden:n = true - , reference / sep .tl_set:N = \l_@@_ref_sep_tl - , reference / sep .value_required:n = true - , reference / sep .initial:n = 2 em - , rightmargin .tl_set:N = \l_@@_rightmargin_tl - , rightmargin .value_required:n = true - , rightmargin .initial:n = \c_zero_dim - , selah / text .tl_set:N = \l_@@_selah_text_tl - , selah / text .value_required:n = true - , selah / text .initial:n = Selah - , selah / font .tl_set:N = \l_@@_selah_font_tl - , selah / font .value_required:n = true - , selah / font .initial:n = \itshape - , selah / format .cs_set:Np = \@@_selah_format:n #1 - , selah / format .value_required:n = true - , selah / format .initial:n = #1 - , selah / sep .tl_set:N = \l_@@_selah_sep_tl - , selah / sep .value_required:n = true - , selah / sep .initial:n = 1 em - , textright / sep .tl_set:N = \l_@@_text_right_sep_tl - , textright / sep .value_required:n = true - , textright / sep .initial:n = 1 em - , verse / colour .tl_set:N = \l_@@_verse_colour_tl - , verse / colour .value_required:n = true - , verse / colour .initial:n = . - , verse / color .meta:n = { verse / colour = { #1 } } - , verse / first .bool_set:N = \l_@@_verse_first_bool - , verse / first .default:n = true - , verse / first .initial:n = false - , verse / firstformat .cs_set:Np = \@@_verse_first_format:n #1 - , verse / firstformat .value_required:n = true - , verse / firstformat .initial:n = #1 - , verse / firstsep .tl_set:N = \l_@@_verse_first_sep_tl - , verse / firstsep .value_required:n = true - , verse / firstsep .initial:n = 0.5em - , verse / font .tl_set:N = \l_@@_verse_font_tl - , verse / font .value_required:n = true - , verse / font .initial:n = - , verse / format .cs_set:Np = \@@_verse_format:n #1 - , verse / format .value_required:n = true - , verse / format .initial:n = \textsuperscript{#1} - , verse / hide .bool_set_inverse:N = \l_@@_verse_show_bool - , verse / hide .default:n = true - , verse / sep .tl_set:N = \l_@@_verse_sep_tl - , verse / sep .value_required:n = true - , verse / sep .initial:n = 0.05 em - , verse / show .bool_set:N = \l_@@_verse_show_bool - , verse / show .default:n = true - , verse / show .initial:n = true - , version .tl_set:N = \l_@@_version_tl - , version .value_required:n = true - , version .initial:n = - , version / delim .tl_set:N = \l_@@_version_delim_tl - , version / delim .value_required:n = true - , version / delim .initial:n = \c_space_tl - , version / format .cs_set:Np = \@@_version_format:n #1 - , version / format .value_required:n = true - , version / format .initial:n = (#1) + , aboveskip .tl_set:N = \l_@@_aboveskip_tl + , aboveskip .value_required:n = true + , aboveskip .initial:n = \c_zero_skip + , added / font .tl_set:N = \l_@@_added_font_tl + , added / font .value_required:n = true + , added / font .initial:n = + , added / format .cs_set:Np = \@@_added_format:n #1 + , added / format .value_required:n = true + , added / format .initial:n = \emph { #1 } + , belowskip .tl_set:N = \l_@@_belowskip_tl + , belowskip .value_required:n = true + , belowskip .initial:n = \c_zero_skip + , colour .tl_set:N = \l_@@_colour_tl + , colour .value_required:n = true + , colour .initial:n = . + , color .meta:n = { colour = { #1 } } + , compact .bool_set:N = \l_@@_compact_bool + , compact .default:n = true + , compact .initial:n = false + , chapter / font .tl_set:N = \l_@@_chap_font_tl + , chapter / font .value_required:n = true + , chapter / font .initial:n = \bfseries + , chapter / colour .tl_set:N = \l_@@_chapter_colour_tl + , chapter / colour .value_required:n = true + , chapter / colour .initial:n = . + , chapter / color .meta:n = { chapter / colour = { #1 } } + , chapter / drop .bool_set:N = \l_@@_chap_drop_bool + , chapter / drop .default:n = true + , chapter / drop .initial:n = true + , chapter / format .cs_set:Np = \@@_chap_format:n #1 + , chapter / format .value_required:n = true + , chapter / format .initial:n = #1 + , chapter / hide .bool_set_inverse:N = \l_@@_chap_show_bool + , chapter / hide .default:n = true + , chapter / nodrop .bool_set_inverse:N = \l_@@_chap_drop_bool + , chapter / nodrop .default:n = true + , chapter / sep .tl_set:N = \l_@@_chap_sep_tl + , chapter / sep .value_required:n = true + , chapter / sep .initial:n = 0.5 em + , chapter / show .bool_set:N = \l_@@_chap_show_bool + , chapter / show .default:n = true + , chapter / show .initial:n = true + , chapter / showverse .bool_set:N = \l_@@_chap_show_verse_bool + , chapter / showverse .default:n = true + , chapter / showverse .initial:n = false + , extraskip .tl_set:N = \l_@@_extraskip_tl + , extraskip .value_required:n = true + , extraskip .initial:n = \medskipamount + , font .tl_set:N = \l_@@_font_tl + , font .value_required:n = true + , font .initial:n = + , indent .bool_set:N = \l_@@_indent_bool + , indent .default:n = true + , indent .initial:n = true + , inline .bool_set:N = \l_@@_inline_bool + , inline .default:n = true + , inline .initial:n = false + , inline / begin .tl_set:N = \l_@@_inline_begin_tl + , inline / begin .value_required:n = true + , inline / begin .initial:n = ``\, + , inline / end .tl_set:N = \l_@@_inline_end_tl + , inline / end .value_required:n = true + , inline / end .initial:n = \,'' + , inline / reference / format .cs_set:Np = \@@_inline_ref_format:n #1 + , inline / reference / format .value_required:n = true + , inline / reference / format .initial:n = (#1) + , inline / reference / sep .tl_set:N = \l_@@_inline_ref_sep_tl + , inline / reference / sep .value_required:n = true + , inline / reference / sep .initial:n = 0.5 em + , inline / version / delim .tl_set:N = \l_@@_inline_version_delim_tl + , inline / version / delim .value_required:n = true + , inline / version / delim .initial:n = \c_space_tl + , inline / version / format .cs_set:Np = \@@_inline_version_format:n #1 + , inline / version / format .value_required:n = true + , inline / version / format .initial:n = #1 + , language .tl_set:N = \l_@@_language_tl + , language .value_required:n = true + , language .initial:n = + , language / variant .tl_set:N = \l_@@_language_variant_tl + , language / variant .value_required:n = true + , language / variant .initial:n = + , leftmargin .tl_set:N = \l_@@_leftmargin_tl + , leftmargin .value_required:n = true + , leftmargin .initial:n = \c_zero_dim + , name / font .tl_set:N = \l_@@_name_font_tl + , name / font .value_required:n = true + , name / font .initial:n = \scshape + , name / format .cs_set:Np = \@@_name_format:n #1 + , name / format .value_required:n = true + , name / format .initial:n = #1 + , noindent .bool_set_inverse:N = \l_@@_indent_bool + , noindent .default:n = true + , parindent .tl_set:N = \l_@@_parindent_tl + , parindent .value_required:n = true + , parindent .initial:n = \parindent + , parskip .tl_set:N = \l_@@_parskip_tl + , parskip .value_required:n = true + , parskip .initial:n = \parskip + , redletter .bool_set:N = \l_@@_red_letter_bool + , redletter .default:n = true + , redletter .initial:n = false + , redletter / colour .tl_set:N = \l_@@_red_letter_colour_tl + , redletter / colour .value_required:n = true + , redletter / colour .initial:n = red!80!black + , redletter / color .meta:n = { redletter / colour = { #1 } } + , reference / align .choices:nn = { left, right } + { + \tl_if_exist:NF \l_@@_ref_align_tl + { \tl_new:N \l_@@_ref_align_tl } + \tl_set_eq:NN \l_@@_ref_align_tl \l_keys_choice_tl + } + , reference / align .value_required:n = true + , reference / align .initial:n = right + , reference / colour .tl_set:N = \l_@@_ref_colour_tl + , reference / colour .value_required:n = true + , reference / colour .initial:n = . + , reference / color .meta:n = { reference / colour = { #1 } } + , reference / font .tl_set:N = \l_@@_ref_font_tl + , reference / font .value_required:n = true + , reference / font .initial:n = \bfseries + , reference / format .cs_set:Np = \@@_ref_format:n #1 + , reference / format .value_required:n = true + , reference / format .initial:n = #1 + , reference / newline .meta:n = { reference / sep = \linewidth } + , reference / newline .value_forbidden:n = true + , reference / sep .tl_set:N = \l_@@_ref_sep_tl + , reference / sep .value_required:n = true + , reference / sep .initial:n = 2 em + , rightmargin .tl_set:N = \l_@@_rightmargin_tl + , rightmargin .value_required:n = true + , rightmargin .initial:n = \c_zero_dim + , selah / text .tl_set:N = \l_@@_selah_text_tl + , selah / text .value_required:n = true + , selah / text .initial:n = Selah + , selah / font .tl_set:N = \l_@@_selah_font_tl + , selah / font .value_required:n = true + , selah / font .initial:n = \itshape + , selah / format .cs_set:Np = \@@_selah_format:n #1 + , selah / format .value_required:n = true + , selah / format .initial:n = #1 + , selah / sep .tl_set:N = \l_@@_selah_sep_tl + , selah / sep .value_required:n = true + , selah / sep .initial:n = 1 em + , style .choice: + , style / unknown .code:n = \msg_error:nnx + { scripture } + { unknown-style } + { \exp_not:n {#1} } + , textright / sep .tl_set:N = \l_@@_text_right_sep_tl + , textright / sep .value_required:n = true + , textright / sep .initial:n = 1 em + , verse / colour .tl_set:N = \l_@@_verse_colour_tl + , verse / colour .value_required:n = true + , verse / colour .initial:n = . + , verse / color .meta:n = { verse / colour = { #1 } } + , verse / first .bool_set:N = \l_@@_verse_first_bool + , verse / first .default:n = true + , verse / first .initial:n = false + , verse / firstformat .cs_set:Np = \@@_verse_first_format:n #1 + , verse / firstformat .value_required:n = true + , verse / firstformat .initial:n = #1 + , verse / firstsep .tl_set:N = \l_@@_verse_first_sep_tl + , verse / firstsep .value_required:n = true + , verse / firstsep .initial:n = 0.5em + , verse / font .tl_set:N = \l_@@_verse_font_tl + , verse / font .value_required:n = true + , verse / font .initial:n = + , verse / format .cs_set:Np = \@@_verse_format:n #1 + , verse / format .value_required:n = true + , verse / format .initial:n = \textsuperscript{#1} + , verse / hide .bool_set_inverse:N = \l_@@_verse_show_bool + , verse / hide .default:n = true + , verse / sep .tl_set:N = \l_@@_verse_sep_tl + , verse / sep .value_required:n = true + , verse / sep .initial:n = 0.05 em + , verse / show .bool_set:N = \l_@@_verse_show_bool + , verse / show .default:n = true + , verse / show .initial:n = true + , version .tl_set:N = \l_@@_version_tl + , version .value_required:n = true + , version .initial:n = + , version / delim .tl_set:N = \l_@@_version_delim_tl + , version / delim .value_required:n = true + , version / delim .initial:n = \c_space_tl + , version / format .cs_set:Np = \@@_version_format:n #1 + , version / format .value_required:n = true + , version / format .initial:n = (#1) % \end{macrocode} % Options for the \env{center} environment. % \begin{macrocode} - , center / aboveskip .tl_set:N = \l_@@_center_aboveskip_tl - , center / aboveskip .value_required:n = true - , center / aboveskip .initial:n = \medskipamount - , center / belowskip .tl_set:N = \l_@@_center_belowskip_tl - , center / belowskip .value_required:n = true - , center / belowskip .initial:n = \medskipamount - , center / leftmargin .tl_set:N = \l_@@_center_leftmargin_tl - , center / leftmargin .value_required:n = true - , center / leftmargin .initial:n = \c_zero_dim - , center / rightmargin .tl_set:N = \l_@@_center_rightmargin_tl - , center / rightmargin .value_required:n = true - , center / rightmargin .initial:n = \c_zero_dim + , center / aboveskip .tl_set:N = \l_@@_center_aboveskip_tl + , center / aboveskip .value_required:n = true + , center / aboveskip .initial:n = \medskipamount + , center / belowskip .tl_set:N = \l_@@_center_belowskip_tl + , center / belowskip .value_required:n = true + , center / belowskip .initial:n = \medskipamount + , center / leftmargin .tl_set:N = \l_@@_center_leftmargin_tl + , center / leftmargin .value_required:n = true + , center / leftmargin .initial:n = \c_zero_dim + , center / rightmargin .tl_set:N = \l_@@_center_rightmargin_tl + , center / rightmargin .value_required:n = true + , center / rightmargin .initial:n = \c_zero_dim % \end{macrocode} % Options for the \env{flushright} environment. % \begin{macrocode} - , flushright / aboveskip .tl_set:N = \l_@@_flushright_aboveskip_tl - , flushright / aboveskip .value_required:n = true - , flushright / aboveskip .initial:n = \medskipamount - , flushright / belowskip .tl_set:N = \l_@@_flushright_belowskip_tl - , flushright / belowskip .value_required:n = true - , flushright / belowskip .initial:n = \medskipamount - , flushright / leftmargin .tl_set:N = \l_@@_flushright_leftmargin_tl - , flushright / leftmargin .value_required:n = true - , flushright / leftmargin .initial:n = \c_zero_dim - , flushright / rightmargin .tl_set:N = \l_@@_flushright_rightmargin_tl - , flushright / rightmargin .value_required:n = true - , flushright / rightmargin .initial:n = \c_zero_dim + , flushright / aboveskip .tl_set:N = \l_@@_flushright_aboveskip_tl + , flushright / aboveskip .value_required:n = true + , flushright / aboveskip .initial:n = \medskipamount + , flushright / belowskip .tl_set:N = \l_@@_flushright_belowskip_tl + , flushright / belowskip .value_required:n = true + , flushright / belowskip .initial:n = \medskipamount + , flushright / leftmargin .tl_set:N = \l_@@_flushright_leftmargin_tl + , flushright / leftmargin .value_required:n = true + , flushright / leftmargin .initial:n = \c_zero_dim + , flushright / rightmargin .tl_set:N = \l_@@_flushright_rightmargin_tl + , flushright / rightmargin .value_required:n = true + , flushright / rightmargin .initial:n = \c_zero_dim % \end{macrocode} % Options for the \env{hanging} environment. % \begin{macrocode} - , hanging / aboveskip .tl_set:N = \l_@@_hanging_aboveskip_tl - , hanging / aboveskip .value_required:n = true - , hanging / aboveskip .initial:n = \medskipamount - , hanging / belowskip .tl_set:N = \l_@@_hanging_belowskip_tl - , hanging / belowskip .value_required:n = true - , hanging / belowskip .initial:n = \medskipamount - , hanging / hang .tl_set:N = \l_@@_hanging_hang_tl - , hanging / hang .value_required:n = true - , hanging / hang .initial:n = 2 em - , hanging / leftmargin .tl_set:N = \l_@@_hanging_leftmargin_tl - , hanging / leftmargin .value_required:n = true - , hanging / leftmargin .initial:n = 1 em - , hanging / rightmargin .tl_set:N = \l_@@_hanging_rightmargin_tl - , hanging / rightmargin .value_required:n = true - , hanging / rightmargin .initial:n = \c_zero_dim + , hanging / aboveskip .tl_set:N = \l_@@_hanging_aboveskip_tl + , hanging / aboveskip .value_required:n = true + , hanging / aboveskip .initial:n = \medskipamount + , hanging / belowskip .tl_set:N = \l_@@_hanging_belowskip_tl + , hanging / belowskip .value_required:n = true + , hanging / belowskip .initial:n = \medskipamount + , hanging / hang .tl_set:N = \l_@@_hanging_hang_tl + , hanging / hang .value_required:n = true + , hanging / hang .initial:n = 2 em + , hanging / leftmargin .tl_set:N = \l_@@_hanging_leftmargin_tl + , hanging / leftmargin .value_required:n = true + , hanging / leftmargin .initial:n = 1 em + , hanging / rightmargin .tl_set:N = \l_@@_hanging_rightmargin_tl + , hanging / rightmargin .value_required:n = true + , hanging / rightmargin .initial:n = \c_zero_dim % \end{macrocode} % Options for the mid-paragraph chapters (including the \env{midparachap} environment). % \begin{macrocode} - , midparachap / hideverse .bool_set_inverse:N = \l_@@_midparachap_show_verse_bool - , midparachap / hideverse .default:n = true - , midparachap / showverse .bool_set:N = \l_@@_midparachap_show_verse_bool - , midparachap / showverse .default:n = true - , midparachap / showverse .initial:n = true + , midparachap / hideverse .bool_set_inverse:N = \l_@@_midparachap_show_verse_bool + , midparachap / hideverse .default:n = true + , midparachap / showverse .bool_set:N = \l_@@_midparachap_show_verse_bool + , midparachap / showverse .default:n = true + , midparachap / showverse .initial:n = true % \end{macrocode} % Options for the \env{narrow} environment. % \begin{macrocode} - , narrow / aboveskip .tl_set:N = \l_@@_narrow_aboveskip_tl - , narrow / aboveskip .value_required:n = true - , narrow / aboveskip .initial:n = \medskipamount - , narrow / belowskip .tl_set:N = \l_@@_narrow_belowskip_tl - , narrow / belowskip .value_required:n = true - , narrow / belowskip .initial:n = \medskipamount - , narrow / leftmargin .tl_set:N = \l_@@_narrow_leftmargin_tl - , narrow / leftmargin .value_required:n = true - , narrow / leftmargin .initial:n = 1 em - , narrow / rightmargin .tl_set:N = \l_@@_narrow_rightmargin_tl - , narrow / rightmargin .value_required:n = true - , narrow / rightmargin .initial:n = 1 em + , narrow / aboveskip .tl_set:N = \l_@@_narrow_aboveskip_tl + , narrow / aboveskip .value_required:n = true + , narrow / aboveskip .initial:n = \medskipamount + , narrow / belowskip .tl_set:N = \l_@@_narrow_belowskip_tl + , narrow / belowskip .value_required:n = true + , narrow / belowskip .initial:n = \medskipamount + , narrow / leftmargin .tl_set:N = \l_@@_narrow_leftmargin_tl + , narrow / leftmargin .value_required:n = true + , narrow / leftmargin .initial:n = 1 em + , narrow / rightmargin .tl_set:N = \l_@@_narrow_rightmargin_tl + , narrow / rightmargin .value_required:n = true + , narrow / rightmargin .initial:n = 1 em % \end{macrocode} % Options for the \env{poetry} environment. % \begin{macrocode} - , poetry / aboveskip .tl_set:N = \l_@@_poetry_aboveskip_tl - , poetry / aboveskip .value_required:n = true - , poetry / aboveskip .initial:n = \medskipamount - , poetry / belowskip .tl_set:N = \l_@@_poetry_belowskip_tl - , poetry / belowskip .value_required:n = true - , poetry / belowskip .initial:n = \medskipamount - , poetry / bigindent .tl_set:N = \l_@@_poetry_big_indent_tl - , poetry / bigindent .value_required:n = true - , poetry / bigindent .initial:n = 4 em - , poetry / indent .tl_set:N = \l_@@_poetry_indent_tl - , poetry / indent .value_required:n = true - , poetry / indent .initial:n = 1 em - , poetry / leftmargin .tl_set:N = \l_@@_poetry_leftmargin_tl - , poetry / leftmargin .value_required:n = true - , poetry / leftmargin .initial:n = 1 em - , poetry / rightmargin .tl_set:N = \l_@@_poetry_rightmargin_tl - , poetry / rightmargin .value_required:n = true - , poetry / rightmargin .initial:n = \c_zero_dim - , poetry / verse / left .bool_set_inverse:N = \l_@@_poetry_verse_right_bool - , poetry / verse / left .default:n = true - , poetry / verse / right .bool_set:N = \l_@@_poetry_verse_right_bool - , poetry / verse / right .default:n = true - , poetry / verse / right .initial:n = true - , poetry / verse / sep .tl_set:N = \l_@@_poetry_verse_sep_tl - , poetry / verse / sep .value_required:n = true - , poetry / verse / sep .initial:n = 0.05 em + , poetry / aboveskip .tl_set:N = \l_@@_poetry_aboveskip_tl + , poetry / aboveskip .value_required:n = true + , poetry / aboveskip .initial:n = \medskipamount + , poetry / belowskip .tl_set:N = \l_@@_poetry_belowskip_tl + , poetry / belowskip .value_required:n = true + , poetry / belowskip .initial:n = \medskipamount + , poetry / bigindent .tl_set:N = \l_@@_poetry_big_indent_tl + , poetry / bigindent .value_required:n = true + , poetry / bigindent .initial:n = 4 em + , poetry / indent .tl_set:N = \l_@@_poetry_indent_tl + , poetry / indent .value_required:n = true + , poetry / indent .initial:n = 1 em + , poetry / leftmargin .tl_set:N = \l_@@_poetry_leftmargin_tl + , poetry / leftmargin .value_required:n = true + , poetry / leftmargin .initial:n = 1 em + , poetry / rightmargin .tl_set:N = \l_@@_poetry_rightmargin_tl + , poetry / rightmargin .value_required:n = true + , poetry / rightmargin .initial:n = \c_zero_dim + , poetry / verse / left .bool_set_inverse:N = \l_@@_poetry_verse_right_bool + , poetry / verse / left .default:n = true + , poetry / verse / right .bool_set:N = \l_@@_poetry_verse_right_bool + , poetry / verse / right .default:n = true + , poetry / verse / right .initial:n = true + , poetry / verse / sep .tl_set:N = \l_@@_poetry_verse_sep_tl + , poetry / verse / sep .value_required:n = true + , poetry / verse / sep .initial:n = 0.05 em } % \end{macrocode} % Process package options. @@ -2539,6 +2606,30 @@ \ProcessKeyOptions % \end{macrocode} % +% \begin{macro}{\@@_setup_style:nnn} +% Specify options which can later be activated using the \opt{style} option. +% If the first argument is \val{true}, then the options are appended rather +% than replaced. +% \begin{macrocode} +\cs_new_protected:Nn \@@_setup_style:nnn + { + \bool_if:NTF #1 + { + \tl_if_exist:cF { g__@@_style_ #2 _tl } + { \tl_new:c { g__@@_style_ #2 _tl } } + \@@_setup_style:nne \c_false_bool { #2 } + { \tl_use:c { g__@@_style_ #2 _tl } , #3 } + } + { + \tl_gset:cn { g__@@_style_ #2 _tl } { #3 } + \keys_define:nn { scripture } + { style / #2 .meta:n = { #3 } } + } + } +\cs_generate_variant:Nn \@@_setup_style:nnn { nne } +% \end{macrocode} +% \end{macro} +% % \subsection{Hooks} % % \begin{hooks}{scripture/chap/before, scripture/chap/after, @@ -2570,6 +2661,64 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\g_@@_prev_inner_below_skip} +% Save the last below skip of an inner environment so it can be removed if +% the main scripture environment ends with and inner environment. +% \begin{macrocode} +\skip_new:N \g_@@_prev_inner_below_skip +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\l_@@_outer_itemindent_dim} +% Holds the \cs{itemindent} of the outer list. Used to calculate the +% \cs{itemindent} to retain correct indenting when a list environment is +% the first thing in an outer list. +% \begin{macrocode} +\dim_new:N \l_@@_outer_itemindent_dim +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_setup_list_noindent:n} +% Set \cs{noindent} to do a negative horizontal skip a list is the first +% item in a list then restore it at the end of the paragraph. This allows +% \cs{itemindent} to be set to a negative value and still have \cs{noindent} +% behave as expected. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_setup_list_noindent:n + { + \legacy_if:nT {@newlist} + { + \cs_set_protected_nopar:Npn \noindent + { + \skip_horizontal:n { -#1 } + } + \hook_gput_next_code:nn { para / end } + { + \cs_gset_eq:NN \noindent \tex_noindent:D + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_skip_diff:NN} +% Find the difference between two skips while avoiding negative stretch and +% shrink components. +% \begin{macrocode} +\cs_new_protected:Nn \@@_skip_diff:NN + { + \skip_eval:n + { + \dim_eval:n { \dimexpr #1 - \dimexpr #2 } + ~ plus ~ + \dim_max:nn { \gluestretch #1 - \gluestretch #2 } \c_zero_dim + ~ minus ~ + \dim_max:nn { \glueshrink #1 - \glueshrink #2 } \c_zero_dim + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_extra_skip:} % Insert a little extra vertical space between two paragraphs. This function % tests if the previous paragraph is only one line in length and began @@ -2656,7 +2805,8 @@ % \begin{macrocode} \tl_if_empty:NF \l_@@_version_tl { - \l_@@_version_delim_tl + \tl_if_empty:nF { #1 } + { \l_@@_version_delim_tl } \@@_version_format:n { \l_@@_version_tl } } } @@ -2674,30 +2824,21 @@ { \@@_format_full_ref:n { #1 } } -% \end{macrocode} -% Since the \env{poetry} environment uses \cs{@@_obeylines:} there is always -% an extra \cs{parskip} when a \env{scripture} quotation ends with a -% \env{poetry} -% environment. -% \begin{macrocode} - \bool_if:NT \g_@@_poetry_end_bool - { \skip_vertical:n { -\parskip } } \dim_compare:nNnT { \box_wd:N \l_@@_ref_box + \g_@@_final_line_dim + \l_@@_ref_sep_tl } > \linewidth - { \skip_vertical:N \baselineskip } -% \end{macrocode} -% If a \env{scripture} quotation ends with an inner environment, there will -% be an extra space of \cs{baselineskip}. -% \begin{macrocode} - \int_compare:nNnT \prevgraf = \c_zero_int - { \skip_vertical:n { -\baselineskip } } - \tl_if_eq:NnT \l_@@_ref_align_tl { right } + { + \skip_vertical:N \baselineskip + \tl_if_eq:NnT \l_@@_ref_align_tl { left } + { + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \skip_vertical:N \baselineskip } + } + } + \tl_if_eq:NnTF \l_@@_ref_align_tl { right } { \hfill } - \tl_if_eq:NnT \l_@@_ref_align_tl { left } { - \mode_leave_vertical: \dim_compare:nNnT { \box_wd:N \l_@@_ref_box + \g_@@_final_line_dim + \l_@@_ref_sep_tl } < @@ -2798,7 +2939,7 @@ { \msg_warning:nnx { scripture } - { language-waning } + { language-warning } { \l_@@_language_tl } } } @@ -2893,8 +3034,7 @@ \hook_gput_next_code:nn { para / after } { \int_gset_eq:NN \g_@@_chap_par_prevgraf_int \prevgraf - \int_compare:nNnT - \g_@@_chap_par_prevgraf_int = 1 + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 { \penalty 10000 } \hook_gput_next_code:nn { para / before } { \int_set_eq:NN \clubpenalty \l_@@_clubpenalty_saved_int } @@ -2926,9 +3066,7 @@ \hook_use:n { scripture / chap / after } \group_end: \bool_if:NT \l_@@_chap_show_verse_bool - { - \@@_verse_output:n { 1 } - } + { \@@_verse_output:n { 1 } } } % \end{macrocode} % \end{macro} @@ -2995,13 +3133,13 @@ } \hook_gput_next_code:nn { para / before } { - \int_compare:nNnT - \g_@@_chap_par_prevgraf_int = 1 - { \extraskip } - \int_gzero:N \g_@@_chap_par_prevgraf_int - \int_compare:nNnT - \@listdepth > \c_zero_int - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } + \legacy_if:nF { @newlist } + { + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \extraskip } + \int_gzero:N \g_@@_chap_par_prevgraf_int + } + \parshape 1 ~ \@totalleftmargin ~ \linewidth } } % \end{macrocode} @@ -3103,14 +3241,10 @@ } $$ \@@_reset_spacing: - \dim_compare:nNnT \g_@@_final_line_dim > \linewidth - { - \dim_gset_eq:NN \g_@@_final_line_dim \linewidth - } + \dim_compare:nNnT \g_@@_final_line_dim > \paperwidth + { \dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth } } \dim_compare:nNnT \g_@@_final_line_dim > { \c_zero_dim - 1 sp } - { - \skip_vertical:n { -\baselineskip - \parskip } - } + { \skip_vertical:n { -\baselineskip - \parskip } } } % \end{macrocode} % \end{macro} @@ -3132,12 +3266,69 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\g_@@_start_bool} -% Flag indicating whether we are currently setting the first paragraph in a -% \env{scripture} environment. If this is \val{true}, any \opt{aboveskip} -% for an inner environment will be ignored. +% \begin{macro}{\@@_added:n} +% Mark text as added. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_added:n + { + \group_begin: + \l_@@_added_font_tl + \@@_added_format:n { #1 } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_name:n} +% Output divine name. % \begin{macrocode} -\bool_new:N \g_@@_start_bool +\cs_new_protected_nopar:Nn \@@_name:n + { + \group_begin: + \l_@@_name_font_tl + \@@_name_format:n { #1 } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_no_first_verse:} +% Suppress special formatting for first verse if active. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_no_first_verse: + { + \bool_set_true:N \l_@@_no_verse_first_bool + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_ch:nn} +% Print a chapter number in the main scripture environment. +% \begin{macrocode} +\cs_new_protected:Nn \@@_ch_output:nn + { + \bool_if:NTF \l_@@_chap_show_bool + { + \bool_if:NTF \l_@@_chap_drop_bool + { + \@@_chap:n { #2 } + \bool_if:nTF { #1 } + { + \hook_gput_next_code:nn { para / after } + { + \int_gzero:N \g_@@_chap_par_prevgraf_int + \int_gzero:N \g_@@_mid_para_chap_prevgraf_int + } + } + { + \hook_gput_next_code:nn { para / after } + { \int_gset_eq:NN \g_@@_mid_para_chap_prevgraf_int \prevgraf } + } + } + { \@@_nodrop_chap:n { #2 } } + } + { \@@_nodrop_chap:n { #2 } } + } % \end{macrocode} % \end{macro} % @@ -3146,6 +3337,7 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_begin:n { + \cs_set_eq:NN \@@_noindent_saved: \noindent \bool_if:NT \l_@@_active_bool { \msg_error:nn { scripture } { nested-environment } @@ -3157,131 +3349,74 @@ \keys_set:nn { scripture } { #1 } } \@@_select_language: -% \end{macrocode} -% If the \env{scripture} environment begins immediately after an \cs{item}, -% then insert a new paragraph and apply a negative skip. Life is much easier -% if all paragraphs in a \env{scripture} are the same rather than the first -% one being in the first paragraph of an \cs{item}. -% \begin{macrocode} - \legacy_if:nT { @newlist } - { - \strut - \par - \vspace* { \dim_eval:n { -\baselineskip - \parskip } } - } - \mode_if_vertical:T - { - \addvspace { \l_@@_aboveskip_tl } - } - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l_@@_chap_show_bool - { - \bool_if:NTF \l_@@_chap_drop_bool - { - \@@_chap:n { ##2 } - \bool_if:nT { ##1 } - { - \hook_gput_next_code:nn { para / after } - { \int_gzero:N \g_@@_chap_par_prevgraf_int } - } - } - { \@@_nodrop_chap:n { ##2 } } - } - { \@@_nodrop_chap:n { ##2 } } - } + \int_gzero:N \g_@@_chap_par_prevgraf_int % \end{macrocode} % Empty \cs{everydisplay} to ensure it isn't interring with spacing. % \begin{macrocode} \everydisplay { } \int_set:Nn \predisplaypenalty { 10000 } \int_set_eq:NN \postdisplaypenalty \@lowpenalty - \bool_gset_true:N \g_@@_start_bool + \int_set:Nn \@beginparpenalty { -\@lowpenalty } + \int_set_eq:NN \@endparpenalty \@lowpenalty \bool_gset_false:N \g_@@_poetry_end_bool - \dim_set_eq:NN \parindent \l_@@_parindent_tl \cs_set_eq:NN \extraskip \@@_extra_skip: \cs_set_eq:NN \redletteron \@@_red_letter_on: \cs_set_eq:NN \redletteroff \@@_red_letter_off: + \DeclareDocumentCommand { \ch } { sm } + { \@@_ch_output:nn { ##1 } { ##2 } } \cs_set_eq:NN \vs \@@_verse_output:n - \cs_set_protected_nopar:Npn \added ##1 - { - \group_begin: - \l_@@_added_font_tl - \@@_added_format:n { ##1 } - \group_end: - } - \cs_set_protected_nopar:Npn \name ##1 - { - \group_begin: - \l_@@_name_font_tl - \@@_name_format:n { ##1 } - \group_end: - } - \cs_set_protected_nopar:Npn \nofirstverse - { - \bool_set_true:N \l_@@_no_verse_first_bool - } - \cs_set_protected_nopar:Npn \LORD - { - \name { Lord } - } - \cs_set_protected_nopar:Npn \GOD - { - \name { God } - } + \cs_set_eq:NN \added \@@_added:n + \cs_set_eq:NN \name \@@_name:n + \cs_set_protected_nopar:Npn \LORD { \name { Lord } } + \cs_set_protected_nopar:Npn \GOD { \name { God } } + \cs_set_eq:NN \nofirstverse \@@_no_first_verse: \cs_set_protected_nopar:Npn \textright ##1 - { - \@@_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } - } + { \@@_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } } \hook_gclear_next_code:n { para / before } - \skip_set:Nn \l_@@_parskip_correction_skip { \parskip - \l_@@_parskip_tl } - \mode_if_vertical:T - { - \addvspace { \l_@@_parskip_correction_skip } - } - \skip_set_eq:NN \parskip \l_@@_parskip_tl \l_@@_font_tl \exp_args:NnV \color_set:nn { scripture default colour } \l_@@_colour_tl \str_if_eq:VnF \l_@@_colour_tl { . } + { \color_select:n { scripture default colour } } + \bool_if:NTF \l_@@_inline_bool + { \l_@@_inline_begin_tl } { - \color_select:n { scripture default colour } - } -% \end{macrocode} -% For left and right margins, use \cs{parshape} is already in a list, -% otherwise use \cs{leftskip} and \cs{rightskip} -% \begin{macrocode} - \bool_lazy_or:nnT - { \dim_compare_p:n { \l_@@_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l_@@_rightmargin_tl > 0pt } } - { - \dim_sub:Nn \linewidth - { \l_@@_leftmargin_tl + \l_@@_rightmargin_tl } - \int_compare:nNnTF - \@listdepth > \c_zero_int - { - \dim_add:Nn \@totalleftmargin \l_@@_leftmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - { - \dim_add:Nn \leftskip \l_@@_leftmargin_tl - \dim_add:Nn \rightskip \l_@@_rightmargin_tl - } - } - \bool_if:NF \l_@@_indent_bool - { - \hook_gput_next_code:nn { para / begin } + \legacy_if:nTF { @newlist } + { \dim_set_eq:NN \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } + \list { } { - \bool_lazy_any:nT + \dim_set_eq:NN \leftmargin \l_@@_leftmargin_tl + \dim_set_eq:NN \rightmargin \l_@@_rightmargin_tl + \dim_set:Nn \itemindent { \l_@@_parindent_tl - \l_@@_outer_itemindent_dim } + \dim_set_eq:NN \listparindent \l_@@_parindent_tl + \skip_zero:N \partopsep + \skip_set_eq:NN \parsep \l_@@_parskip_tl + \dim_compare:nNnTF \parskip > \l_@@_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \l_@@_parindent_tl } + \bool_if:NF \l_@@_indent_bool { - { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } } - { \str_if_eq_p:Vn \l_@@_currenvir_str { narrow } } - { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } } + \hook_gput_next_code:nn { para / begin } + { + \bool_lazy_any:nT + { + { \str_if_eq_p:Vn \l_@@_currenvir_str { midparachap } } + { \str_if_eq_p:Vn \l_@@_currenvir_str { narrow } } + { \str_if_eq_p:Vn \l_@@_currenvir_str { scripture } } + } + { + \legacy_if:nTF { @noparlist } + { \noindent } + { \para_omit_indent: } + } + } } - { \para_omit_indent: } } - } - \bool_if:NT \l_@@_inline_bool - { \l_@@_inline_begin_tl } + \dim_set_eq:NN \parindent \l_@@_parindent_tl + \item + \relax + } } % \end{macrocode} % \end{macro} @@ -3291,105 +3426,67 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_end:n { - \tl_if_eq:NnTF \l_@@_ref_align_tl { inline } + \bool_if:NTF \l_@@_inline_bool { - \bool_lazy_or:nnF + \unskip + \@@_red_letter_off: + \l_@@_inline_end_tl + \bool_lazy_or:nnTF { \tl_if_novalue_p:n { #1 } } { \tl_if_empty_p:n { #1 } } { - \unskip - \@@_red_letter_off: - \bool_if:NT \l_@@_inline_bool - { \l_@@_inline_end_tl } + \tl_if_empty:NF \l_@@_version_tl + { + \skip_horizontal:N \l_@@_ref_sep_tl + \@@_format_full_ref:n { } + } + } + { \skip_horizontal:N \l_@@_ref_sep_tl \@@_format_full_ref:n { #1 } } } { + \@@_red_letter_off: + \skip_zero:N \parskip + \int_set:Nn \postdisplaypenalty { 10000 } + \@@_calc_final_line_length: + \dim_gsub:Nn \g_@@_final_line_dim \@totalleftmargin + \dim_compare:nNnTF \@outerparskip > \l_@@_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_belowskip_tl \@outerparskip } } % \end{macrocode} -% Normally \cs{unskip} does not work in vertical mode, but there are some -% situations where it does work. The following condition is true if the -% \env{scripture} environment has ended with one of its internal -% environments. This removes any unwanted \opt{belowskip} if present and -% leaves the previously calculated line length of the final paragraph intact. +% If a \env{scripture} quotation ends with an inner environment, remove the +% below skip of the inner environment. % \begin{macrocode} - \mode_if_vertical:TF - { - \unskip - \unskip - } - { - \tl_if_novalue:nTF { #1 } - { \int_zero:N \postdisplaypenalty } - { \int_set_eq:NN \postdisplaypenalty \@highpenalty } - \@@_calc_final_line_length: - } -% \end{macrocode} -% Restore left margin by resetting the \cs{parshape} if in a list -% based environment, otherwise the space required for the reference is -% incorrectly calculated. -% \begin{macrocode} - \bool_lazy_or:nnTF - { \dim_compare_p:n { \l_@@_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l_@@_rightmargin_tl > 0pt } } - { - \dim_add:Nn \linewidth \l_@@_leftmargin_tl - \int_compare:nNnT - \@listdepth > \c_zero_int - { - \dim_sub:Nn \@totalleftmargin \l_@@_leftmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - } - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } - \@@_red_letter_off: - \bool_lazy_or:nnF - { \tl_if_novalue_p:n { #1 } } - { \tl_if_empty_p:n { #1 } } - { \@@_reference:n { #1 } } - \par + \int_compare:nNnT \prevgraf = \c_zero_int + { \skip_vertical:n { -\g_@@_prev_inner_below_skip } } + \hook_gclear_next_code:n { para / before } + \parshape 1 ~ \@totalleftmargin ~ \linewidth + \noindent + \bool_lazy_or:nnTF + { \tl_if_novalue_p:n { #1 } } + { \tl_if_empty_p:n { #1 } } + { + \tl_if_empty:NTF \l_@@_version_tl + { \hbox:n { } } + { \@@_reference:n { } } + } + { \@@_reference:n { #1 } } % \end{macrocode} -% Restore right margin by resetting the \cs{parshape} if in a \LaTeX{} list -% based environment, since only the left margin was restored above. +% Set \val{@noparlist} to \val{false} to ensure \cs{topsep} is always added +% \env{scripture} environment % \begin{macrocode} - \bool_lazy_or:nnT - { \dim_compare_p:n { \l_@@_leftmargin_tl > 0pt } } - { \dim_compare_p:n { \l_@@_rightmargin_tl > 0pt } } - { - \int_compare:nNnT - \@listdepth > \c_zero_int - { - \dim_add:Nn \linewidth \l_@@_rightmargin_tl - \parshape 1 ~ \@totalleftmargin ~ \linewidth - } - } - \dim_compare:nNnTF - { \glueexpr \l_@@_belowskip_tl } > \parskip - { - \addvspace - { - \skip_eval:n { \l_@@_belowskip_tl - \parskip } - } - } - { - \addvspace { \l_@@_belowskip_tl } - } + \@noparlistfalse + \endlist } + \cs_set_eq:NN \noindent \@@_noindent_saved: } % \end{macrocode} % \end{macro} % % \subsection{Scripture internal environments} % -% \begin{macro}{\l_@@_delta_below_skip} -% Correction to \tn{@topsepadd} for internal environments. This enables a -% different \opt{aboveskip} and \opt{belowskip} which are normally the -% same for \LaTeX{} lists. -% \begin{macrocode} -\skip_new:N \l_@@_delta_below_skip -% \end{macrocode} -% \end{macro} -% % \subsubsection{The \env{center} environment} % % \begin{macro}{\@@_center_begin:n} @@ -3409,41 +3506,29 @@ { scripture / center } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_center_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_center_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_center_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_center_aboveskip_tl - } - \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g_@@_chap_par_prevgraf_int - } + \dim_zero:N \labelsep + \dim_set_eq:NN \leftmargin \l_@@_center_leftmargin_tl + \dim_set_eq:NN \rightmargin \l_@@_center_rightmargin_tl + \dim_set:Nn \itemindent { -\l_@@_outer_itemindent_dim } + \dim_zero:N \listparindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \leftmargin - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > \l_@@_center_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_center_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \c_zero_dim } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \centering \item \relax @@ -3456,9 +3541,12 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_center_end: { - \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth } + \dim_compare:nNnTF \@outerparskip > \l_@@_center_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_center_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -3483,43 +3571,29 @@ { scripture / flushright } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_flushright_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_flushright_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_flushright_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_flushright_aboveskip_tl - } - \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g_@@_chap_par_prevgraf_int - } + \dim_zero:N \labelsep \dim_set_eq:NN \leftmargin \l_@@_flushright_leftmargin_tl \dim_set_eq:NN \rightmargin \l_@@_flushright_rightmargin_tl + \dim_set:Nn \itemindent { -\l_@@_outer_itemindent_dim } + \dim_zero:N \listparindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \leftmargin - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > \l_@@_flushright_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_flushright_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \c_zero_dim } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \raggedleft \item \relax @@ -3532,9 +3606,12 @@ % \begin{macrocode} \cs_new_protected:Nn \@@_flushright_end: { - \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_gset:Nn \g_@@_final_line_dim { \@totalleftmargin + \linewidth } + \dim_compare:nNnTF \@outerparskip > \l_@@_flushright_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_flushright_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -3549,6 +3626,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_hanging_ch:n} +% Position a chapter in a \env{hanging} environment. +% \begin{macrocode} +\cs_new_protected:Nn \@@_hanging_ch:n + { + \bool_if:NTF \l_@@_chap_show_bool + { + \bool_if:NTF \l_@@_chap_drop_bool + { \@@_hanging_chap:n { #1 } } + { \@@_nodrop_chap:n { #1 } } + } + { \@@_nodrop_chap:n { #1 } } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_hanging_chap:n} % Position a drop chapter in a \env{hanging} environment. % \begin{macrocode} @@ -3587,17 +3680,15 @@ } ~ \@totalleftmargin ~ \linewidth } - \mode_if_vertical:T + \tl_set:Nx \l_@@_chap_sep_tl { - \tl_set:Nx \l_@@_chap_sep_tl + \dim_eval:n { - \dim_eval:n - { - \l_@@_chap_sep_tl + \l_@@_hanging_parindent_saved_dim - } + \l_@@_chap_sep_tl + \l_@@_hanging_parindent_saved_dim } - \@@_nohang: } + \par + \@@_nohang: \hbox_set:Nn \l_@@_chap_box { \box_move_down:nn @@ -3652,7 +3743,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Nn \@@_nohang: { - \para_raw_noindent: + \noindent \hbox_to_wd:nn { \l_@@_hanging_parindent_saved_dim } { } } % \end{macrocode} @@ -3675,58 +3766,33 @@ { scripture / hanging } { #1 } } - \mode_if_horizontal:T - { \par } + \DeclareDocumentCommand { \ch } { sm } { \@@_hanging_ch:n { ##2 } } + \cs_set_eq:NN \vs \@@_hanging_verse:n + \cs_set_eq:NN \nohang \@@_nohang: + \dim_set_eq:NN \l_@@_hanging_parindent_saved_dim \parindent + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_hanging_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool - { - \dim_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_hanging_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_hanging_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_hanging_aboveskip_tl - } - \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g_@@_chap_par_prevgraf_int - } - \dim_set:Nn \leftmargin - { \l_@@_hanging_leftmargin_tl + \l_@@_hanging_hang_tl } + \dim_zero:N \labelsep + \dim_set:Nn \leftmargin { \l_@@_hanging_leftmargin_tl + \l_@@_hanging_hang_tl } \dim_set_eq:NN \rightmargin \l_@@_hanging_rightmargin_tl - \dim_set:Nn \itemindent { -\l_@@_hanging_hang_tl } + \dim_set:Nn \itemindent { -\l_@@_hanging_hang_tl - \l_@@_outer_itemindent_dim } \dim_set:Nn \listparindent { -\l_@@_hanging_hang_tl } \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \labelsep - \dim_set_eq:NN \l_@@_hanging_parindent_saved_dim \parindent - } - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l_@@_chap_show_bool - { - \bool_if:NTF \l_@@_chap_drop_bool - { \@@_hanging_chap:n { ##2 } } - { \@@_nodrop_chap:n { ##2 } } - } - { \@@_nodrop_chap:n { ##2 } } + \dim_compare:nNnTF \parskip > \l_@@_hanging_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_hanging_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { -\l_@@_hanging_hang_tl } } - \cs_set_eq:NN \vs \@@_hanging_verse:n - \cs_set_eq:NN \nohang \@@_nohang: + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \item \relax } @@ -3739,8 +3805,11 @@ \cs_new_protected:Nn \@@_hanging_end: { \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > \l_@@_hanging_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_hanging_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -3782,6 +3851,14 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\l_@@_mid_para_chap_totalleftmargin_dim} +% Save the \cs{@totalleftmargin} before starting a \env{midparachap} +% environment. +% \begin{macrocode} +\dim_new:N \l_@@_mid_para_chap_totalleftmargin_dim +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\g_@@_mid_para_chap_prevgraf_int} % Store the \cs{prevgraf} of the final paragraph in a \env{midparachap} % environment. @@ -3888,6 +3965,11 @@ \par \bool_set_true:N \l_@@_mid_para_chap_bool \@@_vbox_set_top:Nw \l_@@_mid_para_chap_box + \dim_zero:N \leftskip + \dim_zero:N \rightskip + \dim_set_eq:NN \l_@@_mid_para_chap_totalleftmargin_dim \@totalleftmargin + \dim_zero:N \@totalleftmargin + \dim_set_eq:NN \hsize \linewidth \skip_zero:N \parskip } % \end{macrocode} @@ -3899,7 +3981,6 @@ \cs_new_protected:Nn \@@_mid_para_chap_end: { \par - \int_gset_eq:NN \g_@@_mid_para_chap_prevgraf_int \prevgraf \dim_gset_eq:NN \g_@@_mid_para_chap_prevdepth_dim \prevdepth \box_set_to_last:N \l_@@_mid_para_chap_line_box \hbox_set:Nn \l_@@_mid_para_chap_snap_box @@ -3909,7 +3990,8 @@ \unskip \unpenalty } - \dim_gset:Nn \g_@@_final_line_dim { \box_wd:N \l_@@_mid_para_chap_snap_box } + \dim_gset:Nn \g_@@_final_line_dim + { \box_wd:N \l_@@_mid_para_chap_snap_box + \l_@@_mid_para_chap_totalleftmargin_dim } \box_clear:N \l_@@_mid_para_chap_snap_box \nointerlineskip \int_compare:nNnT @@ -3961,9 +4043,7 @@ \hook_gput_next_code:nn { para / before } { \int_gzero:N \g_@@_chap_par_prevgraf_int - \int_compare:nNnT - \@listdepth > \c_zero_int - { \parshape 1 ~ \@totalleftmargin ~ \linewidth } + \parshape 1 ~ \@totalleftmargin ~ \linewidth } } % \end{macrocode} @@ -3988,44 +4068,39 @@ { scripture / narrow } { #1 } } - \mode_if_horizontal:T - { \par } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_narrow_belowskip_tl % \end{macrocode} % Ignore \opt{aboveskip} if at the beginning of a \env{scripture} environment. % \begin{macrocode} - \bool_if:NTF \g_@@_start_bool + %\int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + % { \addvspace { \baselineskip } } + %\int_gzero:N \g_@@_chap_par_prevgraf_int + \dim_zero:N \labelsep + \dim_set_eq:NN \leftmargin \l_@@_narrow_leftmargin_tl + \dim_set_eq:NN \rightmargin \l_@@_narrow_rightmargin_tl + \dim_set_eq:NN \listparindent \parindent + \mode_if_vertical:TF { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool + \dim_set:Nn \itemindent { \parindent - \l_@@_outer_itemindent_dim } + \@@_setup_list_noindent:n { \parindent } } { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_narrow_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_narrow_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_narrow_aboveskip_tl - } - \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g_@@_chap_par_prevgraf_int + \dim_set:Nn \itemindent { -\l_@@_outer_itemindent_dim } + \@@_setup_list_noindent:n { \c_zero_dim } } - \dim_set_eq:NN \leftmargin \l_@@_narrow_leftmargin_tl - \dim_set_eq:NN \rightmargin \l_@@_narrow_rightmargin_tl - \dim_set_eq:NN \listparindent \parindent - \dim_set_eq:NN \itemindent \parindent \skip_set_eq:NN \parsep \parskip \skip_zero:N \partopsep - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > \l_@@_narrow_aboveskip_tl + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_narrow_aboveskip_tl \parskip } } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \item \relax } @@ -4038,8 +4113,11 @@ \cs_new_protected:Nn \@@_narrow_end: { \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > \l_@@_narrow_belowskip_tl + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_narrow_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist } % \end{macrocode} @@ -4153,9 +4231,25 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_poetry_chap:n} +% \begin{macro}{\@@_poetry_ch:n} % Position a chapter in a \env{poetry} environment. % \begin{macrocode} +\cs_new_protected:Nn \@@_poetry_ch:n + { + \bool_if:NTF \l_@@_chap_show_bool + { + \bool_if:NTF \l_@@_chap_drop_bool + { \@@_poetry_chap:n { #1 } } + { \@@_poetry_nodrop_chap:n { #1 } } + } + { \@@_poetry_nodrop_chap:n { #1 } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_poetry_chap:n} +% Position a drop chapter in a \env{poetry} environment. +% \begin{macrocode} \cs_new_protected:Nn \@@_poetry_chap:n { \@@_drop_chap_set_up:n { #1 } @@ -4437,62 +4531,35 @@ } \bool_set_true:N \l_@@_active_inner_bool \tl_set:Nn \l_@@_currenvir_str { poetry } - \mode_if_horizontal:T - { \par } + \bool_gset_false:N \g_@@_poetry_midparachap_show_verse_bool + \DeclareDocumentCommand { \ch } { sm } { \@@_poetry_ch:n { ##2 } } + \cs_set_eq:NN \vs \@@_poetry_mode_vertical_verse:n + \cs_set_eq:NN \extraskip \@@_poetry_extra_skip: + \cs_set_eq:NN \selah \@@_selah_output: + \cs_set_protected_nopar:Npn \textright ##1 + { \@@_poetry_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } } + \legacy_if:nTF { @newlist } + { \dim_add:Nn \l_@@_outer_itemindent_dim \itemindent } + { \dim_zero:N \l_@@_outer_itemindent_dim } \list { } { - \skip_set_eq:NN \l_@@_delta_below_skip \l_@@_poetry_belowskip_tl - \bool_if:NTF \g_@@_start_bool - { - \skip_zero:N \topsep - \skip_sub:Nn \topsep \parskip - \skip_add:Nn \l_@@_delta_below_skip \parskip - \bool_gset_false:N \g_@@_start_bool - } - { - \dim_compare:nTF - { \parskip >= \glueexpr \l_@@_poetry_aboveskip_tl > \c_zero_skip } - { - \skip_zero:N \topsep - \skip_zero:N \l_@@_delta_below_skip - } - { - \skip_set_eq:NN \topsep \l_@@_poetry_aboveskip_tl - \skip_sub:Nn \l_@@_delta_below_skip \l_@@_poetry_aboveskip_tl - } - \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 - { \addvspace { \baselineskip } } - \int_gzero:N \g_@@_chap_par_prevgraf_int - } + \dim_zero:N \labelsep \dim_set_eq:NN \leftmargin \l_@@_poetry_leftmargin_tl \dim_set_eq:NN \rightmargin \l_@@_poetry_rightmargin_tl - \dim_set_eq:NN \itemindent \l_@@_poetry_indent_tl + \dim_set:Nn \itemindent { \l_@@_poetry_indent_tl - \l_@@_outer_itemindent_dim } \dim_set_eq:NN \listparindent \l_@@_poetry_indent_tl \skip_zero:N \parsep \skip_zero:N \partopsep - \dim_zero:N \labelsep + \dim_compare:nNnTF \parskip > { \l_@@_poetry_aboveskip_tl } + { \skip_zero:N \topsep } + { \skip_set:Nn \topsep { \@@_skip_diff:NN \l_@@_poetry_aboveskip_tl \parskip } } + \@@_setup_list_noindent:n { \l_@@_poetry_indent_tl } } + \int_compare:nNnT \g_@@_chap_par_prevgraf_int = 1 + { \addvspace { \baselineskip } } + \int_gzero:N \g_@@_chap_par_prevgraf_int \raggedright - \dim_set_eq:NN \listparindent \l_@@_poetry_indent_tl \dim_set_eq:NN \parindent \l_@@_poetry_indent_tl - \bool_gset_false:N \g_@@_poetry_midparachap_show_verse_bool - \DeclareDocumentCommand { \ch } { sm } - { - \bool_if:NTF \l_@@_chap_show_bool - { - \bool_if:NTF \l_@@_chap_drop_bool - { \@@_poetry_chap:n { ##2 } } - { \@@_poetry_nodrop_chap:n { ##2 } } - } - { \@@_poetry_nodrop_chap:n { ##2 } } - } - \cs_set_eq:NN \vs \@@_poetry_mode_vertical_verse:n - \cs_set_eq:NN \extraskip \@@_poetry_extra_skip: - \cs_set_eq:NN \selah \@@_selah_output: - \cs_set_protected_nopar:Npn \textright ##1 - { - \@@_poetry_text_right:nn { \l_@@_text_right_sep_tl } { ##1 } - } \item \relax \cs_set_eq:NN \@@_tmp_para_end: \par @@ -4509,8 +4576,11 @@ \cs_new_protected:Nn \@@_poetry_end: { \@@_calc_final_line_length: - \skip_add:Nn \@topsepadd \l_@@_delta_below_skip - \int_set_eq:NN \@endparpenalty \@lowpenalty + \dim_compare:nNnTF \@outerparskip > { \l_@@_poetry_belowskip_tl } + { \skip_zero:N \@topsepadd } + { \skip_set:Nn \@topsepadd { \@@_skip_diff:NN \l_@@_poetry_belowskip_tl \@outerparskip } } + \skip_gset_eq:NN \g_@@_prev_inner_below_skip \@topsepadd + \legacy_if_set_false:n { @noparlist } \endlist \bool_gset_true:N \g_@@_poetry_end_bool \hook_gput_next_code:nn { para / begin } @@ -4544,6 +4614,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\scripturestyle} +% \begin{arguments} +% \item \meta{|name|} of the style. +% \item \meta{|options|} to set for the style. +% \end{arguments} +% Set key-value settings to be applied when using the \opt{style} option +% with value \val{name}. The starred version appends the \val{options} to +% any existing ones. +% \begin{macrocode} +\NewDocumentCommand { \scripturestyle } { s m m } + { + \@@_setup_style:nnn { #1 } { #2 } { #3 } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\textscripture} % \begin{arguments} % \item \meta{|reference|} of quotation. @@ -4553,7 +4639,7 @@ % Set an inline quotation. This is equivalent to calling the % \env{scripture} environment with the \opt{inline} option set. % \begin{macrocode} -\NewDocumentCommand { \textscripture } { oo+m } +\NewDocumentCommand { \textscripture } { o o +m } { \tl_if_novalue:nTF { #2 } { @@ -4575,7 +4661,7 @@ % \end{arguments} % Format a scripture quotation with optional reference. % \begin{macrocode} -\NewDocumentEnvironment { scripture } { oo } +\NewDocumentEnvironment { scripture } { o o } { \@@_begin:n { #2 } % \end{macrocode} @@ -4676,6 +4762,11 @@ \tl_set:Nn \l_@@_belowskip_tl { 0pt } \tl_set:Nn \l_@@_leftmargin_tl { 0pt } \tl_set:Nn \l_@@_rightmargin_tl { 0pt } + \cs_set_eq:NN \@@_ref_format:n \@@_inline_ref_format:n + \tl_set_eq:NN \l_@@_ref_sep_tl \l_@@_inline_ref_sep_tl + \cs_set_eq:NN \@@_version_format:n \@@_inline_version_format:n + \tl_set_eq:NN \l_@@_version_delim_tl \l_@@_inline_version_delim_tl + \bool_set_true:N \l_@@_compact_bool } \bool_if:NT \l_@@_compact_bool { @@ -4707,11 +4798,7 @@ } \mode_leave_vertical: } - \peek_remove_spaces:n - { - \peek_meaning:NF \begin - { \bool_gset_false:N \g_@@_start_bool } - } + \ignorespaces } { \bool_if:NT \l_@@_compact_bool diff --git a/macros/latex/contrib/scripture/scripture.pdf b/macros/latex/contrib/scripture/scripture.pdf index 6d1f35df3c..4dbb9323b1 100644 Binary files a/macros/latex/contrib/scripture/scripture.pdf and b/macros/latex/contrib/scripture/scripture.pdf differ -- cgit v1.2.3