summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-07-27 20:10:16 +0000
committerKarl Berry <karl@freefriends.org>2022-07-27 20:10:16 +0000
commitdda130579c74ef7448f5e5e08bda19eec4cb6e6f (patch)
treed1a04e512d0738158026598d6e4ae355a0b6b5f4 /Master/texmf-dist/tex/latex
parent886393078c2df85ede646a53827872d7db9f0256 (diff)
scripture (27jul22)
git-svn-id: svn://tug.org/texlive/trunk@63988 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/scripture/scripture.sty1090
1 files changed, 1090 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/scripture/scripture.sty b/Master/texmf-dist/tex/latex/scripture/scripture.sty
new file mode 100644
index 00000000000..b5d5a2a799b
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/scripture/scripture.sty
@@ -0,0 +1,1090 @@
+%%
+%% This is file `scripture.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% scripture.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (c) 2022 David Purton <dcpurton@marshwiggle.net>
+%%
+%% This work may be distributed and/or modified under the conditions of
+%% the LaTeX Project2 Public License, either version 1.3c of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work is "maintained" (as per the LPPL maintenance status)
+%% by David Purton.
+%%
+%% This work consists of the files scripture.ins, scripture.dtx, README.md,
+%% and the derived files scripture.sty and scripture.pdf
+%%
+\NeedsTeXFormat{LaTeX2e}[2021-11-15]
+\ProvidesExplPackage{scripture}{2022/07/27}{1.0}
+ {Format Scripture Quotations (DCP)}
+\RequirePackage{l3keys2e}
+\msg_new:nnnn { scripture } { nested-environment }
+ { Nesting~of~scripture~environments~not~supported. }
+ { You~have~tried~to~nest~a~scripture~environment~or \\
+ one~of~its~internal~environments,~which~is~not~supported. }
+\keys_define:nn { scripture }
+ {
+ , aboveskip .tl_set:N = \l__scripture_aboveskip_tl
+ , aboveskip .value_required:n = true
+ , aboveskip .initial:n = \c_zero_skip
+ , belowskip .tl_set:N = \l__scripture_belowskip_tl
+ , belowskip .value_required:n = true
+ , belowskip .initial:n = \c_zero_skip
+ , leftmargin .tl_set:N = \l__scripture_leftmargin_tl
+ , leftmargin .value_required:n = true
+ , leftmargin .initial:n = \c_zero_dim
+ , rightmargin .tl_set:N = \l__scripture_rightmargin_tl
+ , rightmargin .value_required:n = true
+ , rightmargin .initial:n = \c_zero_dim
+ , chapter / font .tl_set:N = \l__scripture_chap_font_tl
+ , chapter / font .value_required:n = true
+ , chapter / font .initial:n = \bfseries
+ , chapter / drop .bool_set:N = \l__scripture_chap_drop_bool
+ , chapter / drop .default:n = true
+ , chapter / drop .initial:n = true
+ , chapter / nodrop .bool_set_inverse:N = \l__scripture_chap_drop_bool
+ , chapter / nodrop .default:n = true
+ , chapter / sep .tl_set:N = \l__scripture_chap_sep_tl
+ , chapter / sep .value_required:n = true
+ , chapter / sep .initial:n = 0.5 em
+ , extraskip .tl_set:N = \l__scripture_extraskip_tl
+ , extraskip .value_required:n = true
+ , extraskip .initial:n = \medskipamount
+ , font .tl_set:N = \l__scripture_font_tl
+ , font .value_required:n = true
+ , font .initial:n =
+ , indent .bool_set:N = \l__scripture_indent_bool
+ , indent .default:n = true
+ , indent .initial:n = true
+ , noindent .bool_set_inverse:N = \l__scripture_indent_bool
+ , noindent .default:n = true
+ , parindent .tl_set:N = \l__scripture_parindent_tl
+ , parindent .value_required:n = true
+ , parindent .initial:n = \parindent
+ , parskip .tl_set:N = \l__scripture_parskip_tl
+ , parskip .value_required:n = true
+ , parskip .initial:n = \parskip
+ , reference / delim .tl_set:N = \l__scripture_ref_delim_tl
+ , reference / delim .value_required:n = true
+ , reference / delim .initial:n = \hfill
+ , reference / font .tl_set:N = \l__scripture_ref_font_tl
+ , reference / font .value_required:n = true
+ , reference / font .initial:n = \bfseries
+ , reference / format .cs_set:Np = \__scripture_ref_format:n #1
+ , reference / format .value_required:n = true
+ , reference / format .initial:n = #1
+ , reference / sep .tl_set:N = \l__scripture_ref_sep_tl
+ , reference / sep .value_required:n = true
+ , reference / sep .initial:n = 2 em
+ , verse / font .tl_set:N = \l__scripture_verse_font_tl
+ , verse / font .value_required:n = true
+ , verse / font .initial:n =
+ , verse / format .cs_set:Np = \__scripture_verse_format:n #1
+ , verse / format .value_required:n = true
+ , verse / format .initial:n = \textsuperscript{#1}
+ , version .tl_set:N = \l__scripture_version_tl
+ , version .value_required:n = true
+ , version .initial:n =
+ , version / delim .tl_set:N = \l__scripture_version_delim_tl
+ , version / delim .value_required:n = true
+ , version / delim .initial:n = \c_space_tl
+ , version / format .cs_set:Np = \__scripture_version_format:n #1
+ , version / format .value_required:n = true
+ , version / format .initial:n = (#1)
+ , center / aboveskip .tl_set:N = \l__scripture_center_aboveskip_tl
+ , center / aboveskip .value_required:n = true
+ , center / aboveskip .initial:n = \medskipamount
+ , center / belowskip .tl_set:N = \l__scripture_center_belowskip_tl
+ , center / belowskip .value_required:n = true
+ , center / belowskip .initial:n = \medskipamount
+ , center / leftmargin .tl_set:N = \l__scripture_center_leftmargin_tl
+ , center / leftmargin .value_required:n = true
+ , center / leftmargin .initial:n = \c_zero_dim
+ , center / rightmargin .tl_set:N = \l__scripture_center_rightmargin_tl
+ , center / rightmargin .value_required:n = true
+ , center / rightmargin .initial:n = \c_zero_dim
+ , flushright / aboveskip .tl_set:N = \l__scripture_flushright_aboveskip_tl
+ , flushright / aboveskip .value_required:n = true
+ , flushright / aboveskip .initial:n = \medskipamount
+ , flushright / belowskip .tl_set:N = \l__scripture_flushright_belowskip_tl
+ , flushright / belowskip .value_required:n = true
+ , flushright / belowskip .initial:n = \medskipamount
+ , flushright / leftmargin .tl_set:N = \l__scripture_flushright_leftmargin_tl
+ , flushright / leftmargin .value_required:n = true
+ , flushright / leftmargin .initial:n = \c_zero_dim
+ , flushright / rightmargin .tl_set:N = \l__scripture_flushright_rightmargin_tl
+ , flushright / rightmargin .value_required:n = true
+ , flushright / rightmargin .initial:n = \c_zero_dim
+ , hanging / aboveskip .tl_set:N = \l__scripture_hanging_aboveskip_tl
+ , hanging / aboveskip .value_required:n = true
+ , hanging / aboveskip .initial:n = \medskipamount
+ , hanging / belowskip .tl_set:N = \l__scripture_hanging_belowskip_tl
+ , hanging / belowskip .value_required:n = true
+ , hanging / belowskip .initial:n = \medskipamount
+ , hanging / hang .tl_set:N = \l__scripture_hanging_hang_tl
+ , hanging / hang .value_required:n = true
+ , hanging / hang .initial:n = 2 em
+ , hanging / leftmargin .tl_set:N = \l__scripture_hanging_leftmargin_tl
+ , hanging / leftmargin .value_required:n = true
+ , hanging / leftmargin .initial:n = 1 em
+ , hanging / rightmargin .tl_set:N = \l__scripture_hanging_rightmargin_tl
+ , hanging / rightmargin .value_required:n = true
+ , hanging / rightmargin .initial:n = \c_zero_dim
+ , narrow / aboveskip .tl_set:N = \l__scripture_narrow_aboveskip_tl
+ , narrow / aboveskip .value_required:n = true
+ , narrow / aboveskip .initial:n = \medskipamount
+ , narrow / belowskip .tl_set:N = \l__scripture_narrow_belowskip_tl
+ , narrow / belowskip .value_required:n = true
+ , narrow / belowskip .initial:n = \medskipamount
+ , narrow / leftmargin .tl_set:N = \l__scripture_narrow_leftmargin_tl
+ , narrow / leftmargin .value_required:n = true
+ , narrow / leftmargin .initial:n = 1 em
+ , narrow / rightmargin .tl_set:N = \l__scripture_narrow_rightmargin_tl
+ , narrow / rightmargin .value_required:n = true
+ , narrow / rightmargin .initial:n = 1 em
+ , poetry / aboveskip .tl_set:N = \l__scripture_poetry_aboveskip_tl
+ , poetry / aboveskip .value_required:n = true
+ , poetry / aboveskip .initial:n = \medskipamount
+ , poetry / belowskip .tl_set:N = \l__scripture_poetry_belowskip_tl
+ , poetry / belowskip .value_required:n = true
+ , poetry / belowskip .initial:n = \medskipamount
+ , poetry / bigindent .tl_set:N = \l__scripture_poetry_big_indent_tl
+ , poetry / bigindent .value_required:n = true
+ , poetry / bigindent .initial:n = 4 em
+ , poetry / indent .tl_set:N = \l__scripture_poetry_indent_tl
+ , poetry / indent .value_required:n = true
+ , poetry / indent .initial:n = 1 em
+ , poetry / leftmargin .tl_set:N = \l__scripture_poetry_leftmargin_tl
+ , poetry / leftmargin .value_required:n = true
+ , poetry / leftmargin .initial:n = 1 em
+ , poetry / rightmargin .tl_set:N = \l__scripture_poetry_rightmargin_tl
+ , poetry / rightmargin .value_required:n = true
+ , poetry / rightmargin .initial:n = \c_zero_dim
+ }
+\ProcessKeysOptions { scripture }
+\bool_new:N \l__scripture_active_bool
+\bool_new:N \l__scripture_active_inner_bool
+\cs_new_protected:Nn \__scripture_extra_skip:
+ {
+ \int_compare:nNnT
+ \l__scripture_chap_par_prevgraf_int = 1
+ {
+ \dim_compare:nNnT
+ { \parskip + \l__scripture_extraskip_tl } < \baselineskip
+ {
+ \addvspace { \baselineskip }
+ }
+ \int_zero:N \l__scripture_chap_par_prevgraf_int
+ }
+ \addvspace { \l__scripture_extraskip_tl }
+ }
+\cs_new_protected:Nn \__scripture_format_full_ref:n
+ {
+ \group_begin:
+ \l__scripture_ref_font_tl
+ \__scripture_ref_format:n { #1 }
+ \tl_if_empty:NF \l__scripture_version_tl
+ {
+ \l__scripture_version_delim_tl
+ \__scripture_version_format:n { \l__scripture_version_tl }
+ }
+ \group_end:
+ }
+\cs_new_protected:Nn \__scripture_reference:n
+ {
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \skip_horizontal:N \l__scripture_ref_sep_tl
+ \__scripture_format_full_ref:n { #1 }
+ }
+ \bool_if:NT \g__scripture_poetry_end_bool
+ { \skip_vertical:n { -\parskip } }
+ \dim_compare:nNnT
+ { \box_wd:N \l_tmpa_box + \g__scripture_final_line_dim }
+ >
+ { \linewidth - \@totalleftmargin }
+ { \skip_vertical:N \baselineskip }
+ \int_compare:nNnT \prevgraf = \c_zero_int
+ { \skip_vertical:n { -\baselineskip } }
+ \l__scripture_ref_delim_tl
+ \box_use:N \l_tmpa_box
+ }
+\dim_new:N \l__scripture_chap_fontsize_dim
+\dim_new:N \l__scripture_chap_height_dim
+\dim_new:N \l__scripture_chap_width_dim
+\int_new:N \l__scripture_chap_par_prevgraf_int
+\dim_new:N \l__scripture_chap_X_height_dim
+\cs_new_protected:Nn \__scripture_drop_chap_set_up:n
+ {
+ \hbox_set:Nn \l_tmpa_box { X }
+ \dim_set:Nn \l__scripture_chap_X_height_dim
+ { \box_ht:N \l_tmpa_box }
+ \dim_set:Nn \l__scripture_chap_height_dim
+ { \baselineskip + \l__scripture_chap_X_height_dim }
+ \dim_set:Nn \l__scripture_chap_fontsize_dim
+ {
+ \f@size pt *
+ \dim_ratio:nn
+ { \l__scripture_chap_height_dim }
+ { \l__scripture_chap_X_height_dim }
+ }
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \l__scripture_chap_font_tl
+ \fontsize
+ { \l__scripture_chap_fontsize_dim }
+ { \l__scripture_chap_fontsize_dim }
+ \selectfont
+ #1
+ }
+ \dim_set:Nn \l__scripture_chap_width_dim
+ { \box_wd:N \l_tmpa_box }
+ }
+\cs_new_protected:Nn \__scripture_drop_chap_output:
+ {
+ \noindent
+ \parshape 3 ~
+ \dim_eval:n
+ { \@totalleftmargin + \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl } ~
+ \dim_eval:n
+ { \linewidth - \l__scripture_chap_width_dim - \l__scripture_chap_sep_tl } ~
+ \dim_eval:n
+ { \@totalleftmargin + \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl } ~
+ \dim_eval:n
+ { \linewidth - \l__scripture_chap_width_dim - \l__scripture_chap_sep_tl } ~
+ \@totalleftmargin ~
+ \linewidth
+ \box_use:N \l_tmpb_box
+ }
+\cs_new_protected:Nn \__scripture_nodrop_chap:n
+ {
+ \group_begin:
+ \l__scripture_chap_font_tl
+ #1
+ \group_end:
+ \skip_horizontal:N \l__scripture_chap_sep_tl
+ }
+\cs_new_protected:Nn \__scripture_chap:n
+ {
+ \__scripture_drop_chap_set_up:n { #1 }
+ \hbox_set:Nn \l_tmpb_box
+ {
+ \box_move_down:nn
+ { \baselineskip }
+ {
+ \hbox_overlap_left:n
+ {
+ \box_use:N \l_tmpa_box
+ \skip_horizontal:N \l__scripture_chap_sep_tl
+ }
+ }
+ }
+ \box_set_ht:Nn \l_tmpb_box { \c_zero_dim }
+ \box_set_dp:Nn \l_tmpb_box { \c_zero_dim }
+ \bool_if:NTF \l__scripture_mid_para_chap_bool
+ { \__scripture_mid_para_drop_chap_output: }
+ {
+ \par
+ \__scripture_drop_chap_output:
+ }
+ \hook_gput_next_code:nn { para / after }
+ { \int_set_eq:NN \l__scripture_chap_par_prevgraf_int \prevgraf }
+ \hook_gput_next_code:nn { para / before }
+ {
+ \int_zero:N \l__scripture_chap_par_prevgraf_int
+ \int_compare:nNnT
+ \@listdepth > \c_zero_int
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ }
+ }
+\cs_new_protected:Nn \__scripture_verse_output:n
+ {
+ \mode_if_vertical:T
+ { \mode_leave_vertical: }
+ \group_begin:
+ \l__scripture_verse_font_tl
+ \__scripture_verse_format:n { #1 }
+ \group_end:
+ }
+\dim_new:N \g__scripture_final_line_dim
+\cs_new_protected:Nn \__scripture_calc_final_line_length:
+ {
+ \skip_set:Nn \abovedisplayshortskip { -\baselineskip }
+ \skip_set_eq:NN \abovedisplayskip \abovedisplayshortskip
+ \skip_zero:N \belowdisplayshortskip
+ \skip_zero:N \belowdisplayskip
+ $$
+ \dim_compare:nNnT \predisplaysize > \c_zero_dim
+ {
+ \dim_gset:Nn \g__scripture_final_line_dim
+ { \predisplaysize - 2 em }
+ }
+ \cs_gset_nopar:Nx \__scripture_reset_spacing:
+ {
+ \dim_set:Nn \predisplaysize { \dim_use:N \predisplaysize }
+ \int_set:Nn \prevgraf { \int_use:N \prevgraf }
+ }
+ $$
+ \__scripture_reset_spacing:
+ \dim_compare:nNnT \g__scripture_final_line_dim > \linewidth
+ {
+ \dim_gset_eq:NN \g__scripture_final_line_dim \linewidth
+ }
+ \dim_compare:nNnT \g__scripture_final_line_dim > { \c_zero_dim - 1 sp }
+ {
+ \skip_vertical:n { -\baselineskip - \parskip }
+ }
+ }
+\bool_new:N \g__scripture_start_bool
+\cs_new_protected:Nn \__scripture_begin:n
+ {
+ \bool_if:NT \l__scripture_active_bool
+ {
+ \msg_error:nn { scripture } { nested-environment }
+ }
+ \bool_set_true:N \l__scripture_active_bool
+ \tl_if_novalue:nF { #1 }
+ {
+ \keys_set:nn { scripture } { #1 }
+ }
+ \legacy_if:nT { @newlist }
+ {
+ \strut
+ \par
+ \vspace* { \dim_eval:n { -\baselineskip - \parskip } }
+ }
+ \mode_if_vertical:T
+ {
+ \addvspace { \l__scripture_aboveskip_tl }
+ }
+ \DeclareDocumentCommand { \ch } { sm }
+ {
+ \bool_if:NTF \l__scripture_chap_drop_bool
+ {
+ \__scripture_chap:n { ##2 }
+ \bool_if:nT { ##1 }
+ {
+ \hook_gput_next_code:nn { para / after }
+ { \int_zero:N \l__scripture_chap_par_prevgraf_int }
+ }
+ }
+ { \__scripture_nodrop_chap:n { ##2 } }
+ }
+ \bool_gset_true:N \g__scripture_start_bool
+ \bool_gset_false:N \g__scripture_poetry_end_bool
+ \dim_set_eq:NN \parindent \l__scripture_parindent_tl
+ \cs_set_eq:NN \extraskip \__scripture_extra_skip:
+ \cs_set_eq:NN \vs \__scripture_verse_output:n
+ \hook_gclear_next_code:n { para / before }
+ \hook_gput_next_code:nn { para / end }
+ { \skip_set_eq:NN \parskip \l__scripture_parskip_tl }
+ \hook_gput_next_code:nn { para / after }
+ { \bool_gset_false:N \g__scripture_start_bool }
+ \l__scripture_font_tl
+ \bool_lazy_or:nnT
+ { \dim_compare_p:n { \l__scripture_leftmargin_tl > 0pt } }
+ { \dim_compare_p:n { \l__scripture_rightmargin_tl > 0pt } }
+ {
+ \dim_sub:Nn \linewidth
+ { \l__scripture_leftmargin_tl + \l__scripture_rightmargin_tl }
+ \int_compare:nNnTF
+ \@listdepth > \c_zero_int
+ {
+ \dim_add:Nn \@totalleftmargin \l__scripture_leftmargin_tl
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ }
+ {
+ \dim_add:Nn \leftskip \l__scripture_leftmargin_tl
+ \dim_add:Nn \rightskip \l__scripture_rightmargin_tl
+ }
+ }
+ \bool_if:NF \l__scripture_indent_bool
+ { \noindent }
+ }
+\cs_new_protected:Nn \__scripture_end:n
+ {
+ \mode_if_vertical:TF
+ {
+ \unskip
+ \unskip
+ }
+ { \__scripture_calc_final_line_length: }
+ \bool_lazy_or:nnT
+ { \dim_compare_p:n { \l__scripture_leftmargin_tl > 0pt } }
+ { \dim_compare_p:n { \l__scripture_rightmargin_tl > 0pt } }
+ {
+ \dim_add:Nn \linewidth \l__scripture_leftmargin_tl
+ \int_compare:nNnT
+ \@listdepth > \c_zero_int
+ {
+ \dim_sub:Nn \@totalleftmargin \l__scripture_leftmargin_tl
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ }
+ }
+ \tl_if_novalue:nF { #1 }
+ {
+ \__scripture_reference:n { #1 }
+ }
+ \par
+ \bool_lazy_or:nnT
+ { \dim_compare_p:n { \l__scripture_leftmargin_tl > 0pt } }
+ { \dim_compare_p:n { \l__scripture_rightmargin_tl > 0pt } }
+ {
+ \int_compare:nNnT
+ \@listdepth > \c_zero_int
+ {
+ \dim_add:Nn \linewidth \l__scripture_rightmargin_tl
+ \parshape 1 ~ \@totalleftmargin ~ \linewidth
+ }
+ }
+ \dim_compare:nNnTF
+ \l__scripture_belowskip_tl > \parskip
+ {
+ \addvspace
+ {
+ \skip_eval:n { \l__scripture_belowskip_tl - \parskip }
+ }
+ }
+ {
+ \addvspace { \l__scripture_belowskip_tl }
+ }
+ }
+\skip_new:N \l__scripture_delta_below_skip
+\cs_new_protected:Nn \__scripture_center_begin:n
+ {
+ \bool_if:NT \l__scripture_active_inner_bool
+ {
+ \msg_error:nn { scripture } { nested-environment }
+ }
+ \bool_set_true:N \l__scripture_active_inner_bool
+ \tl_if_novalue:nF { #1 }
+ {
+ \keys_set:nn
+ { scripture / center }
+ { #1 }
+ }
+ \par
+ \list { }
+ {
+ \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_center_belowskip_tl
+ \bool_if:NTF \g__scripture_start_bool
+ { \skip_zero:N \topsep }
+ {
+ \dim_compare:nTF
+ { \parskip >= \l__scripture_center_aboveskip_tl > \c_zero_skip }
+ {
+ \skip_zero:N \topsep
+ \skip_zero:N \l__scripture_delta_below_skip
+ }
+ {
+ \skip_set_eq:NN \topsep \l__scripture_center_aboveskip_tl
+ \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_center_aboveskip_tl
+ }
+ }
+ \skip_set_eq:NN \parsep \parskip
+ \skip_zero:N \partopsep
+ \dim_zero:N \leftmargin
+ \dim_zero:N \labelsep
+ }
+ \centering
+ \item
+ \relax
+ }
+\cs_new_protected:Nn \__scripture_center_end:
+ {
+ \__scripture_calc_final_line_length:
+ \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip
+ \endlist
+ }
+\cs_new_protected:Nn \__scripture_flushright_begin:n
+ {
+ \bool_if:NT \l__scripture_active_inner_bool
+ {
+ \msg_error:nn { scripture } { nested-environment }
+ }
+ \bool_set_true:N \l__scripture_active_inner_bool
+ \tl_if_novalue:nF { #1 }
+ {
+ \keys_set:nn
+ { scripture / flushright }
+ { #1 }
+ }
+ \par
+ \list { }
+ {
+ \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_flushright_belowskip_tl
+ \bool_if:NTF \g__scripture_start_bool
+ { \skip_zero:N \topsep }
+ {
+ \dim_compare:nTF
+ { \parskip >= \l__scripture_flushright_aboveskip_tl > \c_zero_skip }
+ {
+ \skip_zero:N \topsep
+ \skip_zero:N \l__scripture_delta_below_skip
+ }
+ {
+ \skip_set_eq:NN \topsep \l__scripture_flushright_aboveskip_tl
+ \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_flushright_aboveskip_tl
+ }
+ }
+ \dim_set_eq:NN \leftmargin \l__scripture_flushright_leftmargin_tl
+ \dim_set_eq:NN \rightmargin \l__scripture_flushright_rightmargin_tl
+ \skip_set_eq:NN \parsep \parskip
+ \skip_zero:N \partopsep
+ \dim_zero:N \leftmargin
+ \dim_zero:N \labelsep
+ }
+ \raggedleft
+ \item
+ \relax
+ }
+\cs_new_protected:Nn \__scripture_flushright_end:
+ {
+ \__scripture_calc_final_line_length:
+ \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip
+ \endlist
+ }
+\dim_new:N \l__scripture_hanging_parindent_saved_dim
+\cs_new_protected:Nn \__scripture_hanging_chap:n
+ {
+ \__scripture_drop_chap_set_up:n { #1 }
+ \dim_compare:nNnTF
+ \l__scripture_chap_width_dim < \leftmargin
+ {
+ \tl_set:Nx \l__scripture_chap_sep_tl
+ {
+ \dim_eval:n { \leftmargin - \l__scripture_chap_width_dim }
+ }
+ }
+ {
+ \parshape 3 ~
+ \dim_eval:n
+ {
+ \@totalleftmargin - \leftmargin + \l__scripture_chap_width_dim +
+ \l__scripture_chap_sep_tl
+ } ~
+ \dim_eval:n
+ {
+ \linewidth + \leftmargin - \l__scripture_chap_width_dim -
+ \l__scripture_chap_sep_tl
+ } ~
+ \dim_eval:n
+ {
+ \@totalleftmargin - \leftmargin + \l__scripture_chap_width_dim +
+ \l__scripture_chap_sep_tl
+ } ~
+ \dim_eval:n
+ {
+ \linewidth + \leftmargin - \l__scripture_chap_width_dim -
+ \l__scripture_chap_sep_tl
+ } ~
+ \@totalleftmargin ~ \linewidth
+ }
+ \mode_if_vertical:T
+ {
+ \tl_set:Nx \l__scripture_chap_sep_tl
+ {
+ \dim_eval:n
+ {
+ \l__scripture_chap_sep_tl + \l__scripture_hanging_parindent_saved_dim
+ }
+ }
+ \__scripture_nohang:
+ }
+ \hbox_set:Nn \l_tmpb_box
+ {
+ \box_move_down:nn
+ { \baselineskip }
+ {
+ \hbox_overlap_left:n
+ {
+ \box_use:N \l_tmpa_box
+ \skip_horizontal:N \l__scripture_chap_sep_tl
+ }
+ }
+ }
+ \box_set_ht:Nn \l_tmpb_box { \c_zero_dim }
+ \box_set_dp:Nn \l_tmpb_box { \c_zero_dim }
+ \box_use:N \l_tmpb_box
+ \hook_gput_next_code:nn { para / begin }
+ { \parshape 1 ~ \@totalleftmargin ~ \linewidth }
+ }
+\cs_new_protected:Nn \__scripture_hanging_verse:n
+ {
+ \mode_if_vertical:TF
+ {
+ \strut
+ \hbox_overlap_left:n
+ {
+ \__scripture_verse_output:n { #1 }
+ }
+ }
+ { \__scripture_verse_output:n { #1 } }
+ }
+\cs_new_protected_nopar:Nn \__scripture_nohang:
+ {
+ \para_raw_noindent:
+ \hbox_to_wd:nn { \l__scripture_hanging_parindent_saved_dim } { }
+ }
+\cs_new_protected:Nn \__scripture_hanging_begin:n
+ {
+ \bool_if:NT \l__scripture_active_inner_bool
+ {
+ \msg_error:nn { scripture } { nested-environment }
+ }
+ \bool_set_true:N \l__scripture_active_inner_bool
+ \tl_if_novalue:nF { #1 }
+ {
+ \keys_set:nn
+ { scripture / hanging }
+ { #1 }
+ }
+ \par
+ \list { }
+ {
+ \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_hanging_belowskip_tl
+ \bool_if:NTF \g__scripture_start_bool
+ { \dim_zero:N \topsep }
+ {
+ \dim_compare:nTF
+ { \parskip >= \l__scripture_hanging_aboveskip_tl > \c_zero_skip }
+ {
+ \skip_zero:N \topsep
+ \skip_zero:N \l__scripture_delta_below_skip
+ }
+ {
+ \skip_set_eq:NN \topsep \l__scripture_hanging_aboveskip_tl
+ \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_hanging_aboveskip_tl
+ }
+ \int_compare:nNnT \l__scripture_chap_par_prevgraf_int = 1
+ { \addvspace { \baselineskip } }
+ \int_zero:N \l__scripture_chap_par_prevgraf_int
+ }
+ \dim_set:Nn \leftmargin
+ { \l__scripture_hanging_leftmargin_tl + \l__scripture_hanging_hang_tl }
+ \dim_set_eq:NN \rightmargin \l__scripture_hanging_rightmargin_tl
+ \dim_set:Nn \itemindent { -\l__scripture_hanging_hang_tl }
+ \dim_set:Nn \listparindent { -\l__scripture_hanging_hang_tl }
+ \skip_set_eq:NN \parsep \parskip
+ \skip_zero:N \partopsep
+ \dim_zero:N \labelsep
+ \dim_set_eq:NN \l__scripture_hanging_parindent_saved_dim \parindent
+ }
+ \bool_if:NTF \l__scripture_chap_drop_bool
+ { \cs_set_eq:NN \ch \__scripture_hanging_chap:n }
+ { \cs_set_eq:NN \ch \__scripture_nodrop_chap:n }
+ \cs_set_eq:NN \vs \__scripture_hanging_verse:n
+ \cs_set_eq:NN \nohang \__scripture_nohang:
+ \item
+ \relax
+ }
+\cs_new_protected:Nn \__scripture_hanging_end:
+ {
+ \__scripture_calc_final_line_length:
+ \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip
+ \endlist
+ }
+\cs_new_protected:Npn \__scripture_vbox_set_top:Nw #1
+ {
+ \tex_setbox:D #1 \tex_vtop:D
+ \c_group_begin_token
+ \color_group_begin:
+ }
+\bool_new:N \l__scripture_mid_para_chap_bool
+\box_new:N \l__scripture_mid_para_chap_line_box
+\int_new:N \g__scripture_mid_para_chap_prevgraf_int
+\box_new:N \l__scripture_mid_para_chap_snap_box
+\int_new:N \l__scripture_mid_para_chap_spacefactor_int
+\box_new:N \l__scripture_mid_para_chap_box
+\cs_new_protected:Nn \__scripture_mid_para_drop_chap_output:
+ {
+ \unskip
+ \int_set_eq:NN \l__scripture_mid_para_chap_spacefactor_int \spacefactor
+ \strut
+ \par
+ \int_gset_eq:NN \g__scripture_mid_para_chap_prevgraf_int \prevgraf
+ \box_set_to_last:N \l__scripture_mid_para_chap_line_box
+ \hbox_set:Nn \l__scripture_mid_para_chap_snap_box
+ {
+ \hbox_unpack_drop:N \l__scripture_mid_para_chap_line_box
+ \unskip
+ \unskip
+ \unpenalty
+ }
+ \nointerlineskip
+ \dim_compare:nNnTF
+ {
+ \box_wd:N \l__scripture_mid_para_chap_snap_box +
+ \l__scripture_chap_width_dim +
+ \l__scripture_chap_sep_tl
+ }
+ <
+ { \linewidth - \leftskip - \rightskip - 3 em }
+ {
+ \__scripture_drop_chap_output:
+ \hbox_unpack_drop:N \l__scripture_mid_para_chap_snap_box
+ \int_set_eq:NN \spacefactor \l__scripture_mid_para_chap_spacefactor_int
+ \c_space_tl
+ \__scripture_verse_output:n { 1 }
+ }
+ {
+ \group_begin:
+ \noindent
+ \skip_horizontal:n { -\leftskip }
+ \hbox_unpack_drop:N \l__scripture_mid_para_chap_snap_box
+ \skip_zero:N \parfillskip
+ \par
+ \int_gadd:Nn \g__scripture_mid_para_chap_prevgraf_int \prevgraf
+ \group_end:
+ \__scripture_drop_chap_output:
+ }
+ }
+\cs_new_protected:Nn \__scripture_mid_para_chap_begin:
+ {
+ \par
+ \bool_set_true:N \l__scripture_mid_para_chap_bool
+ \skip_zero:N \parskip
+ \__scripture_vbox_set_top:Nw \l__scripture_mid_para_chap_box
+ }
+\cs_new_protected:Nn \__scripture_mid_para_chap_end:
+ {
+ \__scripture_calc_final_line_length:
+ \int_gadd:Nn \g__scripture_mid_para_chap_prevgraf_int { \prevgraf - 1 }
+ \vbox_set_end:
+ \dim_compare:nNnTF
+ { \box_ht_plus_dp:N \l__scripture_mid_para_chap_box }
+ >
+ { \pagegoal - \pagetotal - \baselineskip }
+ {
+ \int_set:Nn \vbadness { 10000 }
+ \vbox_set_split_to_ht:NNn
+ \l_tmpa_box \l__scripture_mid_para_chap_box
+ { \pagegoal - \pagetotal - \baselineskip }
+ \box_use_drop:N \l_tmpa_box
+ \goodbreak
+ \box_use_drop:N \l__scripture_mid_para_chap_box
+ }
+ {
+ \box_use_drop:N \l__scripture_mid_para_chap_box
+ \skip_vertical:n { \baselineskip - \lineskip }
+ }
+ \par
+ \noindent
+ \skip_horizontal:N \g__scripture_final_line_dim
+ \__scripture_reset_spacing:
+ }
+\cs_new_protected:Nn \__scripture_narrow_begin:n
+ {
+ \bool_if:NT \l__scripture_active_inner_bool
+ {
+ \msg_error:nn { scripture } { nested-environment }
+ }
+ \bool_set_true:N \l__scripture_active_inner_bool
+ \tl_if_novalue:nF { #1 }
+ {
+ \keys_set:nn
+ { scripture / narrow }
+ { #1 }
+ }
+ \par
+ \list { }
+ {
+ \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_narrow_belowskip_tl
+ \bool_if:NTF \g__scripture_start_bool
+ { \skip_zero:N \topsep }
+ {
+ \dim_compare:nTF
+ { \parskip >= \l__scripture_narrow_aboveskip_tl > \c_zero_skip }
+ {
+ \skip_zero:N \topsep
+ \skip_zero:N \l__scripture_delta_below_skip
+ }
+ {
+ \skip_set_eq:NN \topsep \l__scripture_narrow_aboveskip_tl
+ \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_narrow_aboveskip_tl
+ }
+ }
+ \dim_set_eq:NN \leftmargin \l__scripture_narrow_leftmargin_tl
+ \dim_set_eq:NN \rightmargin \l__scripture_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
+ }
+ \item
+ \relax
+ }
+\cs_new_protected:Nn \__scripture_narrow_end:
+ {
+ \__scripture_calc_final_line_length:
+ \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip
+ \endlist
+ }
+\bool_new:N \g__scripture_poetry_end_bool
+\int_new:N \l__scripture_poetry_prevgraf_int
+\cs_new_protected:Nn \__scripture_poetry_chap:n
+ {
+ \__scripture_drop_chap_set_up:n { #1 }
+ \dim_compare:nNnT \l__scripture_chap_width_dim < \l__scripture_poetry_leftmargin_tl
+ {
+ \tl_set:Nx \l__scripture_chap_sep_tl
+ {
+ \dim_eval:n
+ {
+ \l__scripture_poetry_leftmargin_tl - \l__scripture_chap_width_dim
+ }
+ }
+ }
+ \hbox_set:Nn \l_tmpb_box
+ {
+ \box_move_down:nn
+ { \baselineskip }
+ {
+ \hbox_overlap_left:n
+ {
+ \box_use:N \l_tmpa_box
+ \skip_horizontal:N \l__scripture_chap_sep_tl
+ }
+ }
+ }
+ \box_set_ht:Nn \l_tmpb_box { \c_zero_dim }
+ \box_set_dp:Nn \l_tmpb_box { \c_zero_dim }
+ \parshape 2 ~
+ \dim_eval:n
+ {
+ \@totalleftmargin - \l__scripture_poetry_leftmargin_tl +
+ \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl
+ } ~
+ \dim_eval:n
+ {
+ \linewidth - \@totalleftmargin + \l__scripture_poetry_leftmargin_tl -
+ \l__scripture_chap_width_dim - \l__scripture_chap_sep_tl
+ } ~
+ \dim_eval:n
+ { \@totalleftmargin + \l__scripture_poetry_big_indent_tl } ~
+ \dim_eval:n
+ { \linewidth - \l__scripture_poetry_big_indent_tl }
+ \dim_compare:nNnT
+ { \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl }
+ >
+ { \l__scripture_poetry_leftmargin_tl + \listparindent }
+ {
+ \hook_gput_next_code:nn { para / begin }
+ {
+ \int_compare:nNnT \l__scripture_poetry_prevgraf_int = 1
+ {
+ \parshape 2 ~
+ \dim_eval:n
+ {
+ \@totalleftmargin - \l__scripture_poetry_leftmargin_tl +
+ \l__scripture_chap_width_dim + \l__scripture_chap_sep_tl -
+ \listparindent
+ } ~
+ \dim_eval:n
+ {
+ \linewidth - \@totalleftmargin + \l__scripture_poetry_leftmargin_tl -
+ \l__scripture_chap_width_dim - \l__scripture_chap_sep_tl +
+ \listparindent
+ } ~
+ \dim_eval:n
+ { \@totalleftmargin + \l__scripture_poetry_big_indent_tl } ~
+ \dim_eval:n
+ { \linewidth - \l__scripture_poetry_big_indent_tl }
+ }
+ }
+ }
+ \box_use:N \l_tmpb_box
+ }
+\cs_new_protected:Nn \__scripture_poetry_nodrop_chap:n
+ {
+ \hbox_overlap_left:n
+ {
+ \group_begin:
+ \l__scripture_chap_font_tl
+ #1
+ \group_end:
+ \skip_horizontal:N \l__scripture_chap_sep_tl
+ }
+ }
+\cs_new_protected:Nn \__scripture_poetry_mode_vertical_verse:n
+ {
+ \strut
+ \hbox_overlap_left:n
+ {
+ \__scripture_verse_output:n { #1 }
+ }
+ }
+\cs_new_protected:Nn \__scripture_poetry_mode_horizontal_verse:n
+ {
+ \skip_horizontal:n { -\listparindent }
+ \__scripture_poetry_mode_vertical_verse:n { #1 }
+ \skip_horizontal:N \listparindent
+ }
+\cs_new_protected:Nn \__scripture_poetry_par:
+ {
+ \mode_if_vertical:TF
+ {
+ \cs_set_eq:NN \vs \__scripture_poetry_mode_vertical_verse:n
+ \noindent
+ }
+ {
+ \cs_set_eq:NN \vs \__scripture_poetry_mode_horizontal_verse:n
+ \__scripture_tmp_para_end:
+ }
+ \parshape 2 ~
+ \@totalleftmargin ~
+ \linewidth ~
+ \dim_eval:n
+ { \@totalleftmargin + \l__scripture_poetry_big_indent_tl } ~
+ \dim_eval:n
+ { \linewidth - \l__scripture_poetry_big_indent_tl }
+ }
+\group_begin:
+ \char_set_catcode_active:N \^^M
+ \cs_gset_protected_nopar:Nn \__scripture_obeylines: %
+ {%
+ \char_set_catcode_active:N \^^M%
+ \cs_set_eq:NN ^^M \__scripture_obeylines_end:%
+ }%
+\group_end:
+\cs_new_protected:Nn \__scripture_obeylines_end:
+ {
+ \peek_meaning:NF \end
+ {
+ \par
+ \int_set:Nn \l__scripture_poetry_prevgraf_int { \int_use:N \prevgraf }
+ }
+ }
+\cs_new_protected:Nn \__scripture_poetry_begin:
+ {
+ \bool_if:NT \l__scripture_active_inner_bool
+ {
+ \msg_error:nn { scripture } { nested-environment }
+ }
+ \bool_set_true:N \l__scripture_active_inner_bool
+ \par
+ \list { }
+ {
+ \skip_set_eq:NN \l__scripture_delta_below_skip \l__scripture_poetry_belowskip_tl
+ \bool_if:NTF \g__scripture_start_bool
+ {
+ \skip_zero:N \topsep
+ }
+ {
+ \dim_compare:nTF
+ { \parskip >= \l__scripture_poetry_aboveskip_tl > \c_zero_skip }
+ {
+ \skip_zero:N \topsep
+ \skip_zero:N \l__scripture_delta_below_skip
+ }
+ {
+ \skip_set_eq:NN \topsep \l__scripture_poetry_aboveskip_tl
+ \skip_sub:Nn \l__scripture_delta_below_skip \l__scripture_poetry_aboveskip_tl
+ }
+ \int_compare:nNnT \l__scripture_chap_par_prevgraf_int = 1
+ { \addvspace { \baselineskip } }
+ \int_zero:N \l__scripture_chap_par_prevgraf_int
+ }
+ \dim_set_eq:NN \leftmargin \l__scripture_poetry_leftmargin_tl
+ \dim_set_eq:NN \rightmargin \l__scripture_poetry_rightmargin_tl
+ \dim_set_eq:NN \itemindent \l__scripture_poetry_indent_tl
+ \dim_set_eq:NN \listparindent \l__scripture_poetry_indent_tl
+ \skip_zero:N \parsep
+ \skip_zero:N \partopsep
+ \dim_zero:N \labelsep
+ }
+ \raggedright
+ \dim_set_eq:NN \listparindent \l__scripture_poetry_indent_tl
+ \dim_set_eq:NN \parindent \l__scripture_poetry_indent_tl
+ \bool_if:NTF \l__scripture_chap_drop_bool
+ { \cs_set_eq:NN \ch \__scripture_poetry_chap:n }
+ { \cs_set_eq:NN \ch \__scripture_poetry_nodrop_chap:n }
+ \cs_set_eq:NN \vs \__scripture_poetry_mode_vertical_verse:n
+ \item
+ \relax
+ \cs_set_eq:NN \__scripture_tmp_para_end: \par
+ \cs_set_eq:NN \par \__scripture_poetry_par:
+ }
+\cs_new_protected:Nn \__scripture_poetry_end:
+ {
+ \__scripture_calc_final_line_length:
+ \skip_add:Nn \@topsepadd \l__scripture_delta_below_skip
+ \endlist
+ \bool_gset_true:N \g__scripture_poetry_end_bool
+ \hook_gput_next_code:nn { para / begin }
+ { \bool_gset_false:N \g__scripture_poetry_end_bool }
+ }
+\NewDocumentCommand { \scripturesetup } { m }
+ {
+ \keys_set:nn { scripture } { #1 }
+ }
+\NewDocumentEnvironment { scripture } { oo }
+ {
+ \__scripture_begin:n { #2 }
+ \DeclareDocumentEnvironment { center } { o }
+ {
+ \__scripture_center_begin:n { ##1 }
+ \ignorespaces
+ }
+ { \__scripture_center_end: }
+ \DeclareDocumentEnvironment { flushright } { o }
+ {
+ \__scripture_flushright_begin:n { ##1 }
+ \ignorespaces
+ }
+ { \__scripture_flushright_end: }
+ \DeclareDocumentEnvironment { hanging } { o }
+ {
+ \__scripture_hanging_begin:n { ##1 }
+ \ignorespaces
+ }
+ { \__scripture_hanging_end: }
+ \DeclareDocumentEnvironment { midparachap } { }
+ {
+ \__scripture_mid_para_chap_begin:
+ \ignorespaces
+ }
+ { \__scripture_mid_para_chap_end: }
+ \DeclareDocumentEnvironment { narrow } { o }
+ {
+ \__scripture_narrow_begin:n { ##1 }
+ \ignorespaces
+ }
+ { \__scripture_narrow_end: }
+ \DeclareDocumentEnvironment { poetryaux } { o }
+ {
+ \tl_if_novalue:nF { ##1 }
+ {
+ \keys_set:nn
+ { scripture / poetry }
+ { ##1 }
+ }
+ \__scripture_poetry_begin:
+ \ignorespaces
+ }
+ { \__scripture_poetry_end: }
+ \DeclareDocumentEnvironment { poetry } { }
+ {
+ \__scripture_obeylines:
+ \poetryaux
+ }
+ { \endpoetryaux }
+ \ignorespaces
+ }
+ {
+ \__scripture_end:n { #1 }
+ }
+%%
+%%
+%% End of file `scripture.sty'.