diff options
author | Karl Berry <karl@freefriends.org> | 2012-12-21 23:31:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-12-21 23:31:35 +0000 |
commit | 8bcf0c7ef3cd19666c206271cea9280846b5c7e6 (patch) | |
tree | ee538c7e2a14ad105a169fdd2e745356147577cc /Master/texmf-dist/source/latex/l3experimental | |
parent | ef0453041a9700a2d974c3c76e3398e40c4e4aeb (diff) |
l3 (21dec12)
git-svn-id: svn://tug.org/texlive/trunk@28608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental')
7 files changed, 832 insertions, 600 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx index 22c4e73d42e..1b3ac4d507a 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3sort/l3sort.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3sort.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3sort.dtx 4339 2012-11-24 19:16:43Z joseph $ {L3 Experimental sorting functions} %</driver|package> %<*driver> @@ -277,49 +277,49 @@ % \begin{macro}[EXP]{\tl_sort:nN} % \begin{macro}[EXP, aux] % { -% \@@_quick_i:nNn, \@@_quick_ii:wn, -% \@@_quick_iii:nnNnn, \@@_quick_iv:nnNnwn +% \@@_quick:nNn, \@@_quick:wn, +% \@@_quick:nnNnn, \@@_quick:nnNnwn % } -% The \cs{@@_quick_i:nNn} function sorts |#1| using the comparison +% The \cs{@@_quick:nNn} function sorts |#1| using the comparison % |#2|, then places its third argument (\meta{continuation}) before % the result. This essentially avoids the rather slow \cs{use:ff}. % First test if |#1| is blank: if it is, \cs{use_none:n} eats the -% break point, and \cs{@@_quick_ii:wn} removes all until the ending +% break point, and \cs{@@_quick:wn} removes all until the ending % break point, unbracing the \meta{continuation}. If it is not blank, -% \cs{@@_quick_ii:wn} simply removes the end of that test until the +% \cs{@@_quick:wn} simply removes the end of that test until the % break point. The third auxiliary plays the role of |\__sort:nnNnn| % above, with an end-test replaced by \cs{__prg_break:}, which skips % to the break point two lines later, unless |#5| is itself a break -% point. In that case, \cs{@@_quick_iv:nnNnwn} calls the first +% point. In that case, \cs{@@_quick:nnNnwn} calls the first % auxiliary, which sorts |#2| and places another call to itself before % the result. % \begin{macrocode} -\cs_new:Npn \tl_sort:nN #1#2 { \@@_quick_i:nNn {#1} #2 { } } -\cs_new:Npn \@@_quick_i:nNn #1#2 +\cs_new:Npn \tl_sort:nN #1#2 { \@@_quick:nNn {#1} #2 { } } +\cs_new:Npn \@@_quick:nNn #1#2 { - \exp_after:wN \@@_quick_ii:wn + \exp_after:wN \@@_quick:wn \use_none:n #1 \__prg_break_point: - \@@_quick_iii:nnNnn { } { } #2 + \@@_quick:nnNnn { } { } #2 #1 { \__prg_break_point: } \__prg_break_point: } -\cs_new:Npn \@@_quick_ii:wn #1 \__prg_break_point: #2 {#2} -\cs_new:Npn \@@_quick_iii:nnNnn #1#2#3#4#5 +\cs_new:Npn \@@_quick:wn #1 \__prg_break_point: #2 {#2} +\cs_new:Npn \@@_quick:nnNnn #1#2#3#4#5 { \__prg_break: #5 - \@@_quick_iv:nnNnwn {#1} {#2} + \@@_quick:nnNnwn {#1} {#2} \__prg_break_point: #3 {#4} {#5} - { \@@_quick_iii:nnNnn {#1} { #2 {#5} } } - { \@@_quick_iii:nnNnn { #1 {#5} } {#2} } + { \@@_quick:nnNnn {#1} { #2 {#5} } } + { \@@_quick:nnNnn { #1 {#5} } {#2} } #3 {#4} } -\cs_new:Npn \@@_quick_iv:nnNnwn +\cs_new:Npn \@@_quick:nnNnwn #1#2 \__prg_break_point: #3#4 #5 \__prg_break_point: #6 { - \@@_quick_i:nNn {#2} #3 - { \@@_quick_i:nNn {#1} #3 {#6} {#4} } + \@@_quick:nNn {#2} #3 + { \@@_quick:nNn {#1} #3 {#6} {#4} } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx index ce26a6098ba..3d25a841a80 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3regex.dtx 4219 2012-09-09 13:28:51Z bruno $ +\GetIdInfo$Id: l3regex.dtx 4341 2012-11-27 08:39:42Z bruno $ {L3 Experimental regular expressions} %</driver|package> %<*driver> @@ -1398,7 +1398,7 @@ % number of hexadecimal digits), or not (allowing up to two % hexadecimal digits). We need to check for the end-of-string marker. % Eventually, call either \cs{@@_escape_x_loop:N} or -% \cs{@@_escape_x_ii:N}. +% \cs{@@_escape_x:N}. % \begin{macrocode} \cs_new:Npn \@@_escape_x_test:N #1 { @@ -1407,28 +1407,28 @@ \if_charcode:w \c_space_token #1 \exp_after:wN \@@_escape_x_test:N \else: - \exp_after:wN \@@_escape_x_test_ii:N + \exp_after:wN \@@_escape_x_test_two:N \exp_after:wN #1 \fi: } } -\cs_new:Npn \@@_escape_x_test_ii:N #1 +\cs_new:Npn \@@_escape_x_test_two:N #1 { \if_charcode:w \c_lbrace_str #1 \exp_after:wN \@@_escape_x_loop:N \else: \__str_hexadecimal_use:NTF #1 - { \exp_after:wN \@@_escape_x_ii:N } + { \exp_after:wN \@@_escape_x:N } { ; \exp_after:wN \@@_escape_loop:N \exp_after:wN #1 } \fi: } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_escape_x_ii:N} +% \begin{macro}[aux]{\@@_escape_x:N} % This looks for the second digit in the unbraced case. % \begin{macrocode} -\cs_new:Npn \@@_escape_x_ii:N #1 +\cs_new:Npn \@@_escape_x:N #1 { \str_if_eq_x:nnTF {#1} { break } { ; } { @@ -2096,9 +2096,9 @@ % \begin{macro}[aux]+\@@_compile_quantifier_{:w+ ^^A} % \begin{macro}[aux] % { -% \@@_compile_quantifier_braced_i:w, -% \@@_compile_quantifier_braced_ii:w, -% \@@_compile_quantifier_braced_iii:w, +% \@@_compile_quantifier_braced_auxi:w, +% \@@_compile_quantifier_braced_auxii:w, +% \@@_compile_quantifier_braced_auxiii:w, % } % Three possible syntaxes: \texttt{\{\meta{int}\}}, % \texttt{\{\meta{int},\}}, or \texttt{\{\meta{int},\meta{int}\}}. Any @@ -2114,10 +2114,10 @@ \cs_new_protected:cpn { @@_compile_quantifier_ \c_lbrace_str :w } { \@@_get_digits:NTFw \l_@@_internal_a_int - { \@@_compile_quantifier_braced_i:w } + { \@@_compile_quantifier_braced_auxi:w } { \@@_compile_quantifier_abort:xNN { \c_lbrace_str } } } -\cs_new_protected:Npn \@@_compile_quantifier_braced_i:w #1#2 +\cs_new_protected:Npn \@@_compile_quantifier_braced_auxi:w #1#2 { \str_case_x:nnn { #1 #2 } { @@ -2129,8 +2129,8 @@ { \@@_compile_special:N , } { \@@_get_digits:NTFw \l_@@_internal_b_int - { \@@_compile_quantifier_braced_iii:w } - { \@@_compile_quantifier_braced_ii:w } + { \@@_compile_quantifier_braced_auxiii:w } + { \@@_compile_quantifier_braced_auxii:w } } } { @@ -2139,7 +2139,7 @@ #1 #2 } } -\cs_new_protected:Npn \@@_compile_quantifier_braced_ii:w #1#2 +\cs_new_protected:Npn \@@_compile_quantifier_braced_auxii:w #1#2 { \str_if_eq_x:nnTF { #1 #2 } { \@@_compile_special:N \c_rbrace_str } @@ -2153,7 +2153,7 @@ #1 #2 } } -\cs_new_protected:Npn \@@_compile_quantifier_braced_iii:w #1#2 +\cs_new_protected:Npn \@@_compile_quantifier_braced_auxiii:w #1#2 { \str_if_eq_x:nnTF { #1 #2 } { \@@_compile_special:N \c_rbrace_str } @@ -2495,7 +2495,7 @@ % \end{macro} % % \begin{macro}[aux] -% {\@@_compile_class:TFNN, \@@_compile_class_ii:NN} +% {\@@_compile_class:TFNN, \@@_compile_class:NN} % If the first character is |^|, then the class is negative (use % |#2|), otherwise it is positive (use |#1|). If the next character % is a right bracket, then it should be changed to a raw one. @@ -2506,14 +2506,14 @@ \str_if_eq:nnTF { #3 #4 } { \@@_compile_special:N ^ } { \__tl_build_one:n { #2 { \if_false: } \fi: } - \@@_compile_class_ii:NN + \@@_compile_class:NN } { \__tl_build_one:n { #1 { \if_false: } \fi: } - \@@_compile_class_ii:NN #3 #4 + \@@_compile_class:NN #3 #4 } } -\cs_new_protected:Npn \@@_compile_class_ii:NN #1#2 +\cs_new_protected:Npn \@@_compile_class:NN #1#2 { \token_if_eq_charcode:NNTF #2 ] { \@@_compile_raw:N #2 } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index 792cdcb105f..ea6c38e6564 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -227,13 +227,13 @@ % \begin{macro}[aux, EXP]{\@@_format_parse:n} % \begin{macro}[aux, EXP] % { -% \@@_format_parse_i:NN, -% \@@_format_parse_ii:nN, -% \@@_format_parse_iii:nN, -% \@@_format_parse_iv:nwN, -% \@@_format_parse_v:nN, -% \@@_format_parse_vi:nwN, -% \@@_format_parse_vii:nN, +% \@@_format_parse_auxi:NN, +% \@@_format_parse_auxii:nN, +% \@@_format_parse_auxiii:nN, +% \@@_format_parse_auxiv:nwN, +% \@@_format_parse_auxv:nN, +% \@@_format_parse_auxvi:nwN, +% \@@_format_parse_auxvii:nN, % \@@_format_parse_end:nwn, % } % The goal is to parse @@ -244,51 +244,51 @@ % \begin{macrocode} \cs_new:Npn \@@_format_parse:n #1 { - \exp_last_unbraced:Nf \@@_format_parse_i:NN + \exp_last_unbraced:Nf \@@_format_parse_auxi:NN \@@_to_other:n {#1} \s__stop \s__stop {#1} } -\cs_new:Npx \@@_format_parse_i:NN #1#2 +\cs_new:Npx \@@_format_parse_auxi:NN #1#2 { \exp_not:N \@@_if_contains_char:nNTF { < > = ^ } #2 - { \exp_not:N \@@_format_parse_iii:nN { #1 #2 } } + { \exp_not:N \@@_format_parse_auxiii:nN { #1 #2 } } { - \exp_not:N \@@_format_parse_ii:nN + \exp_not:N \@@_format_parse_auxii:nN { \c_catcode_other_space_tl } #1 #2 } } -\cs_new:Npn \@@_format_parse_ii:nN #1#2 +\cs_new:Npn \@@_format_parse_auxii:nN #1#2 { \@@_if_contains_char:nNTF { < > = ^ } #2 - { \@@_format_parse_iii:nN { #1 #2 } } - { \@@_format_parse_iii:nN { #1 ? } #2 } + { \@@_format_parse_auxiii:nN { #1 #2 } } + { \@@_format_parse_auxiii:nN { #1 ? } #2 } } -\cs_new:Npx \@@_format_parse_iii:nN #1#2 +\cs_new:Npx \@@_format_parse_auxiii:nN #1#2 { \exp_not:N \@@_if_contains_char:nNTF { + - \c_catcode_other_space_tl } #2 - { \exp_not:N \@@_format_parse_iv:nwN { #1 #2 } ; } - { \exp_not:N \@@_format_parse_iv:nwN { #1 ? } ; #2 } + { \exp_not:N \@@_format_parse_auxiv:nwN { #1 #2 } ; } + { \exp_not:N \@@_format_parse_auxiv:nwN { #1 ? } ; #2 } } -\cs_new:Npn \@@_format_parse_iv:nwN #1#2; #3 +\cs_new:Npn \@@_format_parse_auxiv:nwN #1#2; #3 { \@@_format_if_digit:NTF #3 - { \@@_format_parse_iv:nwN {#1} #2 #3 ; } - { \@@_format_parse_v:nN { #1 {#2} } #3 } + { \@@_format_parse_auxiv:nwN {#1} #2 #3 ; } + { \@@_format_parse_auxv:nN { #1 {#2} } #3 } } -\cs_new:Npn \@@_format_parse_v:nN #1#2 +\cs_new:Npn \@@_format_parse_auxv:nN #1#2 { \token_if_eq_charcode:NNTF . #2 - { \@@_format_parse_vi:nwN {#1} 0 ; } - { \@@_format_parse_vii:nN { #1 { } } #2 } + { \@@_format_parse_auxvi:nwN {#1} 0 ; } + { \@@_format_parse_auxvii:nN { #1 { } } #2 } } -\cs_new:Npn \@@_format_parse_vi:nwN #1#2; #3 +\cs_new:Npn \@@_format_parse_auxvi:nwN #1#2; #3 { \@@_format_if_digit:NTF #3 - { \@@_format_parse_vi:nwN {#1} #2 #3 ; } - { \@@_format_parse_vii:nN { #1 {#2} } #3 } + { \@@_format_parse_auxvi:nwN {#1} #2 #3 ; } + { \@@_format_parse_auxvii:nN { #1 {#2} } #3 } } -\cs_new:Npn \@@_format_parse_vii:nN #1#2 +\cs_new:Npn \@@_format_parse_auxvii:nN #1#2 { \token_if_eq_meaning:NNTF \s__stop #2 { \@@_format_parse_end:nwn { #1 ? } #2 } @@ -791,7 +791,7 @@ % \end{macro} % % \begin{macro}[aux, EXP]{\@@_format_fp_e:wn} -% \begin{macro}[aux, EXP]{\@@_format_fp_e_ii:wn} +% \begin{macro}[aux, EXP]{\@@_format_fp_e_aux:wn} % With the |e| type, first filter out special cases. In the normal % case, round to |#4+1| significant figures (one before the decimal % separator, |#4| after). @@ -810,12 +810,12 @@ {3} { nan } } { - \exp_last_unbraced:Nf \@@_format_fp_e_ii:wn + \exp_last_unbraced:Nf \@@_format_fp_e_aux:wn \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2#3 ; { #4 + 1 } {#4} } } - \cs_new:Npn \@@_format_fp_e_ii:wn + \cs_new:Npn \@@_format_fp_e_aux:wn \s__fp \__fp_chk:w #1#2 #3 #4#5#6#7 ; #8 { \@@_format_put:fw { \int_eval:n { #3 - 1 } } @@ -838,7 +838,7 @@ % \end{macro} % % \begin{macro}[aux, EXP]{\@@_format_fp_f:wn} -% \begin{macro}[aux, EXP]{\@@_format_fp_f_ii:wwn} +% \begin{macro}[aux, EXP]{\@@_format_fp_f_aux:wwwn} % With the |f| type, first filter out special cases. In the normal % case, round to |#4| (absolute) decimal places. % \begin{macrocode} @@ -851,14 +851,14 @@ {3} { nan } } { - \exp_last_unbraced:Nf \@@_format_fp_f_ii:wwwn + \exp_last_unbraced:Nf \@@_format_fp_f_aux:wwwn \fp_to_decimal:n { abs ( round ( \s__fp \__fp_chk:w #1#2#3 ; , #4 ) ) } . . ; {#4} } } -\cs_new:Npn \@@_format_fp_f_ii:wwwn #1 . #2 . #3 ; #4 +\cs_new:Npn \@@_format_fp_f_aux:wwwn #1 . #2 . #3 ; #4 { \use:nf { #1 . #2 } @@ -869,7 +869,7 @@ % \end{macro} % % \begin{macro}[aux, EXP]{\@@_format_fp_g:wn} -% \begin{macro}[aux, EXP]{\@@_format_fp_g_ii:wn} +% \begin{macro}[aux, EXP]{\@@_format_fp_g_aux:wn} % With the |g| type, first filter out special cases. In the normal % case, round to |#4| significant figures, then test the exponent: if % $-4\leq \meta{exponent} < \meta{precision}$, use the presentation @@ -889,13 +889,13 @@ {3} { nan } } { - \exp_last_unbraced:Nf \@@_format_fp_g_ii:wn + \exp_last_unbraced:Nf \@@_format_fp_g_aux:wn \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2 ; { \int_max:nn {1} {#3} } { \int_max:nn {1} {#3} } } } -\cs_new:Npn \@@_format_fp_g_ii:wn #1; #2 +\cs_new:Npn \@@_format_fp_g_aux:wn #1; #2 { \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } { \fp_to_scientific:n } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx index 7e8f00ef923..301682c64be 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: l3str.dtx 4119 2012-08-16 22:35:59Z bruno $ +\GetIdInfo$Id: l3str.dtx 4339 2012-11-24 19:16:43Z joseph $ {L3 Experimental strings} %</driver|package> %<*driver> @@ -1031,8 +1031,8 @@ % \begin{macro}[EXP]{\str_tail:N} % \begin{macro}[EXP]{\str_tail:n} % \begin{macro}[EXP]{\str_tail_ignore_spaces:n} -% \begin{macro}[EXP,aux]{\@@_tail:w} -% \begin{macro}[EXP,aux]{\@@_tail_ii:w} +% \begin{macro}[EXP,aux]{\@@_tail_auxi:w} +% \begin{macro}[EXP,aux]{\@@_tail_auxii:w} % As when fetching the head of a string, the \texttt{_ignore_spaces} % variant is similar to \cs{tl_tail:n}. The more commonly used % \cs{str_tail:n} function is a little bit more convoluted: hitting @@ -1046,17 +1046,17 @@ \cs_new_nopar:Npn \str_tail:N { \exp_args:No \str_tail:n } \cs_set:Npn \str_tail:n #1 { - \exp_after:wN \@@_tail:w + \exp_after:wN \@@_tail_auxi:w \reverse_if:N \if_charcode:w \scan_stop: \tl_to_str:n {#1} X X \q_stop } -\cs_set:Npn \@@_tail:w #1 X #2 \q_stop { \fi: #1 } +\cs_set:Npn \@@_tail_auxi:w #1 X #2 \q_stop { \fi: #1 } \cs_new:Npn \str_tail_ignore_spaces:n #1 { - \exp_after:wN \@@_tail_ii:w + \exp_after:wN \@@_tail_auxii:w \tl_to_str:n {#1} X X \q_stop } -\cs_new:Npn \@@_tail_ii:w #1 #2 X #3 \q_stop { #2 } +\cs_new:Npn \@@_tail_auxii:w #1 #2 X #3 \q_stop { #2 } % \end{macrocode} % \end{macro} % \end{macro} @@ -1066,16 +1066,16 @@ % % \begin{macro}[EXP, int]{\@@_skip_c_zero:w} % \begin{macro}[EXP, aux]{\@@_skip_loop:wNNNNNNNN} -% \begin{macro}[EXP, aux]{\@@_skip_end:w, \@@_skip_end_ii:NNNNNNNN} +% \begin{macro}[EXP, aux]{\@@_skip_end:w, \@@_skip_end:NNNNNNNN} % Removes |max(#1,0)| characters from the input stream, and then % leaves \cs{c_zero}. This should be expanded using % \cs{tex_romannumeral:D}. We remove characters $8$ at a time until % there are at most $8$ to remove. Then we do a dirty trick: the % \cs{if_case:w} construction leaves between $0$ and $8$ times the % \cs{or:} control sequence, and those \cs{or:} become arguments of -% \cs{@@_skip_end_ii:NNNNNNNN}. If the number of characters to remove +% \cs{@@_skip_end:NNNNNNNN}. If the number of characters to remove % is $6$, say, then there are two \cs{or:} left, and the $8$ arguments -% of \cs{@@_skip_end_ii:NNNNNNNN} are the two \cs{or:}, and $6$ +% of \cs{@@_skip_end:NNNNNNNN} are the two \cs{or:}, and $6$ % characters from the input stream, exactly what we wanted to % remove. Then close the \cs{if_case:w} conditional with \cs{fi:}, and % stop the initial expansion with \cs{c_zero} (see places where @@ -1095,25 +1095,25 @@ { \exp_after:wN \@@_skip_c_zero:w \int_use:N \__int_eval:w #1 - \c_eight ; } \cs_new:Npn \@@_skip_end:w #1 ; { - \exp_after:wN \@@_skip_end_ii:NNNNNNNN + \exp_after:wN \@@_skip_end:NNNNNNNN \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f: \or: \or: \or: \or: \or: \or: \or: \or: } -\cs_new:Npn \@@_skip_end_ii:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero } +\cs_new:Npn \@@_skip_end:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \c_zero } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}[EXP,int]{\@@_collect_delimit_by_q_stop:w} -% \begin{macro}[EXP,aux]{\@@_collect_loop:wn, \@@_collect_loop_ii:wnNNNNNNN} +% \begin{macro}[EXP,aux]{\@@_collect_loop:wn, \@@_collect_loop:wnNNNNNNN} % \begin{macro}[EXP,aux] -% {\@@_collect_end:wn, \@@_collect_end_ii:nnnnnnnnw} Collects +% {\@@_collect_end:wn, \@@_collect_end:nnnnnnnnw} Collects % |max(#1,0)| characters, and removes everything else until % \cs{q_stop}. This is somewhat similar to \cs{@@_skip_c_zero:w}, but % this time we can only grab $7$ characters at a time. At the end, we % use an \cs{if_case:w} trick again, so that the $8$ first arguments -% of \cs{@@_collect_end_ii:nnnnnnnnw} are some \cs{or:}, followed by +% of \cs{@@_collect_end:nnnnnnnnw} are some \cs{or:}, followed by % an \cs{fi:}, followed by |#1| characters from the input % stream. Simply leaving this in the input stream will close the % conditional properly and the \cs{or:} disappear. @@ -1127,13 +1127,13 @@ \cs_new:Npn \@@_collect_loop:wn #1 ; { \if_int_compare:w #1 > \c_seven - \exp_after:wN \@@_collect_loop_ii:wnNNNNNNN + \exp_after:wN \@@_collect_loop:wnNNNNNNN \else: \exp_after:wN \@@_collect_end:wn \fi: #1 ; } -\cs_new:Npn \@@_collect_loop_ii:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 +\cs_new:Npn \@@_collect_loop:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 { \exp_after:wN \@@_collect_loop:wn \int_use:N \__int_eval:w #1 - \c_seven ; @@ -1141,11 +1141,11 @@ } \cs_new:Npn \@@_collect_end:wn #1 ; { - \exp_after:wN \@@_collect_end_ii:nnnnnnnnw + \exp_after:wN \@@_collect_end:nnnnnnnnw \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f: \or: \or: \or: \or: \or: \or: \fi: } -\cs_new:Npn \@@_collect_end_ii:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop +\cs_new:Npn \@@_collect_end:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop { #1#2#3#4#5#6#7#8 } % \end{macrocode} % \end{macro} @@ -1217,9 +1217,9 @@ % \begin{macro}[EXP,aux] % { % \@@_substr_unsafe:nnn, -% \@@_substr_i:nN, -% \@@_substr_ii:www, -% \@@_substr_iii:nnw, +% \@@_substr:nN, +% \@@_substr:www, +% \@@_substr:nnw, % \@@_substr_normalize_range:nn % } % Sanitize the string. Then evaluate the arguments, replacing them by @@ -1242,23 +1242,23 @@ { \exp_args:No \@@_substr_unsafe:nnn { \tl_to_str:n {#1} } } \cs_new:Npn \@@_substr_unsafe:nnn #1#2#3 { - \exp_after:wN \@@_substr_ii:www + \exp_after:wN \@@_substr:www \__int_value:w \@@_count_unsafe:n {#1} \exp_after:wN ; \int_use:N \__int_eval:w #2 + \c_zero \exp_after:wN ; \int_use:N \__int_eval:w - \exp_args:Nf \@@_substr_i:nN {#3} \c_max_int ; + \exp_args:Nf \@@_substr:nN {#3} \c_max_int ; { } #1 \q_stop } -\cs_new:Npn \@@_substr_i:nN #1 #2 +\cs_new:Npn \@@_substr:nN #1 #2 { \tl_if_empty:nTF {#1} {#2} {#1} } -\cs_new:Npn \@@_substr_ii:www #1; #2; #3; +\cs_new:Npn \@@_substr:www #1; #2; #3; { - \exp_args:Nf \@@_substr_iii:nnw + \exp_args:Nf \@@_substr:nnw { \@@_substr_normalize_range:nn {#2} {#1} } { \@@_substr_normalize_range:nn {#3} {#1} } } -\cs_new:Npn \@@_substr_iii:nnw #1#2 +\cs_new:Npn \@@_substr:nnw #1#2 { \exp_after:wN \@@_collect_delimit_by_q_stop:w \int_use:N \__int_eval:w #2 + \c_one - #1 \exp_after:wN ; @@ -1647,7 +1647,7 @@ % % \begin{macro}{\str_set_convert:Nnnn, \str_gset_convert:Nnnn} % \begin{macro}[TF]{\str_set_convert:Nnnn, \str_gset_convert:Nnnn} -% \begin{macro}[aux]{\@@_convert_i:nNNnnn} +% \begin{macro}[aux]{\@@_convert:nNNnnn} % The input string is stored in \cs{g_@@_result_tl}, then we: % unescape and decode; encode and escape; exit the group and store the % result in the user's variable. The various conversion functions all @@ -1655,14 +1655,14 @@ % functions by redefining \cs{@@_if_flag_error:nnx} locally. % \begin{macrocode} \cs_new_protected_nopar:Npn \str_set_convert:Nnnn - { \@@_convert_i:nNNnnn { } \tl_set_eq:NN } + { \@@_convert:nNNnnn { } \tl_set_eq:NN } \cs_new_protected_nopar:Npn \str_gset_convert:Nnnn - { \@@_convert_i:nNNnnn { } \tl_gset_eq:NN } + { \@@_convert:nNNnnn { } \tl_gset_eq:NN } \prg_new_protected_conditional:Npnn \str_set_convert:Nnnn #1#2#3#4 { T , F , TF } { \bool_gset_false:N \g_@@_error_bool - \@@_convert_i:nNNnnn + \@@_convert:nNNnnn { \cs_set_eq:NN \@@_if_flag_error:nnx \@@_if_flag_no_error:nnx } \tl_set_eq:NN #1 {#2} {#3} {#4} \bool_if:NTF \g_@@_error_bool \prg_return_false: \prg_return_true: @@ -1671,22 +1671,22 @@ \str_gset_convert:Nnnn #1#2#3#4 { T , F , TF } { \bool_gset_false:N \g_@@_error_bool - \@@_convert_i:nNNnnn + \@@_convert:nNNnnn { \cs_set_eq:NN \@@_if_flag_error:nnx \@@_if_flag_no_error:nnx } \tl_gset_eq:NN #1 {#2} {#3} {#4} \bool_if:NTF \g_@@_error_bool \prg_return_false: \prg_return_true: } -\cs_new_protected:Npn \@@_convert_i:nNNnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_convert:nNNnnn #1#2#3#4#5#6 { \group_begin: #1 \@@_gset_other:Nn \g_@@_result_tl {#4} - \exp_after:wN \@@_convert_ii:wwwnn + \exp_after:wN \@@_convert:wwwnn \tl_to_str:n {#5} /// \q_stop { decode } { unescape } \prg_do_nothing: \@@_convert_decode_: - \exp_after:wN \@@_convert_ii:wwwnn + \exp_after:wN \@@_convert:wwwnn \tl_to_str:n {#6} /// \q_stop { encode } { escape } \use_ii_i:nn @@ -1699,11 +1699,11 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_convert_ii:wwwnn} -% \begin{macro}[aux]{\@@_convert_iii:NNnNN} -% The task of \cs{@@_convert_ii:wwwnn} is to split +% \begin{macro}[aux]{\@@_convert:wwwnn} +% \begin{macro}[aux]{\@@_convert:NNnNN} +% The task of \cs{@@_convert:wwwnn} is to split % \meta{encoding}/\meta{escaping} pairs into their components, |#1| -% and |#2|. Calls to \cs{@@_convert_iv:nnn} ensure that the +% and |#2|. Calls to \cs{@@_convert:nnn} ensure that the % corresponding conversion functions are defined. The third auxiliary % does the main work. % \begin{itemize} @@ -1723,15 +1723,15 @@ % (native), then the escaping should be ignored, with an error if any % was given, and only the encoding, |#1|, should be performed. % \begin{macrocode} -\cs_new_protected:Npn \@@_convert_ii:wwwnn +\cs_new_protected:Npn \@@_convert:wwwnn #1 / #2 // #3 \q_stop #4#5 { - \@@_convert_iv:nnn {enc} {#4} {#1} - \@@_convert_iv:nnn {esc} {#5} {#2} - \exp_args:Ncc \@@_convert_iii:NNnNN + \@@_convert:nnn {enc} {#4} {#1} + \@@_convert:nnn {esc} {#5} {#2} + \exp_args:Ncc \@@_convert:NNnNN { @@_convert_#4_#1: } { @@_convert_#5_#2: } {#2} } -\cs_new_protected:Npn \@@_convert_iii:NNnNN #1#2#3#4#5 +\cs_new_protected:Npn \@@_convert:NNnNN #1#2#3#4#5 { \if_meaning:w #1 #5 \tl_if_empty:nF {#3} @@ -1745,15 +1745,15 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_convert_iv:nnn} -% \begin{macro}[aux]{\@@_convert_v:nnnn} -% The arguments of \cs{@@_convert_iv:nnn} are: \texttt{enc} or +% \begin{macro}[aux]{\@@_convert:nnn} +% \begin{macro}[aux]{\@@_convert:nnnn} +% The arguments of \cs{@@_convert:nnn} are: \texttt{enc} or % \texttt{esc}, used to build filenames, the type of the conversion % (unescape, decode, encode, escape), and the encoding or escaping % name. If the function is already defined, no need to do anything. % Otherwise, filter out all non-alphanumerics in the name, and % lowercase it. Feed that, and the same three arguments, to -% \cs{@@_convert_v:nnnn}. The task is then to make sure that the +% \cs{@@_convert:nnnn}. The task is then to make sure that the % conversion function |#3_#1| corresponding to the type |#3| and % filtered name |#1| is defined, then set our initial conversion % function |#3_#4| equal to that. @@ -1781,16 +1781,16 @@ % from the \cs{l_@@_internal_tl}-based function: we mustn't clobber % that different definition. % \begin{macrocode} -\cs_new_protected:Npn \@@_convert_iv:nnn #1#2#3 +\cs_new_protected:Npn \@@_convert:nnn #1#2#3 { \cs_if_exist:cF { @@_convert_#2_#3: } { - \exp_args:Nx \@@_convert_v:nnnn + \exp_args:Nx \@@_convert:nnnn { \@@_convert_lowercase_alphanum:n {#3} } {#1} {#2} {#3} } } -\cs_new_protected:Npn \@@_convert_v:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_convert:nnnn #1#2#3#4 { \cs_if_exist:cF { @@_convert_#3_#1: } { @@ -2317,8 +2317,8 @@ % \subsubsection{Unescape methods} % % \begin{macro}[int]{\@@_convert_unescape_hex:} -% \begin{macro}[aux, rEXP]{\@@_unescape_hex_i:N} -% \begin{macro}[aux, rEXP]{\@@_unescape_hex_ii:N} +% \begin{macro}[aux, rEXP]{\@@_unescape_hex_auxi:N} +% \begin{macro}[aux, rEXP]{\@@_unescape_hex_auxii:N} % Take chars two by two, and interpret each pair as the hexadecimal % code for a byte. Anything else than hexadecimal digits is ignored, % raising the flag. A string which contains an odd number of @@ -2334,7 +2334,7 @@ \tl_gset:Nx \g_@@_result_tl { \@@_output_byte:w " - \exp_last_unbraced:Nf \@@_unescape_hex_i:N + \exp_last_unbraced:Nf \@@_unescape_hex_auxi:N { \tl_to_str:N \g_@@_result_tl } 0 { ? 0 - \c_one \__prg_break: } \__prg_break_point: @@ -2343,27 +2343,27 @@ \@@_if_flag_error:nnx { str_error } { unescape-hex } { } \group_end: } -\cs_new:Npn \@@_unescape_hex_i:N #1 +\cs_new:Npn \@@_unescape_hex_auxi:N #1 { \use_none:n #1 \@@_hexadecimal_use:NTF #1 - { \@@_unescape_hex_ii:N } + { \@@_unescape_hex_auxii:N } { \flag_raise:n { str_error } - \@@_unescape_hex_i:N + \@@_unescape_hex_auxi:N } } -\cs_new:Npn \@@_unescape_hex_ii:N #1 +\cs_new:Npn \@@_unescape_hex_auxii:N #1 { \use_none:n #1 \@@_hexadecimal_use:NTF #1 { \@@_output_end: - \@@_output_byte:w " \@@_unescape_hex_i:N + \@@_output_byte:w " \@@_unescape_hex_auxi:N } { \flag_raise:n { str_error } - \@@_unescape_hex_ii:N + \@@_unescape_hex_auxii:N } } \__msg_kernel_new:nnnn { str } { unescape-hex } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx index b6d28da057f..4ceef260a99 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx @@ -388,8 +388,8 @@ \group_begin: \group_align_safe_begin: \@@_setup:n {#1} - \@@_i:n {#1} - \@@_ii:n {#1} + \@@_a:n {#1} + \@@_b:n {#1} \group_align_safe_end: \group_end: } @@ -467,34 +467,34 @@ % \cs{str_tail:n} \Arg{token} is non-empty, because the % escape character is printable. % -% \begin{macro}[int]{\@@_i:n} +% \begin{macro}[int]{\@@_a:n} % We read tokens one by one using \tn{futurelet}. % While performing the loop, we keep track of the number of % true begin-group characters minus the number of % true end-group characters in \cs{l_@@_nesting_int}. % This reaches $-1$ when we read the closing brace. % \begin{macrocode} -\cs_new_protected:Npn \@@_i:n #1 +\cs_new_protected:Npn \@@_a:n #1 { \int_set:Nn \tex_escapechar:D { 92 } \int_zero:N \l_@@_normal_int \int_zero:N \l_@@_index_int \int_zero:N \l_@@_nesting_int - \if_false: { \fi: \@@_i_loop:w #1 } + \if_false: { \fi: \@@_a_loop:w #1 } \int_decr:N \l_@@_index_int } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_i_loop:w} +% \begin{macro}[int]{\@@_a_loop:w} % Read one character and check its type. % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_i_loop:w - { \tex_futurelet:D \l_@@_token \@@_i_type:w } +\cs_new_protected_nopar:Npn \@@_a_loop:w + { \tex_futurelet:D \l_@@_token \@@_a_type:w } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_i_type:w} +% \begin{macro}[int]{\@@_a_type:w} % At this point, \cs{l_@@_token} holds the meaning % of the following token. We store in \cs{l_@@_type_int} % the meaning of the token ahead: @@ -511,7 +511,7 @@ % over \cs{l_@@_token} if it matches with one of the % character tokens (hence is not a primitive conditional). % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_i_type:w +\cs_new_protected_nopar:Npn \@@_a_type:w { \l_@@_type_int = \if_meaning:w \l_@@_token \c_space_token @@ -528,25 +528,25 @@ \fi: \fi: \if_case:w \l_@@_type_int - \exp_after:wN \@@_i_space:w - \or: \exp_after:wN \@@_i_bgroup:w - \or: \exp_after:wN \@@_i_safe:N - \else: \exp_after:wN \@@_i_egroup:w + \exp_after:wN \@@_a_space:w + \or: \exp_after:wN \@@_a_bgroup:w + \or: \exp_after:wN \@@_a_safe:N + \else: \exp_after:wN \@@_a_egroup:w \fi: } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_i_space:w} -% \begin{macro}[aux]{\@@_i_space_test:w} +% \begin{macro}[int]{\@@_a_space:w} +% \begin{macro}[aux]{\@@_a_space_test:w} % In this branch, the following token's meaning is a blank space. % Apply \tn{string} to that token: if it is a control sequence % the result starts with the escape character; otherwise it is % a true blank space, whose string representation is also a blank space. -% We test for that in \cs{@@_i_space_test:w}, +% We test for that in \cs{@@_a_space_test:w}, % after grabbing as \cs{l_@@_char_token} the first character % of the string representation. -% Also, since \cs{@@_i_store:} expects the special token to be +% Also, since \cs{@@_a_store:} expects the special token to be % stored in the relevant \tn{toks} register, we do that. The extra % \cs{exp_not:n} is unnecessary of course, but it makes the treatment % of all tokens more homogeneous. @@ -559,30 +559,30 @@ % so that the second pass does not need to test the meaning of tokens, % only strings. % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_i_space:w +\cs_new_protected_nopar:Npn \@@_a_space:w { - \tex_afterassignment:D \@@_i_space_test:w + \tex_afterassignment:D \@@_a_space_test:w \exp_after:wN \cs_set_eq:NN \exp_after:wN \l_@@_char_token \token_to_str:N } -\cs_new_protected_nopar:Npn \@@_i_space_test:w +\cs_new_protected_nopar:Npn \@@_a_space_test:w { \if_meaning:w \l_@@_char_token \c_space_token \tex_toks:D \l_@@_index_int { \exp_not:n { ~ } } - \@@_i_store: + \@@_a_store: \else: \int_incr:N \l_@@_normal_int \fi: - \@@_i_loop:w + \@@_a_loop:w } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_i_bgroup:w, \@@_i_egroup:w} -% \begin{macro}[aux]{\@@_i_group:nw} -% \begin{macro}[aux]{\@@_i_group_test:w} +% \begin{macro}[int]{\@@_a_bgroup:w, \@@_a_egroup:w} +% \begin{macro}[aux]{\@@_a_group:nw} +% \begin{macro}[aux]{\@@_a_group_test:w} % The token might be either a true character token with % catcode $1$ or $2$, or it could be a control sequence. % The only tricky case is if the character code happens @@ -598,40 +598,40 @@ \group_begin: \char_set_catcode_group_begin:N \^^@ \char_set_catcode_group_end:N \^^E - \cs_new_protected_nopar:Npn \@@_i_bgroup:w - { \@@_i_group:nw { \exp_after:wN ^^@ \if_false: ^^E \fi: } } + \cs_new_protected_nopar:Npn \@@_a_bgroup:w + { \@@_a_group:nw { \exp_after:wN ^^@ \if_false: ^^E \fi: } } \char_set_catcode_group_begin:N \^^B \char_set_catcode_group_end:N \^^@ - \cs_new_protected_nopar:Npn \@@_i_egroup:w - { \@@_i_group:nw { \if_false: ^^B \fi: ^^@ } } + \cs_new_protected_nopar:Npn \@@_a_egroup:w + { \@@_a_group:nw { \if_false: ^^B \fi: ^^@ } } \group_end: -\cs_new_protected:Npn \@@_i_group:nw #1 +\cs_new_protected:Npn \@@_a_group:nw #1 { \tex_lccode:D \c_zero = \@@_extract_charcode: \scan_stop: \tl_to_lowercase:n { \tex_toks:D \l_@@_index_int {#1} } \if_int_compare:w \tex_lccode:D \c_zero = \tex_escapechar:D \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D } \fi: - \tex_afterassignment:D \@@_i_group_test:w + \tex_afterassignment:D \@@_a_group_test:w \exp_after:wN \cs_set_eq:NN \exp_after:wN \l_@@_char_token \token_to_str:N } -\cs_new_protected_nopar:Npn \@@_i_group_test:w +\cs_new_protected_nopar:Npn \@@_a_group_test:w { \if_charcode:w \l_@@_token \l_@@_char_token - \@@_i_store: + \@@_a_store: \else: \int_incr:N \l_@@_normal_int \fi: - \@@_i_loop:w + \@@_a_loop:w } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_i_store:} +% \begin{macro}[int]{\@@_a_store:} % This function is called each time we meet a special token; % at this point, the \tn{toks} register \cs{l_@@_index_int} % holds a token list which expands to the given special token. @@ -661,7 +661,7 @@ % Finally, we check whether we reached the last closing brace, in which % case we stop by disabling the looping function (locally). % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_i_store: +\cs_new_protected_nopar:Npn \@@_a_store: { \tex_advance:D \l_@@_nesting_int \l_@@_type_int \if_int_compare:w \tex_lccode:D \c_zero = \c_thirty_two @@ -672,14 +672,14 @@ \int_incr:N \l_@@_index_int \int_zero:N \l_@@_normal_int \if_int_compare:w \l_@@_nesting_int = \c_minus_one - \cs_set_eq:NN \@@_i_loop:w \scan_stop: + \cs_set_eq:NN \@@_a_loop:w \scan_stop: \fi: } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_i_safe:N} -% \begin{macro}[aux]{\@@_i_cs:ww} +% \begin{macro}[int]{\@@_a_safe:N} +% \begin{macro}[aux]{\@@_a_cs:ww} % This should be the simplest case: since the upcoming token is safe, % we can simply grab it in a second pass. However, other branches of % the code must pass their tokens through \tn{string}, hence we do it @@ -698,7 +698,7 @@ % all characters after the last space should be counted in the % following sequence of \enquote{normal} tokens. % \begin{macrocode} -\cs_new_protected:Npn \@@_i_safe:N #1 +\cs_new_protected:Npn \@@_a_safe:N #1 { \if_charcode:w \scan_stop: @@ -706,11 +706,11 @@ \scan_stop: \int_incr:N \l_@@_normal_int \else: - \@@_cs_space_count:NN \@@_i_cs:ww #1 + \@@_cs_space_count:NN \@@_a_cs:ww #1 \fi: - \@@_i_loop:w + \@@_a_loop:w } -\cs_new_protected:Npn \@@_i_cs:ww #1; #2; +\cs_new_protected:Npn \@@_a_cs:ww #1; #2; { \if_int_compare:w #1 > \c_zero \tex_skip:D \l_@@_index_int @@ -731,32 +731,32 @@ % All the necessary information is stored in \tn{skip} % and \tn{toks} registers. % -% \begin{macro}[int]{\@@_ii:n} -% \begin{macro}[int, EXP]{\@@_ii_loop:w} +% \begin{macro}[int]{\@@_b:n} +% \begin{macro}[int, EXP]{\@@_b_loop:w} % Start the loop with the index $0$. No need for an end-marker: % the loop will stop by itself when the last index is read. % We will repeatedly oscillate between reading long stretches % of normal tokens, and reading special tokens. % \begin{macrocode} -\cs_new_protected:Npn \@@_ii:n #1 +\cs_new_protected:Npn \@@_b:n #1 { \tl_gset:Nx \g_@@_result_tl { - \@@_ii_loop:w 0; #1 + \@@_b_loop:w 0; #1 \__prg_break_point: } } -\cs_new:Npn \@@_ii_loop:w #1; +\cs_new:Npn \@@_b_loop:w #1; { - \exp_after:wN \@@_ii_normals:ww + \exp_after:wN \@@_b_normals:ww \__int_value:w \tex_skip:D #1 ; #1 ; } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_ii_normals:ww} -% \begin{macro}[aux, EXP]{\@@_ii_normal:wwN} +% \begin{macro}[int, EXP]{\@@_b_normals:ww} +% \begin{macro}[aux, EXP]{\@@_b_normal:wwN} % The first argument is the number of normal tokens which remain % to be read, and the second argument is the index in the array % produced in the first step. @@ -768,23 +768,23 @@ % rather than \cs{exp_not:N} because |#3| could be \cs{s__tl}, % hence must be hidden behind braces in the result. % \begin{macrocode} -\cs_new:Npn \@@_ii_normals:ww #1; +\cs_new:Npn \@@_b_normals:ww #1; { \if_int_compare:w #1 = \c_zero - \@@_ii_special:w + \@@_b_special:w \fi: - \@@_ii_normal:wwN #1; + \@@_b_normal:wwN #1; } -\cs_new:Npn \@@_ii_normal:wwN #1; #2; #3 +\cs_new:Npn \@@_b_normal:wwN #1; #2; #3 { \exp_not:n { \exp_not:n { #3 } } \s__tl \if_charcode:w \scan_stop: \exp_after:wN \use_none:n \token_to_str:N #3 \prg_do_nothing: \scan_stop: - \exp_after:wN \@@_ii_char:Nww + \exp_after:wN \@@_b_char:Nww \else: - \exp_after:wN \@@_ii_cs:Nww + \exp_after:wN \@@_b_cs:Nww \fi: #3 #1; #2; } @@ -792,10 +792,10 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_ii_char:Nww} +% \begin{macro}[int, EXP]{\@@_b_char:Nww} % If the normal token we grab is a character, leave % \meta{catcode} \meta{charcode} followed by \cs{s__tl} -% in the input stream, and call \cs{@@_ii_normals:ww} +% in the input stream, and call \cs{@@_b_normals:ww} % with its first argument decremented. % \begin{macrocode} \group_begin: @@ -805,7 +805,7 @@ \char_set_uccode:nn { `? } { `D } \tl_to_uppercase:n { - \cs_new:Npn \@@_ii_char:Nww #1 + \cs_new:Npn \@@_b_char:Nww #1 { \if_meaning:w #1 \c_undefined:D ? \else: \if_catcode:w #1 \c_catcode_other_token C \else: @@ -818,7 +818,7 @@ 6 \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: \__int_value:w `#1 \s__tl - \exp_after:wN \@@_ii_normals:ww + \exp_after:wN \@@_b_normals:ww \int_use:N \__int_eval:w \c_minus_one + } } @@ -826,21 +826,21 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_ii_cs:Nww} -% \begin{macro}[aux, EXP]{\@@_ii_cs_test:ww} +% \begin{macro}[int, EXP]{\@@_b_cs:Nww} +% \begin{macro}[aux, EXP]{\@@_b_cs_test:ww} % If the token we grab is a control sequence, leave % |0 -1| (as category code and character code) in the input stream, % followed by \cs{s__tl}, -% and call \cs{@@_ii_normals:ww} with updated arguments. +% and call \cs{@@_b_normals:ww} with updated arguments. % \begin{macrocode} -\cs_new:Npn \@@_ii_cs:Nww #1 +\cs_new:Npn \@@_b_cs:Nww #1 { 0 -1 \s__tl - \@@_cs_space_count:NN \@@_ii_cs_test:ww #1 + \@@_cs_space_count:NN \@@_b_cs_test:ww #1 } -\cs_new:Npn \@@_ii_cs_test:ww #1 ; #2 ; #3 ; #4 ; +\cs_new:Npn \@@_b_cs_test:ww #1 ; #2 ; #3 ; #4 ; { - \exp_after:wN \@@_ii_normals:ww + \exp_after:wN \@@_b_normals:ww \int_use:N \__int_eval:w \if_int_compare:w #1 = \c_zero #3 @@ -855,9 +855,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int, EXP]{\@@_ii_special:w} -% \begin{macro}[aux, EXP]{\@@_ii_special_char:wN} -% \begin{macro}[aux, EXP]{\@@_ii_special_space:w} +% \begin{macro}[int, EXP]{\@@_b_special:w} +% \begin{macro}[aux, EXP]{\@@_b_special_char:wN} +% \begin{macro}[aux, EXP]{\@@_b_special_space:w} % Here, |#1| is the current index in the array built in the first pass. % Check now whether we reached the end (we shouldn't keep the trailing % end-group character that marked the end of the token list in the @@ -865,12 +865,12 @@ % Unpack the \tn{toks} register: when \texttt{x}-expanding again, % we will get the special token. % Then leave the category code in the input stream, followed by -% the character code, and call \cs{@@_ii_loop:w} with the next index. +% the character code, and call \cs{@@_b_loop:w} with the next index. % \begin{macrocode} \group_begin: \char_set_catcode_other:N A - \cs_new:Npn \@@_ii_special:w - \fi: \@@_ii_normal:wwN 0 ; #1 ; + \cs_new:Npn \@@_b_special:w + \fi: \@@_b_normal:wwN 0 ; #1 ; { \fi: \if_int_compare:w #1 = \l_@@_index_int @@ -884,23 +884,23 @@ \else: 2 \fi: \if_int_odd:w \etex_gluestretch:D \tex_skip:D #1 \exp_stop_f: - \exp_after:wN \@@_ii_special_char:wN \int_use:N + \exp_after:wN \@@_b_special_char:wN \int_use:N \else: - \exp_after:wN \@@_ii_special_space:w \int_use:N + \exp_after:wN \@@_b_special_space:w \int_use:N \fi: \__int_eval:w \c_one + #1 \exp_after:wN ; \token_to_str:N } \group_end: -\cs_new:Npn \@@_ii_special_char:wN #1 ; #2 +\cs_new:Npn \@@_b_special_char:wN #1 ; #2 { \__int_value:w `#2 \s__tl - \@@_ii_loop:w #1 ; + \@@_b_loop:w #1 ; } -\cs_new:Npn \@@_ii_special_space:w #1 ; ~ +\cs_new:Npn \@@_b_special_space:w #1 ; ~ { 32 \s__tl - \@@_ii_loop:w #1 ; + \@@_b_loop:w #1 ; } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index 33d957e4b3f..e2407f043a7 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{xparse} -\GetIdInfo$Id: l3galley.dtx 4155 2012-08-29 10:29:58Z joseph $ +\GetIdInfo$Id: l3galley.dtx 4388 2012-12-20 22:15:35Z joseph $ {L3 Experimental galley code} %</driver|package> %<*driver> @@ -150,7 +150,7 @@ % \cs{galley_level:} % \end{syntax} % Sets up a vertical box to contain a new galley level. The box should -% be \enquote{colour safe}, which is automatic for \LaTeX3 coffins but +% be \enquote{color safe}, which is automatic for \LaTeX3 coffins but % must be included manually (using \cs{color_group_begin:} and % \cs{color_group_end:}) in \enquote{raw} vertical boxes. % \end{function} @@ -210,21 +210,21 @@ % or template level. % \end{variable} % -% \begin{function}{\galley_set_user_penalty:n} +% \begin{function}{\galley_penalty_set_single:n} % \begin{syntax} -% \cs{galley_set_user_penalty:n} \Arg{penalty} +% \cs{galley_penalty_set_single:n} \Arg{penalty} % \end{syntax} % Sets the \meta{penalty} for a break between the current and next % paragraph on a one-off basis. This function is intended for user-level % adjustments to design, and takes precedent over both settings from -% \cs{galley_set_penalty:n} and from \cs{galley_no_break_next:}. +% \cs{l_galley_interpar_penalty_int} and from \cs{galley_no_break_next:}. % \end{function} % -% \begin{function}{\galley_set_user_vspace:n} +% \begin{function}{\galley_vspace_set_single:n} % \begin{syntax} -% \cs{galley_set_user_vspace:n} \Arg{space} +% \cs{galley_vspace_set_single:n} \Arg{space} % \end{syntax} -% Sets the \meta{space} f to be inserted between the current and next +% Sets the \meta{space} to be inserted between the current and next % paragraph on a one-off basis. This function is intended for user-level % adjustments to design, and otherwise is analogous to % \cs{galley_set_vspace:n}. @@ -234,14 +234,14 @@ % % \begin{function} % { -% \galley_parshape_multi_par:nnnN, -% \galley_parshape_multi_par:nVVN, -% \galley_parshape_single_par:nnnN, -% \galley_parshape_single_par:nVVN +% \galley_parshape_set_multi:nnnN, +% \galley_parshape_set_multi:nVVN, +% \galley_parshape_set_single:nnnN, +% \galley_parshape_set_single:nVVN % } % \begin{syntax} -% \cs{galley_parshape_multi_par:nnnN} \Arg{unaltered lines} \Arg{left indents} \Arg{right indents} \meta{resume flag} -% \cs{galley_parshape_single_par:nnnN} \Arg{unaltered lines} \Arg{left indents} \Arg{right indents} \meta{resume flag} +% \cs{galley_parshape_set_multi:nnnN} \Arg{unaltered lines} \Arg{left indents} \Arg{right indents} \meta{resume flag} +% \cs{galley_parshape_set_single:nnnN} \Arg{unaltered lines} \Arg{left indents} \Arg{right indents} \meta{resume flag} % \end{syntax} % Sets the current paragraph shape to create an arbitrary paragraph shape. % The paragraph shape is set such that there are \meta{unaltered lines} which @@ -270,22 +270,20 @@ % % \begin{function} % { -% \galley_parshape_fixed_lines:nnn, -% \galley_parshape_fixed_lines:nVV +% \galley_cutout_left:nn, +% \galley_cutout_right:nn % } % \begin{syntax} -% \cs{galley_parshape_fixed_lines:nnn} \Arg{unaltered lines} \Arg{left indents} \Arg{right indents} +% \cs{galley_cutout_left:nn} \Arg{unaltered lines} \Arg{indents} +% \cs{galley_cutout_right:nn} \Arg{unaltered lines} \Arg{indents} % \end{syntax} -% Sets the paragraph shape to create an arbitrary paragraph shape which will -% apply to an exact number of lines. -% The paragraph shape is set such that there are \meta{unaltered lines} which -% have width and indent as set by the measure. The \enquote{altered} lines -% are then defined by the comma-separated lists of \meta{left indents} and -% \meta{right indents}. These are both indents from the edge of the measure, -% and may be negative, and should both contain the same number of items. -% The altered lines will apply to one or more paragraphs, such that the -% entire indent specification is honoured before the standard measure -% resumes. +% Adds a cutout section to the active paragraph shape, leaving +% \meta{unaltered lines} unchanged and then applying the \meta{indents} +% (a comma list). The cutout will be places on the left or right as indicated +% by the function name, and will apply to exactly the number of lines +% specified (the total of the \meta{unaltered lines} and the number of +% entries in the \meta{indents} list). Several cutouts may be applied +% sequentially: these act in an additive sense. % \end{function} % % \subsection{Formatting inside the paragraph} @@ -311,29 +309,29 @@ % Determines how the inter-word stretch is set for the last line of a % paragraph when % \begin{enumerate} -% \item The value of \cs{l_galley_par_end_skip} contains an infinite -% (\texttt{fil}) component; -% \item The values of \cs{l_galley_line_left_skip} and +% \item the value of \cs{l_galley_par_end_skip} contains an infinite +% (\texttt{fil(l)}) component; +% \item the values of \cs{l_galley_line_left_skip} and % \cs{l_galley_line_right_skip} do \emph{not} contain an infinite -% (\texttt{fil}) component. +% (\texttt{fil(l)}) component. % \end{enumerate} % Under these circumstances, \cs{l_galley_last_line_fit_int} is active, and % applies as follows: % \begin{itemize} -% \item Set to $0$, the last line of the paragraph is set with +% \item when set to $0$, the last line of the paragraph is set with % the inter-word spacing at natural width; -% \item Set to a $1000$ (or above), the inter-word spacing in the last line -% is stretched by the same factor as that applied to the penultimate +% \item when set to a $1000$ (or above), the inter-word spacing in the last +% line is stretched by the same factor as that applied to the penultimate % line; -% \item Set to $n$ between these extremes, the inter-word spacing in the -% last line is stretched by $n/1000$ times the factor used for the +% \item when set to~$n$ between these extremes, the inter-word spacing in +% the last line is stretched by $n/1000$ times the factor used for the % penultimate line. % \end{itemize} % \end{variable} % -% \begin{function}{\galley_set_interword_spacing:N} +% \begin{function}{\galley_interword_spacing_set:N} % \begin{syntax} -% \cs{galley_set_interword_spacing:N} \meta{fixed spacing bool} +% \cs{galley_interword_spacing_set:N} \meta{fixed spacing bool} % \end{syntax} % Sets the inter-word spacing used based on the values supplied by the % current font. If the \meta{fixed spacing bool} flag is \texttt{true} then @@ -424,11 +422,11 @@ % % \begin{function}{\galley_break_line:Nn} % \begin{syntax} -% \cs{galley_break_line:Nn} \meta{boolean} \Arg{dim expr} +% \cs{galley_break_line:Nn} \meta{boolean} \Arg{dimexpr} % \end{syntax} % Breaks the current line, filling the remaining space with \texttt{fil} % glue. If the \meta{boolean} is \texttt{true} then a page break is possible -% after the broken line. Vertical space as given by the \meta{dim expr} will +% after the broken line. Vertical space as given by the \meta{dimexpr} will % be inserted between the broken line and the next line. % \end{function} % @@ -457,21 +455,21 @@ % % \begin{function} % { -% \galley_set_club_penalties:n, -% \galley_set_club_penalties:V, -% \galley_set_club_penalties:v, -% \galley_set_display_club_penalties:n, -% \galley_set_display_club_penalties:V, -% \galley_set_display_club_penalties:v, -% \galley_set_display_widow_penalties:n, -% \galley_set_display_widow_penalties:V, -% \galley_set_display_widow_penalties:v, -% \galley_set_widow_penalties:n, -% \galley_set_widow_penalties:V, -% \galley_set_widow_penalties:v +% \galley_club_penalties_set:n, +% \galley_club_penalties_set:V, +% \galley_club_penalties_set:v, +% \galley_display_club_penalties_set:n, +% \galley_display_club_penalties_set:V, +% \galley_display_club_penalties_set:v, +% \galley_display_widow_penalties_set:n, +% \galley_display_widow_penalties_set:V, +% \galley_display_widow_penalties_set:v, +% \galley_widow_penalties_set:n, +% \galley_widow_penalties_set:V, +% \galley_widow_penalties_set:v % } % \begin{syntax} -% \cs{galley_set_club_penalties:n} \Arg{penalty list} +% \cs{galley_club_penalties_set:n} \Arg{penalty list} % \end{syntax} % Set the penalties for breaking lines at the beginning and end of % (partial) paragraphs. In each case, the \meta{penalty list} is a @@ -491,9 +489,9 @@ % penalty or to any \enquote{special} line penalties. % \end{function} % -% \begin{function}{\galley_set_interline_penalty:n} +% \begin{function}{\galley_interline_penalty_set:n} % \begin{syntax} -% \cs{galley_set_interline_penalty:n} \Arg{penalty} +% \cs{galley_interline_penalty_set:n} \Arg{penalty} % \end{syntax} % Sets the standard interline penalty applied between lines of a paragraph. % This value is added to any (display) club or widow penalty in force. @@ -501,11 +499,11 @@ % % \begin{function} % { -% \galley_set_interline_penalties:n, -% \galley_set_interline_penalties:V +% \galley_interline_penalties_set:n, +% \galley_interline_penalties_set:V % } % \begin{syntax} -% \cs{galley_set_interline_penalties:n} \Arg{penalty list} +% \cs{galley_interline_penalties_set:n} \Arg{penalty list} % \end{syntax} % Sets \enquote{special} interline penalties to be used in place of % the standard value, specified as a comma-separated \meta{penalty list}. @@ -524,7 +522,7 @@ % \begin{syntax} % \cs{galley_save_club_penalties:N} \Arg{comma list} % \end{syntax} -% These functions save the current value of the appropriate to the +% These functions save the current value of the appropriate penalty to the % comma list specified, within the current \TeX{} group. % \end{function} % @@ -547,9 +545,10 @@ % Token list inserted at the end of every paragraph in horizontal mode. % \end{variable} % -% \begin{variable}{\g_galley_par_after_hook_tl} +% \begin{variable}{\g_galley_par_reset_hook_tl} % Token list inserted after each paragraph. This is used for resetting -% galley parameters, and is therefore cleared after use. +% galley parameters, and is therefore cleared after use. It is inserted +% in vertical mode and must not contain horizontal mode material. % \end{variable} % % \begin{variable}{\g_galley_whatsit_next_tl} @@ -562,21 +561,30 @@ % paragraph started. % \end{variable} % -% \section{Additional effects} +% \section{Paragraphs} +% +% \begin{function}{\galley_par:} +% \begin{syntax} +% \cs{galley_par:} +% \end{syntax} +% Finalises the material collected as the last paragraph, inserts tokens +% at the start of the new paragraph, setting paragraph shape and any +% special values as required. +% \end{function} % -% \begin{function}{\@@_end_par:n} +% \begin{function}{\galley_par:n} % \begin{syntax} -% \cs{@@_end_par:n} \Arg{tokens} +% \cs{galley_par:n} \Arg{tokens} % \end{syntax} % Adds the \meta{tokens} to the material collected for the last paragraph -% before finalising the last paragraph in the usual way. This function should +% before finalising it in the usual way. This function should % therefore be the \emph{first} non-expandable entry used when a function % needs to add tokens to the preceding paragraph. % \end{function} % -% \section{Internal variables} +% \section{Information variables} % -% Some of the internal variables for the galley mechanism may be of +% Some of the variables for the galley mechanism may be of % interest to the programmer. These should all be treated as read-only % values and accessed only through the defined interfaces described above. % @@ -683,6 +691,13 @@ % % Functions or settings which are needed by the galley but perhaps also % elsewhere. +% +% \begin{macro}{\seq_map_function:Nc} +% Used to allow a mapping to choose the outcome using a passed option. +% \begin{macrocode} +\cs_generate_variant:Nn \seq_map_function:NN { Nc } +% \end{macrocode} +% \end{macro} % % The default hyphenation character should be set and hyphenation should be % enabled. @@ -691,35 +706,45 @@ \tex_defaulthyphenchar:D 45 \scan_stop: %</initex> % \end{macrocode} +% +% \subsection{Scratch variables} +% +% \begin{variable}{\l_@@_tmp_int} +% \begin{variable}{\l_@@_tmpa_seq, \l_@@_tmpb_seq} +% \begin{variable}{\l_@@_tmpa_tl} +% Used for manipulating cutouts and paragraph shapes. +% \begin{macrocode} +\int_new:N \l_@@_tmp_int +\seq_new:N \l_@@_tmpa_seq +\seq_new:N \l_@@_tmpb_seq +\tl_new:N \l_@@_tmp_tl +% \end{macrocode} +% \end{variable} +% \end{variable} +% \end{variable} % % \subsection{Galley settings} % % Settings for application by the galley respect the usual \TeX{} grouping and % so are all local variables. % -% \begin{variable} -% { -% \l_@@_parshape_left_indent_clist, -% \l_@@_parshape_right_indent_clist -% } -% \begin{variable} -% { -% \l_@@_parshape_multipar_bool, -% \l_@@_parshape_resume_std_bool, -% \l_@@_parshape_fixed_lines_bool -% } -% Setting up paragraph shape interacts with setting up the measure. The only -% way to keep things flexible is to have a rather \enquote{rich} set of data -% available. +% \begin{variable}{\l_@@_parshape_multipar_bool} +% Indicates whether the paragraph shape in use applies to one paragraph +% only or to more than one. % \begin{macrocode} -\clist_new:N \l_@@_parshape_left_indent_clist -\clist_new:N \l_@@_parshape_right_indent_clist \bool_new:N \l_@@_parshape_multipar_bool -\bool_new:N \l_@@_parshape_resume_std_bool -\bool_new:N \l_@@_parshape_fixed_lines_bool -\int_new:N \l_galley_parshape_std_lines_int % \end{macrocode} % \end{variable} +% +% \begin{variable} +% {\l_@@_parshape_left_indent_seq, \l_@@_parshape_right_indent_seq} +% Used to convert user input comma lists into sequences for mapping, and also +% to keep the information on paragraph shape available for the case where a +% cutout is also active. +% \begin{macrocode} +\seq_new:N \l_@@_parshape_left_indent_seq +\seq_new:N \l_@@_parshape_right_indent_seq +% \end{macrocode} % \end{variable} % % \begin{variable}{\l_galley_text_width_dim} @@ -786,6 +811,21 @@ \bool_new:N \l_@@_begin_level_bool % \end{macrocode} % \end{variable} +% +% \begin{variable} +% { +% \g_@@_cutout_left_seq, \l_@@_cutout_left_seq, +% \g_@@_cutout_right_seq, \l_@@_cutout_right_seq +% } +% To apply cutouts across paragraphs, they need to be tracked. The +% information has to be global, so is handled here. +% \begin{macrocode} +\seq_new:N \g_@@_cutout_left_seq +\seq_new:N \l_@@_cutout_left_seq +\seq_new:N \g_@@_cutout_right_seq +\seq_new:N \l_@@_cutout_right_seq +% \end{macrocode} +% \end{variable} % % \begin{variable} % {\g_galley_omit_next_indent_bool, \l_@@_omit_next_indent_bool} @@ -801,15 +841,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\g_@@_parshape_set_bool, \l_@@_parshape_set_bool} -% This is not a setting for paragraph shape, but rather a tracker for the -% galley system. -% \begin{macrocode} -\bool_new:N \g_@@_parshape_set_bool -\bool_new:N \l_@@_parshape_set_bool -% \end{macrocode} -% \end{variable} -% % \begin{variable}{\g_galley_no_break_next_bool, \l_@@_no_break_next_bool} % Dealing with the no-break flag is pretty much the same as the case % for the indent: this applies on a single paragraph basis. @@ -821,39 +852,46 @@ % % \begin{variable} % { -% \g_galley_par_begin_hook_tl, \l_@@_galley_par_begin_hook_tl, -% \g_galley_par_end_hook_tl, \l_@@_galley_par_end_hook_tl, +% \g_galley_par_begin_hook_tl, \l_@@_par_begin_hook_tl, +% \g_galley_par_end_hook_tl, \l_@@_par_end_hook_tl, % } % Hooks for user-level code: these are not used by the galley itself. % \begin{macrocode} \tl_new:N \g_galley_par_begin_hook_tl -\tl_new:N \l_@@_galley_par_begin_hook_tl +\tl_new:N \l_@@_par_begin_hook_tl \tl_new:N \g_galley_par_end_hook_tl -\tl_new:N \l_@@_galley_par_end_hook_tl +\tl_new:N \l_@@_par_end_hook_tl % \end{macrocode} % \end{variable} % % \begin{variable} -% {\g_galley_par_after_hook_tl, \l_@@_par_after_hook_tl} +% {\g_galley_par_reset_hook_tl, \l_@@_par_reset_hook_tl} % This one is used by the galley: it happens \enquote{after} the current % paragraph, and is used for reset purposes. % \begin{macrocode} -\tl_new:N \g_galley_par_after_hook_tl -\tl_new:N \l_@@_par_after_hook_tl +\tl_new:N \g_galley_par_reset_hook_tl +\tl_new:N \l_@@_par_reset_hook_tl % \end{macrocode} % \end{variable} % % \begin{variable} % {\g_galley_previous_par_lines_int, \l_@@_previous_par_lines_int} +% \begin{variable} +% {\g_@@_current_par_lines_int, \l_@@_current_par_lines_int} % The number of lines in the previous typeset paragraph. This is reset at % the start of the paragraph and \emph{added to} when each \cs{tex_par:D} % primitive is used: \LaTeX{} uses the primitive in places that do not end -% a (conceptual) paragraph. +% a (conceptual) paragraph. There is also a set of variables to deal with +% the current (conceptual) paragraph, so that the information can be +% build up correctly. % \begin{macrocode} \int_new:N \g_galley_previous_par_lines_int \int_new:N \l_@@_previous_par_lines_int +\int_new:N \g_@@_current_par_lines_int +\int_new:N \l_@@_current_par_lines_int % \end{macrocode} % \end{variable} +% \end{variable} % % \begin{variable}{\g_galley_restore_running_tl, \l_@@_restore_running_tl} % When a parameter is altered from the \enquote{running} value to a @@ -926,14 +964,16 @@ \cs_new_protected_nopar:Npn \@@_initialise_variables: { \bool_gset_true:N \g_@@_begin_level_bool + \seq_gclear:N \g_@@_cutout_left_seq + \seq_gclear:N \g_@@_cutout_right_seq \tl_gclear:N \g_@@_interpar_penalty_user_tl \tl_gclear:N \g_@@_interpar_vspace_user_tl \bool_gset_true:N \g_galley_omit_next_indent_bool \bool_gset_false:N \g_galley_no_break_next_bool \tl_gclear:N \g_galley_par_begin_hook_tl \tl_gclear:N \g_galley_par_end_hook_tl - \tl_gclear:N \g_galley_par_after_hook_tl - \bool_gset_false:N \g_@@_parshape_set_bool + \tl_gclear:N \g_galley_par_reset_hook_tl + \int_gzero:N \g_@@_current_par_lines_int \int_gzero:N \g_galley_previous_par_lines_int \tl_gclear:N \g_galley_restore_running_tl \tl_gclear:N \g_galley_whatsit_previous_tl @@ -963,6 +1003,10 @@ { \bool_set_eq:NN \l_@@_begin_level_bool \g_@@_begin_level_bool + \seq_set_eq:NN \l_@@_cutout_left_seq + \g_@@_cutout_left_seq + \seq_set_eq:NN \l_@@_cutout_right_seq + \g_@@_cutout_right_seq \tl_set_eq:NN \l_@@_interpar_penalty_user_tl \g_@@_interpar_penalty_user_tl \tl_set_eq:NN \l_@@_interpar_vspace_user_tl @@ -971,14 +1015,14 @@ \g_galley_omit_next_indent_bool \bool_set_eq:NN \l_@@_no_break_next_bool \g_galley_no_break_next_bool - \tl_set_eq:NN \l_@@_galley_par_begin_hook_tl + \tl_set_eq:NN \l_@@_par_begin_hook_tl \g_galley_par_begin_hook_tl - \tl_set_eq:NN \l_@@_galley_par_end_hook_tl + \tl_set_eq:NN \l_@@_par_end_hook_tl \g_galley_par_end_hook_tl - \tl_set_eq:NN \l_@@_par_after_hook_tl - \g_galley_par_after_hook_tl - \bool_set_eq:NN \l_@@_parshape_set_bool - \g_@@_parshape_set_bool + \tl_set_eq:NN \l_@@_par_reset_hook_tl + \g_galley_par_reset_hook_tl + \int_set_eq:NN \l_@@_current_par_lines_int + \g_@@_current_par_lines_int \int_set_eq:NN \l_@@_previous_par_lines_int \g_galley_previous_par_lines_int \tl_set_eq:NN \l_@@_restore_running_tl @@ -992,6 +1036,10 @@ { \bool_gset_eq:NN \g_@@_begin_level_bool \l_@@_begin_level_bool + \seq_gset_eq:NN \g_@@_cutout_left_seq + \l_@@_cutout_left_seq + \seq_gset_eq:NN \g_@@_cutout_right_seq + \l_@@_cutout_right_seq \tl_gset_eq:NN \g_@@_interpar_penalty_user_tl \l_@@_interpar_penalty_user_tl \tl_gset_eq:NN \g_@@_interpar_vspace_user_tl @@ -1001,13 +1049,13 @@ \bool_gset_eq:NN \g_galley_no_break_next_bool \l_@@_no_break_next_bool \tl_gset_eq:NN \g_galley_par_begin_hook_tl - \l_@@_galley_par_begin_hook_tl + \l_@@_par_begin_hook_tl \tl_gset_eq:NN \g_galley_par_end_hook_tl - \l_@@_galley_par_end_hook_tl - \tl_gset_eq:NN \g_galley_par_after_hook_tl - \l_@@_par_after_hook_tl - \bool_gset_eq:NN \g_@@_parshape_set_bool - \l_@@_parshape_set_bool + \l_@@_par_end_hook_tl + \tl_gset_eq:NN \g_galley_par_reset_hook_tl + \l_@@_par_reset_hook_tl + \int_gset_eq:NN \g_@@_current_par_lines_int + \l_@@_current_par_lines_int \int_gset_eq:NN \g_galley_previous_par_lines_int \l_@@_previous_par_lines_int \tl_gset_eq:NN \g_galley_restore_running_tl @@ -1040,7 +1088,7 @@ % instruction. As this code can be inserted automatically, at the point % of use only the start of a galley level needs to be marked up: the end % must come in a fixed location. All of this relies on the the -% \enquote{colour safe} group used inside a box. +% \enquote{color safe} group used inside a box. % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_level_end: { @@ -1061,60 +1109,67 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}{\@@_std_par:} -% \begin{macro}[aux]{\@@_std_par_aux_i:, \@@_std_par_aux_ii:} -% \begin{macro}[aux]{\@@_std_par_aux:N} +% \begin{macro}{\galley_par:} +% \begin{macro}[aux]{\@@_par_auxi:, \@@_par_auxii:} +% \begin{macro}[aux]{\@@_par_aux:N} % The idea here is to expand the next token in exactly the same way as \TeX{} % would do anyway. The \texttt{f}-type expansion will ignore any protection, % but will stop at a scan marker. Thus the code can test for an % \enquote{omit paragraph} marker. % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_std_par: +\cs_new_protected_nopar:Npn \galley_par: { \s__par_omit - \exp_after:wN \@@_std_par_aux_i: \tex_romannumeral:D - `0 + \exp_after:wN \@@_par_auxi: \tex_romannumeral:D - `0 } -\cs_new_protected:Npn \@@_std_par_aux_i: +\cs_new_protected:Npn \@@_par_auxi: { \peek_meaning:NTF \s__par_omit - { \@@_std_par_aux:N } - { \@@_std_par_aux_ii: } + { \@@_par_aux:N } + { \@@_par_auxii: } } -\cs_new_protected:Npn \@@_std_par_aux:N #1 +\cs_new_protected:Npn \@@_par_aux:N #1 { \str_if_eq_x:nnF {#1} { \s__par_omit } { - \@@_std_par_aux_ii: + \@@_par_auxii: #1 } } % \end{macrocode} -% No marker, so really insert a paragraph. In vertical mode, +% No marker, so really insert a paragraph: the \cs{tex_par:D} is inside a +% group to preserve some dynamic settings (for example +% \cs{etex_interlinepenalties:D}). In vertical mode, that means just +% inserting the primitive. % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_std_par_aux_ii: +\cs_new_protected_nopar:Npn \@@_par_auxii: { \mode_if_vertical:TF - { \tex_par:D } + { + \group_begin: + \tex_par:D + \group_end: + } % \end{macrocode} % In horizontal mode, the paragraph shape is set \enquote{just in time} -% before inserting \cs{tex_par:D}. The \cs{tex_par:D} is inside a -% group to preserve some dynamic settings (for example -% \cs{etex_interlinepenalties}). Once the +% before inserting \cs{tex_par:D}. Once the % paragraph has been typeset, the number of lines is \emph{added} to the % running total. It's possible that the conceptual paragraph contains % display-like material, and simply setting the number of lines equal to -% \cs{tex_prevgraf:D} would \enquote{loose} these. +% \cs{tex_prevgraf:D} would \enquote{lose} these. % \begin{macrocode} { \g_galley_par_end_hook_tl - \@@_set_measure_and_parshape: - \group_begin: + \group_begin: \tex_par:D \group_end: - \int_gadd:Nn \g_galley_previous_par_lines_int \tex_prevgraf:D + \int_gset:Nn \g_galley_previous_par_lines_int + { \tex_prevgraf:D + \g_@@_current_par_lines_int } + \@@_parshape_reset: + \int_gzero:N \g_@@_current_par_lines_int } - \g_galley_par_after_hook_tl - \tl_gclear:N \g_galley_par_after_hook_tl + \g_galley_par_reset_hook_tl + \tl_gclear:N \g_galley_par_reset_hook_tl % \end{macrocode} % The non-breaking penalty is needed here as within the \cs{tex_everypar:D} % hook there is an additional \cs{tex_par:D}. This leads to an extra @@ -1128,17 +1183,17 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\@@_end_par:n} +% \begin{macro}{\galley_par:n} % Inserts tokens such that they are appended to the end of the last % paragraph, using the paragraph-omitting system. % \begin{macrocode} -\cs_new_protected:Npn \@@_end_par:n #1 +\cs_new_protected:Npn \galley_par:n #1 { \s__par_omit \bool_if:nF \g_@@_begin_level_bool { #1 - \@@_std_par: + \galley_par: } } % \end{macrocode} @@ -1148,7 +1203,7 @@ % The meaning of the token \cs{par} itself starts off as a standard % paragraph. % \begin{macrocode} -\cs_set_protected_nopar:Npn \par { \@@_std_par: } +\cs_set_protected_nopar:Npn \par { \galley_par: } % \end{macrocode} % \end{macro} % @@ -1158,7 +1213,7 @@ % so this will only be needed in package mode. % \begin{macrocode} %<*package> -\tl_set:Nn \@par { \@@_std_par: } +\tl_set:Nn \@par { \galley_par: } %</package> % \end{macrocode} % \end{macro} @@ -1257,7 +1312,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_display_par: { - \cs_set_eq:NN \par \@@_std_par: + \cs_set_eq:NN \par \galley_par: \mode_if_vertical:TF { \par @@ -1266,11 +1321,10 @@ \@@_display_vspace:N \l_galley_display_end_par_vspace_tl } { - \@@_set_measure_and_parshape: \group_begin: \tex_par:D \group_end: - \int_gadd:Nn \g_galley_previous_par_lines_int \tex_prevgraf:D + \int_gadd:Nn \g_@@_current_par_lines_int \tex_prevgraf:D \@@_display_penalty:N \l_galley_display_end_penalty_tl \@@_display_vspace:N \l_galley_display_end_vspace_tl } @@ -1363,7 +1417,6 @@ \tex_everypar:D { } \tex_noindent:D \group_end: - \int_gzero:N \g_galley_previous_par_lines_int \@@_insert_horizontal_items: \@@_restore_running_parameters: } @@ -1475,14 +1528,27 @@ % \end{macro} % % \subsection{Measure} +% +% \begin{variable}{\l_@@_total_left_margin_dim, \l_@@_total_right_margin_dim} +% Used to set the measure, first by providing a place to save the existing +% values, then allowing calculation of the difference between old and new +% settings. +% \begin{macrocode} +\dim_new:N \l_@@_total_left_margin_dim +\dim_new:N \l_@@_total_right_margin_dim +% \end{macrocode} +% \end{variable} % % \begin{macro} % {\galley_margins_set_absolute:nn, \galley_margins_set_relative:nn} +% \begin{macro}[aux]{\@@_save_margins:, \@@_set_measure:} +% \begin{macro}[aux, rEXP]{\@@_set_measure_aux:n} % Setting the measure is just a question of adjusting margins, either % in a relative or absolute sense. % \begin{macrocode} \cs_new_protected:Npn \galley_margins_set_absolute:nn #1#2 { + \@@_save_margins: \dim_set:Nn \l_galley_total_left_margin_dim {#1} \dim_set:Nn \l_galley_total_right_margin_dim {#2} \dim_set:Nn \l_galley_text_width_dim @@ -1491,9 +1557,11 @@ - \l_galley_total_left_margin_dim - \l_galley_total_right_margin_dim } + \@@_set_measure: } \cs_new_protected:Npn \galley_margins_set_relative:nn #1#2 { + \@@_save_margins: \dim_add:Nn \l_galley_total_left_margin_dim {#1} \dim_add:Nn \l_galley_total_right_margin_dim {#2} \dim_set:Nn \l_galley_text_width_dim @@ -1502,205 +1570,372 @@ - \l_galley_total_left_margin_dim - \l_galley_total_right_margin_dim } + \@@_set_measure: + } +% \end{macrocode} +% Saves the previous margin state so that it can be used for calculation +% during the update. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_save_margins: + { + \dim_set_eq:NN \l_@@_total_left_margin_dim + \l_galley_total_left_margin_dim + \dim_set_eq:NN \l_@@_total_right_margin_dim + \l_galley_total_right_margin_dim + } +% \end{macrocode} +% Setting the measure first requires a quick test to see if there is any +% existing shape: if not, just use the values directly. Assuming we do need +% to allow for the existing shape, the idea is to preserve whatever shape +% has already been applied and adjust the edges. This can be done by +% iterating though the existing shape, recovering the values and applying +% the changes. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_set_measure: + { + \int_compare:nNnTF \tex_parshape:D = \c_zero + { \@@_parshape_measure: } + { + \dim_sub:Nn \l_@@_total_left_margin_dim + \l_galley_total_left_margin_dim + \dim_sub:Nn \l_@@_total_right_margin_dim + \l_galley_total_right_margin_dim + \tex_parshape:D + \tex_parshape:D + \int_step_function:nnnN + \c_one \c_one \tex_parshape:D + \@@_set_measure_aux:n + } + } +\cs_new:Npn \@@_set_measure_aux:n #1 + { + \__dim_eval:w + \etex_parshapeindent:D #1 - \l_@@_total_left_margin_dim + \__dim_eval_end: + \__dim_eval:w + \etex_parshapelength:D #1 + + \l_@@_total_left_margin_dim + \l_@@_total_right_margin_dim + \__dim_eval_end: } % \end{macrocode} % \end{macro} -% +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_parshape_reset:} +% Test for paragraph shapes to be removed: a multi-step procedure! First, +% check to see if there is a shape at all. If there is, the second check +% looks for cutouts. If there are no cutouts to worry about, the final +% check is whether the current shape applies to one paragraph or on an +% ongoing sense. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_parshape_reset: + { + \int_compare:nNnF \tex_parshape:D = \c_zero + { + \bool_if:nTF + { + \seq_if_empty_p:N \g_@@_cutout_left_seq + && \seq_if_empty_p:N \g_@@_cutout_right_seq + } + { + \bool_if:NF \l_@@_parshape_multipar_bool + { \@@_parshape_measure: } + } +% \end{macrocode} +% If there was a cutout active, the \enquote{done} part is removed from +% the tracking sequences. The \enquote{normal} paragraph shape is then +% reapplied before removing the cutout parts. This is done using separate +% loops as in general that is as easy as trying to work out all of the +% parts in advance (the same number of loops would still be needed). +% \begin{macrocode} + { + \prg_replicate:nn \g@@_previous_par_lines_int + { + \seq_gpop:NN \g_@@_cutout_left_seq \l_@@_tmp_tl + \seq_gpop:NN \g_@@_cutout_right_seq \l_@@_tmp_tl + } + \bool_if:NTF \l_@@_parshape_multipar_bool + { \@@_parshape_set: } + { \@@_parshape_measure: } + \@@_cutout_set:Nn \g_@@_cutout_left_seq { left } + \@@_cutout_set:Nn \g_@@_cutout_right_seq { right } + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_parshape_measure:} +% Sets the parshape to the full measure at the current time: used in a few +% places, so worth spinning out. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \@@_parshape_measure: + { + \tex_parshape:D + \c_one + \l_galley_total_left_margin_dim + \l_galley_text_width_dim + } +% \end{macrocode} +% \end{macro} +% % \subsection{Paragraph shape} % % \begin{macro} % { -% \galley_parshape_fixed_lines:nnn, -% \galley_parshape_fixed_lines:nVV, -% \galley_parshape_multi_par:nnnN, -% \galley_parshape_multi_par:nVVN, -% \galley_parshape_single_par:nnnN, -% \galley_parshape_single_par:nVVN +% \galley_parshape_set_multi:nnnN, +% \galley_parshape_set_multi:nVVN, +% \galley_parshape_set_single:nnnN, +% \galley_parshape_set_single:nVVN % } -% Setting the paragraph shape is easy as most of the real work is done -% later. So this is just a case of saving the various pieces of data -% to the correct locations. +% Setting the paragraph shape is mainly a question of converting the input. +% First, though, a flag is set. % \begin{macrocode} -\cs_new_protected:Npn \galley_parshape_fixed_lines:nnn #1#2#3 +\cs_new_protected_nopar:Npn \galley_parshape_set_multi:nnnN { - \bool_gset_true:N \g_@@_parshape_set_bool - \bool_set_true:N \l_@@_parshape_fixed_lines_bool - \int_set:Nn \l_galley_parshape_std_lines_int {#1} - \clist_set:Nn \l_@@_parshape_left_indent_clist {#2} - \clist_set:Nn \l_@@_parshape_right_indent_clist {#3} - \bool_set_true:N \l_@@_parshape_resume_std_bool - } -\cs_new_protected:Npn \galley_parshape_multi_par:nnnN #1#2#3#4 - { - \bool_gset_true:N \g_@@_parshape_set_bool \bool_set_true:N \l_@@_parshape_multipar_bool - \bool_set_false:N \l_@@_parshape_fixed_lines_bool - \int_set:Nn \l_galley_parshape_std_lines_int {#1} - \clist_set:Nn \l_@@_parshape_left_indent_clist {#2} - \clist_set:Nn \l_@@_parshape_right_indent_clist {#3} - \bool_set_eq:NN \l_@@_parshape_resume_std_bool #4 + \@@_parshape_set:nnnN } -\cs_new_protected:Npn \galley_parshape_single_par:nnnN #1#2#3#4 +\cs_new_protected_nopar:Npn \galley_parshape_set_single:nnnN { - \bool_gset_true:N \g_@@_parshape_set_bool \bool_set_false:N \l_@@_parshape_multipar_bool - \bool_set_false:N \l_@@_parshape_fixed_lines_bool - \int_set:Nn \l_galley_parshape_std_lines_int {#1} - \clist_set:Nn \l_@@_parshape_left_indent_clist {#2} - \clist_set:Nn \l_@@_parshape_right_indent_clist {#3} - \bool_set_eq:NN \l_@@_parshape_resume_std_bool #4 + \@@_parshape_set:nnnN } -\cs_generate_variant:Nn \galley_parshape_fixed_lines:nnn { nVV } -\cs_generate_variant:Nn \galley_parshape_multi_par:nnnN { nVV } -\cs_generate_variant:Nn \galley_parshape_single_par:nnnN { nVV } +\cs_generate_variant:Nn \galley_parshape_set_multi:nnnN { nVV } +\cs_generate_variant:Nn \galley_parshape_set_single:nnnN { nVV } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_set_measure_and_parshape:} -% To set the paragraph shape for the current paragraph, there is a check to -% see if the measure alone should be used. If not, then the shape may be -% built by paragraph or based on the number of lines required. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_set_measure_and_parshape: +% \begin{macro}[int]{\@@_parshape_set:nnnN} +% \begin{macro}[int]{\@@_parshape_set:} +% \begin{macro}[aux, rEXP]{\@@_parshape_set:nn} +% Setting the paragraph shape starts by converting the two input lists into +% sequences. The shape is then set using a mapping with allowance for the +% unaltered lines and the possibility of resuming the measure. The unaltered +% lines are added to the sequences as this information may be needed +% elsewhere (if a cutout is active), and this is the most convenient way to +% deal with it. Everything ends up stored in the two sequences for possible +% re-application if there are cutouts. +% \begin{macrocode} +\cs_new_protected:Npn \@@_parshape_set:nnnN #1#2#3#4 { - \bool_if:NTF \g_@@_parshape_set_bool + \seq_set_from_clist:Nn \l_@@_parshape_left_indent_seq {#2} + \seq_set_from_clist:Nn \l_@@_parshape_right_indent_seq {#3} + \prg_replicate:nn {#1} { - \bool_if:NTF \l_@@_parshape_fixed_lines_bool - { - \int_compare:nNnTF \g_galley_previous_par_lines_int > \c_zero - { \@@_generate_parshape_lines: } - { \@@_generate_parshape: } - } - { - \bool_gset_eq:NN \g_@@_parshape_set_bool - \l_@@_parshape_multipar_bool - \@@_generate_parshape: - } + \seq_put_left:Nn \l_@@_parshape_left_indent_seq { 0 pt } + \seq_put_left:Nn \l_@@_parshape_right_indent_seq { 0 pt } } + \bool_if:NT #4 { - \tex_global:D \tex_parshape:D - \c_one - \dim_use:N \l_galley_total_left_margin_dim - \c_space_tl - \dim_use:N \l_galley_text_width_dim - } + \seq_put_right:Nn \l_@@_parshape_left_indent_seq { 0 pt } + \seq_put_right:Nn \l_@@_parshape_right_indent_seq { 0 pt } + } + \@@_parshape_set: } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_generate_parshape:} -% \begin{macro}[aux]{\@@_set_parshape_map:nn, \@@_set_parshape_map:oo} -% \begin{macro}[aux]{\@@_set_parshape_map_aux:nw} -% For a shape to apply on a paragraph basis, the two user-supplied comma -% lists are taken and converted into left-side offsets and line lengths. -% This is all dependent on the current measure. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_generate_parshape: +\cs_new_protected_nopar:Npn \@@_parshape_set: { - \tex_global:D \tex_parshape:D + \tex_parshape:D \__int_eval:w - \l_galley_parshape_std_lines_int + - \int_min:nn - { \clist_count:N \l_@@_parshape_left_indent_clist } - { \clist_count:N \l_@@_parshape_right_indent_clist } - \bool_if:NT \l_@@_parshape_resume_std_bool { + 1 } + \int_min:nn + { \seq_count:N \l_@@_parshape_left_indent_seq } + { \seq_count:N \l_@@_parshape_right_indent_seq } \__int_eval_end: - \prg_replicate:nn \l_galley_parshape_std_lines_int - { - \dim_use:N \l_galley_total_left_margin_dim - \c_space_tl - \dim_use:N \l_galley_text_width_dim - \c_space_tl - } - \@@_set_parshape_map:oo - \l_@@_parshape_left_indent_clist - \l_@@_parshape_right_indent_clist - \bool_if:NT \l_@@_parshape_resume_std_bool - { - \c_space_tl - \dim_use:N \l_galley_total_left_margin_dim - \c_space_tl - \dim_use:N \l_galley_text_width_dim - } + \seq_mapthread_function:NNN + \l_@@_parshape_left_indent_seq + \l_@@_parshape_right_indent_seq + \@@_parshape_set:nn } -\cs_new:Npn \@@_set_parshape_map:nn #1#2 - { \@@_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop } -\cs_generate_variant:Nn \@@_set_parshape_map:nn { oo } -\cs_new:Npn \@@_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop +\cs_new:Npn \@@_parshape_set:nn #1#2 { - \bool_if:nTF { \tl_if_empty_p:n {#3} || \tl_if_empty_p:n {#5} } + \__dim_eval:w \l_galley_total_left_margin_dim + ( #1 ) \__dim_eval_end: + \__dim_eval:w + \l_galley_text_width_dim - ( ( #1 ) + ( #2 ) ) + \__dim_eval_end: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Cutouts} +% +% Cutouts are another way of looking at paragraph shapes, but apply to +% a fixed number of lines within a galley. As such, they require separate +% handling from the measure and shape. +% +% \begin{macro}{\galley_cutout_left:nn, \galley_cutout_right:nn} +% \begin{macro}[int]{\@@_cutout:nnn} +% \begin{macro}[aux]{\@@_cutout_store:nn} +% \begin{macro}[int]{\@@_cutout_set:Nn} +% \begin{macro}[aux]{\@@_cutout_left:n, \@@_cutout_right:n, \@@_cutout_end:n} +% Setting up cutouts on the two sides of the paragraph is more or less +% the same idea with one or two very specific points of difference. As such, +% the two interface functions both use the same implementation. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \galley_cutout_left:nn + { \@@_cutout:nnn { left } } +\cs_new_protected_nopar:Npn \galley_cutout_right:nn + { \@@_cutout:nnn { right } } +% \end{macrocode} +% The approach in the main function is first to construct a single sequence +% which contains details of all of the altered lines. This sequence is then +% used by \cs{@@_cutout_set:Nn}, which actually applies the cutout to the +% current paragraph shape. One that is done, information on the cutout just +% applied is merged with the global cutout store: this needs to allow for +% different cutout lengths. The best way to do that is to loop over whichever +% list is longer, build a new list of the result and the copy this back to +% the store. +% \begin{macrocode} +\cs_new_protected:Npn \@@_cutout:nnn #1#2#3 + { + \seq_set_from_clist:Nn \l_@@_tmpa_seq {#3} + \prg_replicate:nn {#2} + { \seq_put_left:Nn \l_@@_tmpa_seq { 0 pt } } + \@@_cutout_set:Nn \l_@@_tmpa_seq {#1} + \seq_clear:N \l_@@_tmpb_seq + \int_compare:nNnTF + { \seq_count:N \l_@@_tmpa_seq } > + { \seq_count:c { g_@@_cutout_ #1 _ seq } } { - #1 - \dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) } - \c_space_tl - \dim_eval:n { \l_galley_text_width_dim - ( ( #2 ) + ( #4 ) ) } + \seq_map_inline:Nn \l_@@_tmpa_seq + { + \@@_cutout_store:nn + { \seq_gpop:cNF { g_@@_cutout_ #1 _ seq } } + {##1} + } } { - \@@_set_parshape_map_aux:nw - { - #1 - \dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) } - \c_space_tl - \dim_eval:n { \l_galley_text_width_dim - ( ( #2 ) + ( #4 ) ) } - \c_space_tl + \seq_map_inline:cn { g_@@_cutout_ #1 _ seq } + { + \@@_cutout_store:nn + { \seq_pop:NNF \l_@@_tmpa_seq } + {##1} } - #3 \q_mark #5 \q_stop } + \seq_gset_eq:cN { g_@@_cutout_ #1 _ seq } \l_@@_tmpb_seq + } +\cs_new_protected:Npn \@@_cutout_store:nn #1#2 + { + #1 \l_@@_tmp_tl + { \tl_set:Nn \l_@@_tmp_tl { 0 pt } } + \seq_put_right:Nx \l_@@_tmpb_seq + { \dim_eval:n { \l_@@_tmp_tl + #2 } } } % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}[int]{\@@_generate_parshape_lines:} -% \begin{macro}[aux]{\@@_generate_parshape_lines:n} -% The idea here is to construct a paragraph shape based on the remaining -% lines from the shape in the previous paragraph. If the previous paragraph -% was sufficiently long, then life is \enquote{back to normal} and the -% standard shape is set. If a special shape is needed, this is recovered -% from the paragraph shape using the \eTeX{} primitives. +% Actually applying a cutout is done by using the sequence containing the +% cutout shape plus the current paragraph shape to construct a token list +% of the required indents and line lengths. That is done in a +% non-expansion way to allow for the two different kinds of mapping (to the +% sequence and to the parshape). At the end of the process, there is a need +% to allow for the last line of \tn{parshape}: depending on any existing +% shape and the length of the cutout, this might be the measure or a +% repeat of the last values in the shape. % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_generate_parshape_lines: +\cs_new_protected:Npn \@@_cutout_set:Nn #1#2 { - \int_compare:nNnTF \tex_parshape:D > \g_galley_previous_par_lines_int + \int_zero:N \l_@@_tmp_int + \tl_clear:N \l_@@_tmp_tl + \seq_map_function:Nc #1 { _@@_cutout_ #2 :n } + \int_compare:nNnTF \tex_parshape:D > \l_@@_tmp_int { - \tex_global:D \tex_parshape:D - \__int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int - \__int_eval_end: - \int_step_function:nnnN - { \g_galley_previous_par_lines_int + \c_one } - \c_one \tex_parshape:D \@@_generate_parshape_lines:n + \int_step_function:nnnN + { \l_@@_tmp_int + \c_one } + \c_one + \tex_parshape:D + \@@_cutout_end:n } { - \bool_gset_false:N \g_@@_parshape_set_bool - \tex_global:D \tex_parshape:D - \c_one - \dim_use:N \l_galley_total_left_margin_dim - \c_space_tl - \dim_use:N \l_galley_text_width_dim + \int_incr:N \l_@@_tmp_int + \int_compare:nNnTF \tex_parshape:D = \c_zero + { + \tl_put_right:Nn \l_@@_tmp_tl + { \l@@_total_left_margin_dim \l@@_text_width_dim } + } + { + \tl_put_right:Nx \l_@@_tmp_tl + { + \dim_eval:n { \etex_parshapeindent:D \tex_parshape:D } + \c_space_tl + \dim_eval:n { \etex_parshapelength:D \tex_parshape:D } + \c_space_tl + } + } + } + \tex_parshape:D + \l_@@_tmp_int + \l_@@_tmp_tl + } +% \end{macrocode} +% The only place where the position of the cutout matters is in working out +% the indent and line lengths. That's achieved using two separate auxiliaries +% and selection by name. +% \begin{macrocode} +\cs_new_protected:Npn \@@_cutout_left:n #1 + { + \int_incr:N \l_@@_tmp_int + \tl_put_right:Nx \l_@@_tmp_tl + { + \int_compare:nNnTF \l_@@_tmp_int > \tex_parshape:D + { + \dim_eval:n { \l@@_total_left_margin_dim + ( #1 ) } + \c_space_tl + \dim_eval:n { \l@@_text_width_dim - ( #1 ) } + \c_space_tl + } + { + \dim_eval:n { \etex_parshapeindent:D \l_@@_tmp_int + ( #1 ) } + \c_space_tl + \dim_eval:n { \etex_parshapelength:D \l_@@_tmp_int - ( #1 ) } + \c_space_tl + } } } -\cs_new:Npn \@@_generate_parshape_lines:n #1 +\cs_new_protected:Npn \@@_cutout_right:n #1 { - \etex_parshapeindent:D #1 - ~ - \etex_parshapelength:D #1 + \int_incr:N \l_@@_tmp_int + \tl_put_right:Nx \l_@@_tmp_tl + { + \dim_eval:n { \etex_parshapeindent:D \l_@@_tmp_int } + \c_space_tl + \dim_eval:n { \etex_parshapelength:D \l_@@_tmp_int - ( #1 ) } + \c_space_tl + } } % \end{macrocode} +% An auxiliary to \enquote{recycle} the paragraph shape which is already +% active \emph{if} the cutout is shorter. +% \begin{macrocode} +\cs_new_protected:Npn \@@_cutout_end:n #1 + { + \int_incr:N \l_@@_tmp_int + \tl_put_right:Nx \l_@@_tmp_tl + { + \dim_eval:n { \etex_parshapeindent:D #1 } + \c_space_tl + \dim_eval:n { \etex_parshapelength:D #1 } + \c_space_tl + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % \end{macro} % \end{macro} % % \subsection{Between paragraphs} % -% \begin{macro}{\galley_set_user_penalty:n, \galley_set_user_vspace:n} +% \begin{macro}{\galley_penalty_set_single:n, \galley_vspace_set_single:n} % User supplied penalties and spaces only apply for a single paragraph. % In both cases, the input values need to be checked for the correct % form but are stored as token lists. The \texttt{x}-type expansion % deals with this nicely. % \begin{macrocode} -\cs_new_protected:Npn \galley_set_user_penalty:n #1 +\cs_new_protected:Npn \galley_penalty_set_single:n #1 { \tl_gset:Nx \g_@@_interpar_penalty_user_tl { \int_eval:n {#1} } } -\cs_new_protected:Npn \galley_set_user_vspace:n #1 +\cs_new_protected:Npn \galley_vspace_set_single:n #1 { \tl_gset:Nx \g_@@_interpar_vspace_user_tl { \skip_eval:n {#1} } } % \end{macrocode} % \end{macro} @@ -1757,7 +1992,7 @@ % specified by the font designer and not to use arbitrary values % (\emph{cf.}~the approach in \emph{The \TeX{}book}, p.~101). % -% \begin{macro}{\galley_set_interword_spacing:N} +% \begin{macro}{\galley_interword_spacing_set:N} % The approach taken to setting a fixed space is to use the information % from the current font to set the spacing. This means that only % \cs{tex_spacefactor:D} needs to be set, while \cs{tex_xspacefactor:D} @@ -1769,7 +2004,7 @@ % (non-zero \cs{tex_fontdimen:D} \texttt{3}), then the \cs{teX_spaceskip:D} % is set to the fixed component from the font. % \begin{macrocode} -\cs_new_protected:Npn \galley_set_interword_spacing:N #1 +\cs_new_protected:Npn \galley_interword_spacing_set:N #1 { \bool_if:NTF #1 { % TODO Hook for font changes required! @@ -1832,7 +2067,7 @@ % Terminating a line early without a new paragraph requires a few steps. % First, any skips are removed, then any additional space to add is % places on the surrounding vertical list. Finally, the current line -% is ended, using a penalty to prevents an overful line ending |\\| giving +% is ended, using a penalty to prevents an overfull line ending |\\| giving % a totally-blank one in the output. The boolean argument is used to indicate % that a break is allowed after the blank line. % \begin{macrocode} @@ -1889,14 +2124,14 @@ % % \begin{macro} % { -% \galley_set_display_widow_penalties:n, -% \galley_set_display_widow_penalties:V, -% \galley_set_display_widow_penalties:v, -% \galley_set_widow_penalties:n, -% \galley_set_widow_penalties:V, -% \galley_set_widow_penalties:v +% \galley_display_widow_penalties_set:n, +% \galley_display_widow_penalties_set:V, +% \galley_display_widow_penalties_set:v, +% \galley_widow_penalties_set:n, +% \galley_widow_penalties_set:V, +% \galley_widow_penalties_set:v % } -% \begin{macro}[aux]{\galley_set_aux:n} +% \begin{macro}[aux]{\@@_set_aux:n} % By far the easiest penalties to deal with are those for widows. These % work exactly as the names imply, with the display version only used % immediately before display math, and the standard penalty used at the end @@ -1904,83 +2139,83 @@ % the correct form, and add a $0$ penalty at the end to nullify the effect of % repeating the last value. % \begin{macrocode} -\cs_new_protected:Npn \galley_set_display_widow_penalties:n #1 +\cs_new_protected:Npn \galley_display_widow_penalties_set:n #1 { \etex_displaywidowpenalties:D \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: - \clist_map_function:nN {#1} \galley_set_aux:n + \clist_map_function:nN {#1} \@@_set_aux:n \c_zero } -\cs_generate_variant:Nn \galley_set_display_widow_penalties:n { V , v } -\cs_new_protected:Npn \galley_set_widow_penalties:n #1 +\cs_generate_variant:Nn \galley_display_widow_penalties_set:n { V , v } +\cs_new_protected:Npn \galley_widow_penalties_set:n #1 { \etex_widowpenalties:D \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: - \clist_map_function:nN {#1} \galley_set_aux:n + \clist_map_function:nN {#1} \@@_set_aux:n \c_zero } -\cs_generate_variant:Nn \galley_set_widow_penalties:n { V , v } -\cs_new:Npn \galley_set_aux:n #1 { #1 ~ } +\cs_generate_variant:Nn \galley_widow_penalties_set:n { V , v } +\cs_new:Npn \@@_set_aux:n #1 { \int_eval:n {#1} ~ } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro} % { -% \galley_set_club_penalties:n, -% \galley_set_club_penalties:V, -% \galley_set_club_penalties:v, -% \galley_set_interline_penalties:n, -% \galley_set_interline_penalties:V, -% \galley_set_interline_penalties:v +% \galley_club_penalties_set:n, +% \galley_club_penalties_set:V, +% \galley_club_penalties_set:v, +% \galley_interline_penalties_set:n, +% \galley_interline_penalties_set:V, +% \galley_interline_penalties_set:v % } % Setting club or special line penalties is easy, as these are handled % mainly by the interline set up function. The two concepts are essentially % the same, but having two takes makes some special effects easier to % carry out. % \begin{macrocode} -\cs_new_protected:Npn \galley_set_club_penalties:n #1 +\cs_new_protected:Npn \galley_club_penalties_set:n #1 { \clist_set:Nn \l_galley_club_penalties_clist {#1} \@@_calc_interline_penalties: } -\cs_generate_variant:Nn \galley_set_club_penalties:n { V , v } -\cs_new_protected:Npn \galley_set_interline_penalties:n #1 +\cs_generate_variant:Nn \galley_club_penalties_set:n { V , v } +\cs_new_protected:Npn \galley_interline_penalties_set:n #1 { \clist_set:Nn \l_galley_line_penalties_clist {#1} \@@_calc_interline_penalties: } -\cs_generate_variant:Nn \galley_set_interline_penalties:n { V , v } +\cs_generate_variant:Nn \galley_interline_penalties_set:n { V , v } % \end{macrocode} % \end{macro} % % \begin{macro} % { -% \galley_set_display_club_penalties:n, -% \galley_set_display_club_penalties:V, -% \galley_set_display_club_penalties:v +% \galley_display_club_penalties_set:n, +% \galley_display_club_penalties_set:V, +% \galley_display_club_penalties_set:v % } % Setting the display club penalties means first setting the primitive, % then recalculating the interline array to allow for these new values. % \begin{macrocode} -\cs_new_protected:Npn \galley_set_display_club_penalties:n #1 +\cs_new_protected:Npn \galley_display_club_penalties_set:n #1 { \etex_clubpenalties:D \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: - \clist_map_function:nN {#1} \galley_set_aux:n + \clist_map_function:nN {#1} \@@_set_aux:n \c_zero \@@_calc_interline_penalties: } -\cs_generate_variant:Nn \galley_set_display_club_penalties:n { V , v } +\cs_generate_variant:Nn \galley_display_club_penalties_set:n { V , v } % \end{macrocode} % \end{macro} % -% \begin{macro}{\galley_set_interline_penalty:n} +% \begin{macro}{\galley_interline_penalty_set:n} % \begin{macro}[aux]{\@@_set_interline_penalty:nn} % \begin{macro}[aux] % { -% \@@_set_interline_penalty_i:n, -% \@@_set_interline_penalty_ii:n +% \@@_set_interline_penalty_auxi:n, +% \@@_set_interline_penalty_auxii:n % } % Dealing with the general interline penalty is handled in one shot. % The idea is that for lines with no special penalty, the old general @@ -1989,7 +2224,7 @@ % generic build system is invoked (in case the % \cs{etex_interlinepenalties:D} has accidentally been cleared). % \begin{macrocode} -\cs_new_protected:Npn \galley_set_interline_penalty:n #1 +\cs_new_protected:Npn \galley_interline_penalty_set:n #1 { \int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero { @@ -1997,7 +2232,7 @@ \@@_calc_interline_penalties: } { - \cs_set:Npn \@@_set_interline_penalty_ii:n ##1 + \cs_set:Npn \@@_set_interline_penalty_auxii:n ##1 { \__int_eval:w \etex_interlinepenalties:D ##1 @@ -2014,15 +2249,15 @@ \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero \int_step_function:nnnN \c_one \c_one {#1} - \@@_set_interline_penalty_i:n + \@@_set_interline_penalty_auxi:n \int_step_function:nnnN { #1 + \c_one } \c_one { \etex_interlinepenalties:D \c_zero - \c_one } - \@@_set_interline_penalty_ii:n + \@@_set_interline_penalty_auxii:n \__int_eval:w #2 \__int_eval_end: } -\cs_new:Npn \@@_set_interline_penalty_i:n #1 +\cs_new:Npn \@@_set_interline_penalty_auxi:n #1 { \etex_interlinepenalties:D \__int_eval:w #1 \__int_eval_end: } -\cs_new:Npn \@@_set_interline_penalty_ii:n #1 { } +\cs_new:Npn \@@_set_interline_penalty_auxii:n #1 { } % \end{macrocode} % \end{macro} % \end{macro} @@ -2032,8 +2267,8 @@ % \begin{macro}[aux]{\@@_calc_interline_penalties:nn} % \begin{macro}[aux] % { -% \@@_calc_interline_penalties_i:n, -% \@@_calc_interline_penalties_ii:n +% \@@_calc_interline_penalties_auxi:n, +% \@@_calc_interline_penalties_auxii:n % } % The underlying interline penalty array has to deal with club penalties, % display club penalties and any special line penalties, and include @@ -2046,21 +2281,18 @@ { \exp_args:Nff \@@_calc_interline_penalties:nn { - \int_eval:n + \int_max:nn + { + \clist_count:N \l_galley_club_penalties_clist + + \c_one + } { \int_max:nn { - \clist_count:N \l_galley_club_penalties_clist + \clist_count:N \l_galley_line_penalties_clist + \c_one } - { - \int_max:nn - { - \clist_count:N \l_galley_line_penalties_clist - + \c_one - } - { \etex_clubpenalties:D \c_zero } - } + { \etex_clubpenalties:D \c_zero } } } { \clist_count:N \l_galley_line_penalties_clist } @@ -2075,12 +2307,12 @@ { \etex_interlinepenalties:D #1 ~ \int_step_function:nnnN \c_one \c_one {#2} - \@@_calc_interline_penalties_i:n + \@@_calc_interline_penalties_auxi:n \int_step_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one } - \@@_calc_interline_penalties_ii:n + \@@_calc_interline_penalties_auxii:n \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero } -\cs_new:Npn \@@_calc_interline_penalties_i:n #1 +\cs_new:Npn \@@_calc_interline_penalties_auxi:n #1 { \__int_eval:w \clist_item:Nn \l_galley_line_penalties_clist {#1} @@ -2088,7 +2320,7 @@ - \etex_clubpenalties:D #1 ~ \__int_eval_end: } -\cs_new:Npn \@@_calc_interline_penalties_ii:n #1 +\cs_new:Npn \@@_calc_interline_penalties_auxii:n #1 { \__int_eval:w \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero @@ -2133,21 +2365,21 @@ { \int_step_function:nnnN \c_one \c_one { \etex_clubpenalties:D \c_zero - \c_one } - \galley_save_display_club_penalties:_aux:n + \@@_save_display_club_penalties:n } } -\cs_new:Npn \galley_save_display_club_penalties:_aux:n #1 - { \int_use:N \etex_clubpenaltes:D \__int_eval:w #1 \__int_eval_end: , } +\cs_new:Npn \@@_save_display_club_penalties:n #1 + { \int_use:N \etex_clubpenalties:D \__int_eval:w #1 \__int_eval_end: , } \cs_new_protected:Npn \galley_save_display_widow_penalties:N #1 { \clist_set:Nx #1 { \int_step_function:nnnN \c_one \c_one { \etex_displaywidowpenalties:D \c_zero - \c_one } - \galley_save_display_widow_penalties:_aux:n + \@@_save_display_widow_penalties:n } } -\cs_new:Npn \galley_save_display_widow_penalties:_aux:n #1 +\cs_new:Npn \@@_save_display_widow_penalties:n #1 { \int_use:N \etex_displaywidowpenalties:D \__int_eval:w #1 \__int_eval_end: , } \cs_new_protected:Npn \galley_save_widow_penalties:N #1 { @@ -2155,10 +2387,10 @@ { \int_step_function:nnnN \c_one \c_one { \etex_widowpenalties:D \c_zero - \c_one } - \galley_save_widow_penalties:_aux:n + \@@_save_widow_penalties:n } } -\cs_new:Npn \galley_save_widow_penalties:_aux:n #1 +\cs_new:Npn \@@_save_widow_penalties:n #1 { \int_use:N \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , } % \end{macrocode} % This one is not an array, but is stored in a primitive, so there is @@ -2204,7 +2436,7 @@ \tl_gput_right:Nn \g_galley_whatsit_next_tl { \iow_shipout:Nx \c_minus_one { } } \tex_vbox:D { } - \galley_set_user_penalty:n { -\@Mi } + \galley_penalty_set_single:n { -\@Mi } } % \end{macrocode} % \end{macro} @@ -2232,8 +2464,8 @@ \RenewDocumentCommand \vspace { s m } { \IfBooleanTF #1 - { \galley_set_user_vspace:n {#2} } - { \galley_set_user_vspace:n {#2} } + { \galley_vspace_set_single:n {#2} } + { \galley_vspace_set_single:n {#2} } } % \end{macrocode} % \end{macro} @@ -2262,7 +2494,7 @@ % \begin{macro}{\@@par} % The primitive is moved as otherwise the clever skipping code will fail. % \begin{macrocode} -\cs_set_eq:NN \@@par \@@_std_par: +\cs_set_eq:cN { @ @ par } \galley_par: % \end{macrocode} % \end{macro} % @@ -2274,14 +2506,14 @@ \bool_gset_true:N \g_galley_no_break_next_bool \if@afterindent \else - \bool_gset_true:N \galley_omit_next_indent_bool + \bool_gset_true:N \g_galley_omit_next_indent_bool \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\@hangfrom} -% The \cs{tex_handindent:D} primitive is no longer used, so the paragraph +% The \cs{tex_hangindent:D} primitive is no longer used, so the paragraph % shape is set in a different way. As a result, the label is part of the % same paragraph as the main body, hence the need to leave vertical mode. % \begin{macrocode} @@ -2290,7 +2522,7 @@ \bool_gset_true:N \g_galley_omit_next_indent_bool \leavevmode \setbox \@tempboxa = \hbox { {#1} } - \galley_parshape_single_par:nnnN + \galley_parshape_set_single:nnnN \c_one { \box_wd:N \@tempboxa } \c_zero_dim diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index 9e0ecffb59a..d0086f4a3e3 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{expl3} -\GetIdInfo$Id: xgalley.dtx 4253 2012-11-01 21:01:54Z joseph $ +\GetIdInfo$Id: xgalley.dtx 4373 2012-12-17 16:41:59Z joseph $ {L3 Experimental galley} %</driver|package> %<*driver> @@ -872,14 +872,14 @@ \AssignTemplateKeys \bool_if:NTF \l_@@_parshape_on_left_bool { - \galley_parshape_single_par:nVVN + \galley_parshape_set_single:nVVN \l_@@_parshape_lines_int \l_@@_parshape_indent_dim \c_zero_dim \c_false_bool } { - \galley_parshape_single_par:nVVN + \galley_parshape_set_single:nVVN \l_@@_parshape_lines_int \c_zero_dim \l_@@_parshape_indent_dim @@ -905,14 +905,14 @@ } \bool_if:NTF \l_@@_parshape_on_left_bool { - \galley_parshape_single_par:nVVN + \galley_parshape_set_single:nVVN \c_zero \l_@@_tmpa_clist \l_@@_tmpb_clist \c_true_bool } { - \galley_parshape_single_par:nVVN + \galley_parshape_set_single:nVVN \c_zero \l_@@_tmpb_clist \l_@@_tmpa_clist @@ -1059,7 +1059,7 @@ { \AssignTemplateKeys \tl_clear:N \l_@@_justification_other_tl - \galley_set_interword_spacing:N \l_galley_fixed_spacing_bool + \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool { \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand } { \int_zero:N \l_galley_last_line_fit_int } @@ -1089,7 +1089,7 @@ \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_set_interword_spacing:N + \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 } @@ -1107,7 +1107,7 @@ \tl_gput_right:Nn \g_galley_restore_running_tl { \l_@@_justification_other_tl } \AssignTemplateKeys - \galley_set_interword_spacing:N \l_galley_fixed_spacing_bool + \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool { \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand } { \int_zero:N \l_galley_last_line_fit_int } @@ -1159,8 +1159,8 @@ right-skip = 0 pt plus 2 em } % \end{macrocode} -% The \texttt{centering} instance is used to center material with minimal -% hyphenation +% The \texttt{center} instance is used to center material with minimal +% hyphenation. % \begin{macrocode} \DeclareInstance { justification } { center } { std } { @@ -1300,11 +1300,11 @@ } { \AssignTemplateKeys - \galley_set_club_penalties:V \l_@@_club_penalty_int - \galley_set_display_club_penalties:V \l_@@_display_club_penalty_int - \galley_set_display_widow_penalties:V \l_@@_display_widow_penalty_int - \galley_set_interline_penalty:n \l_@@_interline_penalty_int - \galley_set_widow_penalties:V \l_@@_widow_penalty_int + \galley_club_penalties_set:V \l_@@_club_penalty_int + \galley_display_club_penalties_set:V \l_@@_display_club_penalty_int + \galley_display_widow_penalties_set:V \l_@@_display_widow_penalty_int + \galley_interline_penalty_set:n \l_@@_interline_penalty_int + \galley_widow_penalties_set:V \l_@@_widow_penalty_int } % \end{macrocode} % \end{variable} @@ -1383,7 +1383,7 @@ % \begin{macrocode} \tl_if_empty:NF \l_@@_interline_penalty_tl { - \tl_gput_right:Nx \g_galley_par_after_hook_tl + \tl_gput_right:Nx \g_galley_par_reset_hook_tl { \int_set:Nn \exp_not:N \l_@@_interline_penalty_int { \galley_interline_penalty: } @@ -1393,7 +1393,7 @@ } \tl_if_empty:NF \l_@@_parbreak_fuzz_tl { - \tl_gput_right:Nx \g_galley_par_after_hook_tl + \tl_gput_right:Nx \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 } @@ -1408,7 +1408,7 @@ { \tl_if_empty:cF { l_galley_ ##1 _tl } { - \tl_gput_right:Nx \g_galley_par_after_hook_tl + \tl_gput_right:Nx \g_galley_par_reset_hook_tl { \int_set:Nn \exp_not:c { l_galley_ ##1 _int } { \int_use:c { l_galley_ ##1 _int } } @@ -1426,7 +1426,7 @@ \tl_if_empty:cF { l_galley_ ##1 _tl } { \use:c { galley_save_ ##1 :N } \l_@@_tmpa_clist - \tl_gput_right:Nx \g_galley_par_after_hook_tl + \tl_gput_right:Nx \g_galley_par_reset_hook_tl { \exp_not:c { galley_set_ ##1 :n } { \exp_not:o \l_@@_tmpa_clist } |