%% %% This is file `xgalley.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% xgalley.dtx (with options: `package') %% %% Copyright (C) 2010-2024 The LaTeX Project %% %% It may be distributed and/or modified under the conditions of %% the LaTeX Project Public License (LPPL), either version 1.3c of %% this license or (at your option) any later version. The latest %% version of this license is in the file: %% %% http://www.latex-project.org/lppl.txt %% %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% File: xgalley.dtx \ProvidesExplPackage{xgalley}{2024-03-14}{} {L3 Experimental galley} \RequirePackage{xtemplate,l3galley} \clist_new:N \l__galley_tmpa_clist \clist_new:N \l__galley_tmpb_clist \DeclareObjectType { measure } { 0 } \DeclareTemplateInterface { measure } { absolute } { 0 } { left-margin : length = 0pt , right-margin : length = 0pt } \DeclareTemplateInterface { measure } { relative } { 0 } { left-margin : length = 0pt , right-margin : length = 0pt } \cs_new_eq:NN \l__galley_left_margin_dim \leftmargin \cs_new_eq:NN \l__galley_right_margin_dim \rightmargin \DeclareTemplateCode { measure } { absolute } { 0 } { left-margin = \l__galley_left_margin_dim , right-margin = \l__galley_right_margin_dim } { \galley_margins_set_absolute:nn \l__galley_left_margin_dim \l__galley_right_margin_dim } \DeclareTemplateCode { measure } { relative } { 0 } { left-margin = \l__galley_left_margin_dim , right-margin = \l__galley_right_margin_dim } { \galley_margins_set_relative:nn \l__galley_left_margin_dim \l__galley_right_margin_dim } \DeclareObjectType { parshape } { 0 } \DeclareTemplateInterface { parshape } { hang } { 0 } { indent : length = 0pt , on-left-side : boolean = true , lines : integer = 1 } \DeclareTemplateInterface { parshape } { initial } { 0 } { indent : length = 0pt , on-left-side : boolean = true , lines : integer = 2 } \DeclareTemplateCode { parshape } { hang } { 0 } { indent = \l__galley_parshape_indent_dim , on-left-side = \l__galley_parshape_on_left_bool , lines = \l__galley_parshape_lines_int } { \bool_if:NTF \l__galley_parshape_on_left_bool { \galley_parshape_set_single:nVVN \l__galley_parshape_lines_int \l__galley_parshape_indent_dim \c_zero_dim \c_false_bool } { \galley_parshape_set_single:nVVN \l__galley_parshape_lines_int \c_zero_dim \l__galley_parshape_indent_dim \c_false_bool } } \DeclareTemplateCode { parshape } { initial } { 0 } { indent = \l__galley_parshape_indent_dim , on-left-side = \l__galley_parshape_on_left_bool , lines = \l__galley_parshape_lines_int } { \clist_clear:N \l__galley_tmpa_clist \clist_clear:N \l__galley_tmpb_clist \prg_replicate:nn { \l__galley_parshape_lines_int } { \clist_put_right:Nn \l__galley_tmpa_clist { \l__galley_parshape_indent_dim } \clist_put_right:Nn \l__galley_tmpb_clist { \c_zero_dim } } \bool_if:NTF \l__galley_parshape_on_left_bool { \galley_parshape_set_single:nVVN { 0 } \l__galley_tmpa_clist \l__galley_tmpb_clist \c_true_bool } { \galley_parshape_set_single:nVVN { 0 } \l__galley_tmpb_clist \l__galley_tmpa_clist \c_true_bool } } \DeclareTemplateInterface { parshape } { std } { 0 } { } \DeclareTemplateCode { parshape } { std } { 0 } { } { } \DeclareObjectType { hyphenation } { 0 } \DeclareTemplateInterface { hyphenation } { std } { 0 } { enable : boolean = true , enable-upper-case : boolean = true , penalty : choice { low , medium , high } = low } \DeclareTemplateCode { hyphenation } { std } { 0 } { enable = \l_galley_hyphen_enable_bool , enable-upper-case = \l_galley_hyphen_uppercase_bool , penalty = { low = { \int_set:Nn \tex_hyphenpenalty:D { 51 } \int_set:Nn \tex_exhyphenpenalty:D { 51 } } , medium = { \int_set:Nn \tex_hyphenpenalty:D { 151 } \int_set:Nn \tex_exhyphenpenalty:D { 151 } } , high = { \int_set:Nn \tex_hyphenpenalty:D { 301 } \int_set:Nn \tex_exhyphenpenalty:D { 301 } } , } } { \int_set:Nn \tex_lefthyphenmin:D { \bool_if:NTF \l_galley_hyphen_enable_bool { \l_galley_hyphen_left_int } { 63 } } \int_set:Nn \tex_uchyph:D { \bool_if:NTF \l_galley_hyphen_uppercase_bool { 1 } { 0 } } } \UseTemplate { hyphenation } { std } { } \tex_defaulthyphenchar:D 45 \scan_stop: \tl_new:N \l__galley_justification_other_tl \DeclareObjectType { justification } { 0 } \DeclareTemplateInterface { justification } { std } { 0 } { end-skip : skip = 0pt plus 1fil , fixed-word-spacing : boolean = false , indent-width : length , left-skip : skip = 0pt , right-skip : skip = 0pt , start-skip : skip = 0pt , stretch-last-line : boolean = false } \DeclareTemplateInterface { justification } { single } { 0 } { end-skip : skip = 0pt plus 1fil , fixed-word-spacing : boolean = false , indent-width : length , left-skip : skip = 0pt , right-skip : skip = 0pt , start-skip : skip = 0pt , stretch-last-line : boolean = false } \DeclareTemplateCode { justification } { std } { 0 } { end-skip = \l_galley_par_end_skip , fixed-word-spacing = \l_galley_fixed_spacing_bool , indent-width = \l_galley_par_indent_dim , left-skip = \l_galley_line_left_skip , right-skip = \l_galley_line_right_skip , start-skip = \l_galley_par_begin_skip , stretch-last-line = \l_galley_par_stretch_last_bool } { \tl_clear:N \l__galley_justification_other_tl \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool { \int_set:Nn \l_galley_last_line_fit_int { 1000 } } { \int_zero:N \l_galley_last_line_fit_int } \skip_set:Nn \@rightskip { \l_galley_line_right_skip } } \DeclareTemplateCode { justification } { single } { 0 } { end-skip = \l_galley_par_end_skip , fixed-word-spacing = \l_galley_fixed_spacing_bool , indent-width = \l_galley_par_indent_dim , left-skip = \l_galley_line_left_skip , right-skip = \l_galley_line_right_skip , start-skip = \l_galley_par_begin_skip , stretch-last-line = \l_galley_par_stretch_last_bool } { \tl_put_left:Ne \l__galley_justification_other_tl { \skip_set:Nn \exp_not:N \l_galley_par_end_skip { \skip_use:N \l_galley_par_end_skip } \bool_if:NTF \l_galley_fixed_spacing_bool { \bool_set_true:N \exp_not:N \l_galley_fixed_spacing_bool } { \bool_set_false:N \exp_not:N \l_galley_fixed_spacing_bool } \galley_interword_spacing_set:N \exp_not:N \l_galley_fixed_spacing_bool \dim_set:Nn \exp_not:N \l_galley_par_indent_dim { \dim_use:N \l_galley_par_indent_dim } \skip_set:Nn \l_galley_line_left_skip { \skip_use:N \l_galley_line_left_skip } \skip_set:Nn \exp_not:N \l_galley_line_right_skip { \skip_use:N \l_galley_line_right_skip } \skip_set:Nn \exp_not:N \l_galley_par_begin_skip { \skip_use:N \l_galley_par_begin_skip } \int_set:Nn \exp_not:N \l_galley_last_line_fit_int { \int_use:N \l_galley_last_line_fit_int } \skip_set:Nn \exp_not:N \@rightskip { \skip_use:N \l_galley_line_right_skip } } \tl_gput_right:Nn \g_galley_restore_running_tl { \l__galley_justification_other_tl } \AssignTemplateKeys \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool { \int_set:Nn \l_galley_last_line_fit_int { 1000 } } { \int_zero:N \l_galley_last_line_fit_int } \skip_set:Nn \@rightskip { \l_galley_line_right_skip } } \DeclareInstance { justification } { justified } { std } { indent-width = 15pt } \UseInstance { justification } { justified } \DeclareInstance { justification } { noindent } { std } { end-skip = 15pt plus 1fil , indent-width = 0pt } \DeclareInstance { justification } { ragged-left } { std } { end-skip = 0pt , fixed-word-spacing = true , indent-width = 0pt , left-skip = 0pt plus 2em , right-skip = 0pt } \DeclareInstance { justification } { ragged-right } { std } { end-skip = 0pt plus 1fil , fixed-word-spacing = true , indent-width = 0pt , left-skip = 0pt , right-skip = 0pt plus 2em } \DeclareInstance { justification } { center } { std } { end-skip = 0pt , fixed-word-spacing = true , indent-width = 0pt , left-skip = 0pt plus 1fil , right-skip = 0pt plus 1fil } \DeclareTemplateInterface { justification } { compound } { 0 } { first-paragraph : instance { justification } , other-paragraphs : instance { justification } } \DeclareTemplateCode { justification } { compound } { 0 } { first-paragraph = \__galley_justification_first: , other-paragraphs = \__galley_justification_other: } { \__galley_justification_first: \tl_set:Nn \l__galley_justification_other_tl { \__galley_justification_other: } \tl_gput_right:Nn \g_galley_restore_running_tl { \l__galley_justification_other_tl } } \DeclareObjectType { line-breaking } { 0 } \DeclareTemplateInterface { line-breaking } { std } { 0 } { badness : integer = 1000 , binop-penalty : integer = 700 , double-hyphen-demerits : integer = 10000 , emergency-stretch : skip = 0pt , final-hyphen-demerits : integer = 5000 , fuzz : length = 0.1pt , line-penalty : integer = 10 , mismatch-demerits : integer = 10000 , pretolerance : integer = 100 , relation-penalty : integer = 500 , tolerance : integer = 200 } \DeclareTemplateCode{ line-breaking } { std } { 0 } { badness = \l_galley_linebreak_badness_int , binop-penalty = \l__galley_binop_penalty_int , double-hyphen-demerits = \l_galley_double_hyphen_demerits_int , emergency-stretch = \l_galley_emergency_stretch_skip , final-hyphen-demerits = \l_galley_final_hyphen_demerits_int , fuzz = \l_galley_linebreak_fuzz_dim , line-penalty = \l__galley_linebreak_penalty_int , mismatch-demerits = \l_galley_mismatch_demerits_int , pretolerance = \l_galley_linebreak_pretolerance_int , relation-penalty = \l__galley_relation_penalty_int , tolerance = \l_galley_linebreak_tolerance_int } { } \DeclareInstance { line-breaking } { std } { std } { } \UseInstance { line-breaking } { std } \DeclareObjectType { paragraph-breaking } { 0 } \DeclareTemplateInterface { paragraph-breaking } { std } { 0 } { badness : integer = 1000 , broken-penalty : integer = 100 , club-penalty : integer = 150 , display-club-penalty : integer = 150 , display-widow-penalty : integer = 150 , fuzz : length = 0.1pt , interline-penalty : integer = 0 , post-display-penalty : integer = 0 , pre-display-penalty : integer = 10000 , widow-penalty : integer = 150 } \DeclareTemplateCode { paragraph-breaking } { std } { 0 } { badness = \l_galley_parbreak_badness_int , broken-penalty = \l__galley_broken_penalty_int , club-penalty = \l__galley_club_penalty_int , display-club-penalty = \l__galley_display_club_penalty_int , display-widow-penalty = \l__galley_display_widow_penalty_int , fuzz = \l_galley_parbreak_fuzz_dim , interline-penalty = \l__galley_interline_penalty_int , post-display-penalty = \l__galley_post_display_penalty_int , pre-display-penalty = \l__galley_pre_display_penalty_int , widow-penalty = \l__galley_widow_penalty_int } { \galley_club_penalties_set:V \l__galley_club_penalty_int \galley_display_club_penalties_set:V \l__galley_display_club_penalty_int \galley_display_widow_penalties_set:V \l__galley_display_widow_penalty_int \galley_interline_penalty_set:n \l__galley_interline_penalty_int \galley_widow_penalties_set:V \l__galley_widow_penalty_int } \DeclareInstance { paragraph-breaking } { std } { std } { } \UseInstance { paragraph-breaking } { std } \DeclareInstance { paragraph-breaking } { nobreak } { std } { interline-penalty = 10 000 , post-display-penalty = 10 000 } \DeclareInstance { paragraph-breaking } { nolone } { std } { club-penalty = 10 000 , display-club-penalty = 10 000 , display-widow-penalty = 10 000 , widow-penalty = 10 000 } \DeclareTemplateInterface { paragraph-breaking } { single } { 0 } { badness : tokenlist , broken-penalty : tokenlist , club-penalty : tokenlist , display-club-penalty : tokenlist , display-widow-penalty : tokenlist , fuzz : tokenlist , interline-penalty : tokenlist , post-display-penalty : tokenlist , pre-display-penalty : tokenlist , widow-penalty : tokenlist } \DeclareTemplateCode { paragraph-breaking } { single } { 0 } { badness = \l__galley_parbreak_badness_tl , broken-penalty = \l__galley_broken_penalty_tl , club-penalty = \l__galley_club_penalties_tl , display-club-penalty = \l__galley_display_club_penalties_tl , display-widow-penalty = \l__galley_display_widow_penalties_tl , fuzz = \l__galley_parbreak_fuzz_tl , interline-penalty = \l__galley_interline_penalty_tl , post-display-penalty = \l__galley_post_display_penalty_tl , pre-display-penalty = \l__galley_pre_display_penalty_tl , widow-penalty = \l__galley_widow_penalties_tl } { \tl_if_empty:NF \l__galley_interline_penalty_tl { \tl_gput_right:Ne \g_galley_par_reset_hook_tl { \int_set:Nn \exp_not:N \l__galley_interline_penalty_int { \galley_interline_penalty: } } \int_set:Nn \l__galley_interline_penalty_int { \l__galley_interline_penalty_tl } } \tl_if_empty:NF \l__galley_parbreak_fuzz_tl { \tl_gput_right:Ne \g_galley_par_reset_hook_tl { \dim_set:Nn \exp_not:N \l_galley_parbreak_fuzz_dim { \dim_use:N \l_galley_parbreak_fuzz_dim } } \dim_set:Nn \l_galley_parbreak_fuzz_dim { \l__galley_parbreak_fuzz_tl } } \seq_map_inline:Nn \c__galley_parbreak_single_seq { \tl_if_empty:cF { l_galley_ ##1 _tl } { \tl_gput_right:Ne \g_galley_par_reset_hook_tl { \int_set:Nn \exp_not:c { l_galley_ ##1 _int } { \int_use:c { l_galley_ ##1 _int } } } \int_set:cn { l_galley_ ##1 _int } { \tl_use:c { l_galley_ ##1 _tl } } } } \seq_map_inline:Nn \c__galley_parbreak_multi_seq { \tl_if_empty:cF { l_galley_ ##1 _tl } { \use:c { galley_save_ ##1 :N } \l__galley_tmpa_clist \tl_gput_right:Ne \g_galley_par_reset_hook_tl { \exp_not:c { galley_set_ ##1 :n } { \exp_not:o \l__galley_tmpa_clist } } \use:c { galley_set_ ##1 :v } { l_galley_ ##1 _tl } } } } \seq_const_from_clist:Nn \c__galley_parbreak_multi_seq { club_penalties , display_club_penalties , display_widow_penalties , widow_penalties , } \seq_const_from_clist:Nn \c__galley_parbreak_single_seq { parbreak_badness , broken_penalty , post_display_penalty , pre_display_penalty , } \DeclareInstance { paragraph-breaking } { single-std } { single } { } \DeclareInstance { paragraph-breaking } { single-nobreak } { single } { interline-penalty = 10 000 , post-display-penalty = 10 000 } \DeclareInstance { paragraph-breaking } { single-noclub } { single } { club-penalty = 10 000 , display-club-penalty = 10 000 } \DeclareInstance { paragraph-breaking } { single-nolone } { single } { club-penalty = 10 000 , display-club-penalty = 10 000 , display-widow-penalty = 10 000 , widow-penalty = 10 000 } \DeclareInstance { paragraph-breaking } { single-nowidow } { single } { display-widow-penalty = 10 000 , widow-penalty = 10 000 } \DeclareObjectType { display-begin } { 0 } \DeclareObjectType { display-end } { 0 } \DeclareTemplateInterface { display-begin } { std } { 0 } { par-penalty : tokenlist , par-space : tokenlist , penalty : tokenlist , space : tokenlist } \DeclareTemplateInterface { display-end } { std } { 0 } { par-penalty : tokenlist , par-space : tokenlist , penalty : tokenlist , space : tokenlist } \DeclareTemplateCode { display-begin } { std } { 0 } { par-penalty = \l_galley_display_begin_par_vpenalty_tl , par-space = \l_galley_display_begin_par_vspace_tl , penalty = \l_galley_display_begin_vpenalty_tl , space = \l_galley_display_begin_vspace_tl } { \tl_if_empty:NF \l_galley_display_begin_par_vpenalty_tl { \tl_set:Ne \l_galley_display_begin_par_vpenalty_tl { \int_eval:n { \l_galley_display_begin_par_vpenalty_tl } } } \tl_if_empty:NF \l_galley_display_begin_par_vspace_tl { \tl_set:Ne \l_galley_display_begin_par_vspace_tl { \skip_eval:n { \l_galley_display_begin_par_vspace_tl } } } \tl_if_empty:NF \l_galley_display_begin_vpenalty_tl { \tl_set:Ne \l_galley_display_begin_vpenalty_tl { \int_eval:n { \l_galley_display_begin_vpenalty_tl } } } \tl_if_empty:NF \l_galley_display_begin_vspace_tl { \tl_set:Ne \l_galley_display_begin_vspace_tl { \skip_eval:n { \l_galley_display_begin_vspace_tl } } } } \DeclareTemplateCode { display-end } { std } { 0 } { par-penalty = \l_galley_display_end_par_vpenalty_tl , par-space = \l_galley_display_end_par_vspace_tl , penalty = \l_galley_display_end_vpenalty_tl , space = \l_galley_display_end_vspace_tl } { \tl_if_empty:NF \l_galley_display_end_par_vpenalty_tl { \tl_set:Ne \l_galley_display_end_par_vpenalty_tl { \int_eval:n { \l_galley_display_end_par_vpenalty_tl } } } \tl_if_empty:NF \l_galley_display_end_par_vspace_tl { \tl_set:Ne \l_galley_display_end_par_vspace_tl { \skip_eval:n { \l_galley_display_end_par_vspace_tl } } } \tl_if_empty:NF \l_galley_display_end_vpenalty_tl { \tl_set:Ne \l_galley_display_end_vpenalty_tl { \int_eval:n { \l_galley_display_end_vpenalty_tl } } } \tl_if_empty:NF \l_galley_display_end_vspace_tl { \tl_set:Ne \l_galley_display_end_vspace_tl { \skip_eval:n { \l_galley_display_end_vspace_tl } } } } %% %% %% End of file `xgalley.sty'.