summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/xgalley
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/xgalley')
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty509
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty34
2 files changed, 331 insertions, 212 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
index 30c72196f57..a16079a1428 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
@@ -48,16 +48,18 @@
%% -----------------------------------------------------------------------
%%
\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}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\clist_new:N \l__galley_parshape_left_indent_clist
-\clist_new:N \l__galley_parshape_right_indent_clist
+\cs_generate_variant:Nn \seq_map_function:NN { Nc }
+\int_new:N \l__galley_tmp_int
+\seq_new:N \l__galley_tmpa_seq
+\seq_new:N \l__galley_tmpb_seq
+\tl_new:N \l__galley_tmp_tl
\bool_new:N \l__galley_parshape_multipar_bool
-\bool_new:N \l__galley_parshape_resume_std_bool
-\bool_new:N \l__galley_parshape_fixed_lines_bool
-\int_new:N \l_galley_parshape_std_lines_int
+\seq_new:N \l__galley_parshape_left_indent_seq
+\seq_new:N \l__galley_parshape_right_indent_seq
\cs_new_eq:NN \l_galley_text_width_dim \linewidth
\cs_new_eq:NN \l_galley_total_left_margin_dim \@totalleftmargin
\dim_new:N \l_galley_total_right_margin_dim
@@ -66,20 +68,24 @@
\cs_new_eq:NN \l_galley_width_dim \tex_hsize:D
\bool_new:N \g__galley_begin_level_bool
\bool_new:N \l__galley_begin_level_bool
+\seq_new:N \g__galley_cutout_left_seq
+\seq_new:N \l__galley_cutout_left_seq
+\seq_new:N \g__galley_cutout_right_seq
+\seq_new:N \l__galley_cutout_right_seq
\bool_new:N \g_galley_omit_next_indent_bool
\bool_new:N \l__galley_omit_next_indent_bool
-\bool_new:N \g__galley_parshape_set_bool
-\bool_new:N \l__galley_parshape_set_bool
\bool_new:N \g_galley_no_break_next_bool
\bool_new:N \l__galley_no_break_next_bool
\tl_new:N \g_galley_par_begin_hook_tl
-\tl_new:N \l__galley_galley_par_begin_hook_tl
+\tl_new:N \l__galley_par_begin_hook_tl
\tl_new:N \g_galley_par_end_hook_tl
-\tl_new:N \l__galley_galley_par_end_hook_tl
-\tl_new:N \g_galley_par_after_hook_tl
-\tl_new:N \l__galley_par_after_hook_tl
+\tl_new:N \l__galley_par_end_hook_tl
+\tl_new:N \g_galley_par_reset_hook_tl
+\tl_new:N \l__galley_par_reset_hook_tl
\int_new:N \g_galley_previous_par_lines_int
\int_new:N \l__galley_previous_par_lines_int
+\int_new:N \g__galley_current_par_lines_int
+\int_new:N \l__galley_current_par_lines_int
\tl_new:N \g_galley_restore_running_tl
\tl_new:N \l__galley_restore_running_tl
\tl_new:N \g_galley_whatsit_next_tl
@@ -93,14 +99,16 @@
\cs_new_protected_nopar:Npn \__galley_initialise_variables:
{
\bool_gset_true:N \g__galley_begin_level_bool
+ \seq_gclear:N \g__galley_cutout_left_seq
+ \seq_gclear:N \g__galley_cutout_right_seq
\tl_gclear:N \g__galley_interpar_penalty_user_tl
\tl_gclear:N \g__galley_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__galley_parshape_set_bool
+ \tl_gclear:N \g_galley_par_reset_hook_tl
+ \int_gzero:N \g__galley_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
@@ -117,6 +125,10 @@
{
\bool_set_eq:NN \l__galley_begin_level_bool
\g__galley_begin_level_bool
+ \seq_set_eq:NN \l__galley_cutout_left_seq
+ \g__galley_cutout_left_seq
+ \seq_set_eq:NN \l__galley_cutout_right_seq
+ \g__galley_cutout_right_seq
\tl_set_eq:NN \l__galley_interpar_penalty_user_tl
\g__galley_interpar_penalty_user_tl
\tl_set_eq:NN \l__galley_interpar_vspace_user_tl
@@ -125,14 +137,14 @@
\g_galley_omit_next_indent_bool
\bool_set_eq:NN \l__galley_no_break_next_bool
\g_galley_no_break_next_bool
- \tl_set_eq:NN \l__galley_galley_par_begin_hook_tl
+ \tl_set_eq:NN \l__galley_par_begin_hook_tl
\g_galley_par_begin_hook_tl
- \tl_set_eq:NN \l__galley_galley_par_end_hook_tl
+ \tl_set_eq:NN \l__galley_par_end_hook_tl
\g_galley_par_end_hook_tl
- \tl_set_eq:NN \l__galley_par_after_hook_tl
- \g_galley_par_after_hook_tl
- \bool_set_eq:NN \l__galley_parshape_set_bool
- \g__galley_parshape_set_bool
+ \tl_set_eq:NN \l__galley_par_reset_hook_tl
+ \g_galley_par_reset_hook_tl
+ \int_set_eq:NN \l__galley_current_par_lines_int
+ \g__galley_current_par_lines_int
\int_set_eq:NN \l__galley_previous_par_lines_int
\g_galley_previous_par_lines_int
\tl_set_eq:NN \l__galley_restore_running_tl
@@ -146,6 +158,10 @@
{
\bool_gset_eq:NN \g__galley_begin_level_bool
\l__galley_begin_level_bool
+ \seq_gset_eq:NN \g__galley_cutout_left_seq
+ \l__galley_cutout_left_seq
+ \seq_gset_eq:NN \g__galley_cutout_right_seq
+ \l__galley_cutout_right_seq
\tl_gset_eq:NN \g__galley_interpar_penalty_user_tl
\l__galley_interpar_penalty_user_tl
\tl_gset_eq:NN \g__galley_interpar_vspace_user_tl
@@ -155,13 +171,13 @@
\bool_gset_eq:NN \g_galley_no_break_next_bool
\l__galley_no_break_next_bool
\tl_gset_eq:NN \g_galley_par_begin_hook_tl
- \l__galley_galley_par_begin_hook_tl
+ \l__galley_par_begin_hook_tl
\tl_gset_eq:NN \g_galley_par_end_hook_tl
- \l__galley_galley_par_end_hook_tl
- \tl_gset_eq:NN \g_galley_par_after_hook_tl
- \l__galley_par_after_hook_tl
- \bool_gset_eq:NN \g__galley_parshape_set_bool
- \l__galley_parshape_set_bool
+ \l__galley_par_end_hook_tl
+ \tl_gset_eq:NN \g_galley_par_reset_hook_tl
+ \l__galley_par_reset_hook_tl
+ \int_gset_eq:NN \g__galley_current_par_lines_int
+ \l__galley_current_par_lines_int
\int_gset_eq:NN \g_galley_previous_par_lines_int
\l__galley_previous_par_lines_int
\tl_gset_eq:NN \g_galley_restore_running_tl
@@ -186,52 +202,58 @@
\group_end:
}
\__scan_new:N \s__par_omit
-\cs_new_protected_nopar:Npn \__galley_std_par:
+\cs_new_protected_nopar:Npn \galley_par:
{
\s__par_omit
- \exp_after:wN \__galley_std_par_aux_i: \tex_romannumeral:D - `0
+ \exp_after:wN \__galley_par_auxi: \tex_romannumeral:D - `0
}
-\cs_new_protected:Npn \__galley_std_par_aux_i:
+\cs_new_protected:Npn \__galley_par_auxi:
{
\peek_meaning:NTF \s__par_omit
- { \__galley_std_par_aux:N }
- { \__galley_std_par_aux_ii: }
+ { \__galley_par_aux:N }
+ { \__galley_par_auxii: }
}
-\cs_new_protected:Npn \__galley_std_par_aux:N #1
+\cs_new_protected:Npn \__galley_par_aux:N #1
{
\str_if_eq_x:nnF {#1} { \s__par_omit }
{
- \__galley_std_par_aux_ii:
+ \__galley_par_auxii:
#1
}
}
-\cs_new_protected_nopar:Npn \__galley_std_par_aux_ii:
+\cs_new_protected_nopar:Npn \__galley_par_auxii:
{
\mode_if_vertical:TF
- { \tex_par:D }
+ {
+ \group_begin:
+ \tex_par:D
+ \group_end:
+ }
{
\g_galley_par_end_hook_tl
- \__galley_set_measure_and_parshape:
\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__galley_current_par_lines_int }
+ \__galley_parshape_reset:
+ \int_gzero:N \g__galley_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
\tex_penalty:D \c_ten_thousand
}
-\cs_new_protected:Npn \__galley_end_par:n #1
+\cs_new_protected:Npn \galley_par:n #1
{
\s__par_omit
\bool_if:nF \g__galley_begin_level_bool
{
#1
- \__galley_std_par:
+ \galley_par:
}
}
-\cs_set_protected_nopar:Npn \par { \__galley_std_par: }
-\tl_set:Nn \@par { \__galley_std_par: }
+\cs_set_protected_nopar:Npn \par { \galley_par: }
+\tl_set:Nn \@par { \galley_par: }
\cs_new_protected_nopar:Npn \galley_display_begin:
{
\group_begin:
@@ -285,7 +307,7 @@
}
\cs_new_protected_nopar:Npn \__galley_display_par:
{
- \cs_set_eq:NN \par \__galley_std_par:
+ \cs_set_eq:NN \par \galley_par:
\mode_if_vertical:TF
{
\par
@@ -294,11 +316,10 @@
\__galley_display_vspace:N \l_galley_display_end_par_vspace_tl
}
{
- \__galley_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__galley_current_par_lines_int \tex_prevgraf:D
\__galley_display_penalty:N \l_galley_display_end_penalty_tl
\__galley_display_vspace:N \l_galley_display_end_vspace_tl
}
@@ -325,7 +346,6 @@
\tex_everypar:D { }
\tex_noindent:D
\group_end:
- \int_gzero:N \g_galley_previous_par_lines_int
\__galley_insert_horizontal_items:
\__galley_restore_running_parameters:
}
@@ -391,8 +411,11 @@
\g_galley_restore_running_tl
\tl_gclear:N \g_galley_restore_running_tl
}
+\dim_new:N \l__galley_total_left_margin_dim
+\dim_new:N \l__galley_total_right_margin_dim
\cs_new_protected:Npn \galley_margins_set_absolute:nn #1#2
{
+ \__galley_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
@@ -401,9 +424,11 @@
- \l_galley_total_left_margin_dim
- \l_galley_total_right_margin_dim
}
+ \__galley_set_measure:
}
\cs_new_protected:Npn \galley_margins_set_relative:nn #1#2
{
+ \__galley_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
@@ -412,144 +437,241 @@
- \l_galley_total_left_margin_dim
- \l_galley_total_right_margin_dim
}
+ \__galley_set_measure:
}
-\cs_new_protected:Npn \galley_parshape_fixed_lines:nnn #1#2#3
+\cs_new_protected_nopar:Npn \__galley_save_margins:
{
- \bool_gset_true:N \g__galley_parshape_set_bool
- \bool_set_true:N \l__galley_parshape_fixed_lines_bool
- \int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l__galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l__galley_parshape_right_indent_clist {#3}
- \bool_set_true:N \l__galley_parshape_resume_std_bool
+ \dim_set_eq:NN \l__galley_total_left_margin_dim
+ \l_galley_total_left_margin_dim
+ \dim_set_eq:NN \l__galley_total_right_margin_dim
+ \l_galley_total_right_margin_dim
}
-\cs_new_protected:Npn \galley_parshape_multi_par:nnnN #1#2#3#4
+\cs_new_protected_nopar:Npn \__galley_set_measure:
{
- \bool_gset_true:N \g__galley_parshape_set_bool
- \bool_set_true:N \l__galley_parshape_multipar_bool
- \bool_set_false:N \l__galley_parshape_fixed_lines_bool
- \int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l__galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l__galley_parshape_right_indent_clist {#3}
- \bool_set_eq:NN \l__galley_parshape_resume_std_bool #4
+ \int_compare:nNnTF \tex_parshape:D = \c_zero
+ { \__galley_parshape_measure: }
+ {
+ \dim_sub:Nn \l__galley_total_left_margin_dim
+ \l_galley_total_left_margin_dim
+ \dim_sub:Nn \l__galley_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
+ \__galley_set_measure_aux:n
+ }
}
-\cs_new_protected:Npn \galley_parshape_single_par:nnnN #1#2#3#4
+\cs_new:Npn \__galley_set_measure_aux:n #1
{
- \bool_gset_true:N \g__galley_parshape_set_bool
- \bool_set_false:N \l__galley_parshape_multipar_bool
- \bool_set_false:N \l__galley_parshape_fixed_lines_bool
- \int_set:Nn \l_galley_parshape_std_lines_int {#1}
- \clist_set:Nn \l__galley_parshape_left_indent_clist {#2}
- \clist_set:Nn \l__galley_parshape_right_indent_clist {#3}
- \bool_set_eq:NN \l__galley_parshape_resume_std_bool #4
+ \__dim_eval:w
+ \etex_parshapeindent:D #1 - \l__galley_total_left_margin_dim
+ \__dim_eval_end:
+ \__dim_eval:w
+ \etex_parshapelength:D #1
+ + \l__galley_total_left_margin_dim + \l__galley_total_right_margin_dim
+ \__dim_eval_end:
}
-\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_new_protected_nopar:Npn \__galley_set_measure_and_parshape:
+\cs_new_protected_nopar:Npn \__galley_parshape_reset:
{
- \bool_if:NTF \g__galley_parshape_set_bool
+ \int_compare:nNnF \tex_parshape:D = \c_zero
{
- \bool_if:NTF \l__galley_parshape_fixed_lines_bool
+ \bool_if:nTF
+ {
+ \seq_if_empty_p:N \g__galley_cutout_left_seq
+ && \seq_if_empty_p:N \g__galley_cutout_right_seq
+ }
{
- \int_compare:nNnTF \g_galley_previous_par_lines_int > \c_zero
- { \__galley_generate_parshape_lines: }
- { \__galley_generate_parshape: }
+ \bool_if:NF \l__galley_parshape_multipar_bool
+ { \__galley_parshape_measure: }
}
{
- \bool_gset_eq:NN \g__galley_parshape_set_bool
- \l__galley_parshape_multipar_bool
- \__galley_generate_parshape:
+ \prg_replicate:nn \g__galley_previous_par_lines_int
+ {
+ \seq_gpop:NN \g__galley_cutout_left_seq \l__galley_tmp_tl
+ \seq_gpop:NN \g__galley_cutout_right_seq \l__galley_tmp_tl
+ }
+ \bool_if:NTF \l__galley_parshape_multipar_bool
+ { \__galley_parshape_set: }
+ { \__galley_parshape_measure: }
+ \__galley_cutout_set:Nn \g__galley_cutout_left_seq { left }
+ \__galley_cutout_set:Nn \g__galley_cutout_right_seq { right }
}
}
+ }
+\cs_new_protected_nopar:Npn \__galley_parshape_measure:
+ {
+ \tex_parshape:D
+ \c_one
+ \l_galley_total_left_margin_dim
+ \l_galley_text_width_dim
+ }
+\cs_new_protected_nopar:Npn \galley_parshape_set_multi:nnnN
+ {
+ \bool_set_true:N \l__galley_parshape_multipar_bool
+ \__galley_parshape_set:nnnN
+ }
+\cs_new_protected_nopar:Npn \galley_parshape_set_single:nnnN
+ {
+ \bool_set_false:N \l__galley_parshape_multipar_bool
+ \__galley_parshape_set:nnnN
+ }
+\cs_generate_variant:Nn \galley_parshape_set_multi:nnnN { nVV }
+\cs_generate_variant:Nn \galley_parshape_set_single:nnnN { nVV }
+\cs_new_protected:Npn \__galley_parshape_set:nnnN #1#2#3#4
+ {
+ \seq_set_from_clist:Nn \l__galley_parshape_left_indent_seq {#2}
+ \seq_set_from_clist:Nn \l__galley_parshape_right_indent_seq {#3}
+ \prg_replicate:nn {#1}
+ {
+ \seq_put_left:Nn \l__galley_parshape_left_indent_seq { 0 pt }
+ \seq_put_left:Nn \l__galley_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__galley_parshape_left_indent_seq { 0 pt }
+ \seq_put_right:Nn \l__galley_parshape_right_indent_seq { 0 pt }
}
+ \__galley_parshape_set:
}
-\cs_new_protected_nopar:Npn \__galley_generate_parshape:
+\cs_new_protected_nopar:Npn \__galley_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__galley_parshape_left_indent_clist }
- { \clist_count:N \l__galley_parshape_right_indent_clist }
- \bool_if:NT \l__galley_parshape_resume_std_bool { + 1 }
+ \int_min:nn
+ { \seq_count:N \l__galley_parshape_left_indent_seq }
+ { \seq_count:N \l__galley_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
- }
- \__galley_set_parshape_map:oo
- \l__galley_parshape_left_indent_clist
- \l__galley_parshape_right_indent_clist
- \bool_if:NT \l__galley_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__galley_parshape_left_indent_seq
+ \l__galley_parshape_right_indent_seq
+ \__galley_parshape_set:nn
+ }
+\cs_new:Npn \__galley_parshape_set:nn #1#2
+ {
+ \__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:
+ }
+\cs_new_protected_nopar:Npn \galley_cutout_left:nn
+ { \__galley_cutout:nnn { left } }
+\cs_new_protected_nopar:Npn \galley_cutout_right:nn
+ { \__galley_cutout:nnn { right } }
+\cs_new_protected:Npn \__galley_cutout:nnn #1#2#3
+ {
+ \seq_set_from_clist:Nn \l__galley_tmpa_seq {#3}
+ \prg_replicate:nn {#2}
+ { \seq_put_left:Nn \l__galley_tmpa_seq { 0 pt } }
+ \__galley_cutout_set:Nn \l__galley_tmpa_seq {#1}
+ \seq_clear:N \l__galley_tmpb_seq
+ \int_compare:nNnTF
+ { \seq_count:N \l__galley_tmpa_seq } >
+ { \seq_count:c { g__galley_cutout_ #1 _ seq } }
+ {
+ \seq_map_inline:Nn \l__galley_tmpa_seq
+ {
+ \__galley_cutout_store:nn
+ { \seq_gpop:cNF { g__galley_cutout_ #1 _ seq } }
+ {##1}
+ }
+ }
+ {
+ \seq_map_inline:cn { g__galley_cutout_ #1 _ seq }
+ {
+ \__galley_cutout_store:nn
+ { \seq_pop:NNF \l__galley_tmpa_seq }
+ {##1}
+ }
+ }
+ \seq_gset_eq:cN { g__galley_cutout_ #1 _ seq } \l__galley_tmpb_seq
+ }
+\cs_new_protected:Npn \__galley_cutout_store:nn #1#2
+ {
+ #1 \l__galley_tmp_tl
+ { \tl_set:Nn \l__galley_tmp_tl { 0 pt } }
+ \seq_put_right:Nx \l__galley_tmpb_seq
+ { \dim_eval:n { \l__galley_tmp_tl + #2 } }
}
-\cs_new:Npn \__galley_set_parshape_map:nn #1#2
- { \__galley_set_parshape_map_aux:nw { } #1 , \q_mark #2 , \q_stop }
-\cs_generate_variant:Nn \__galley_set_parshape_map:nn { oo }
-\cs_new:Npn \__galley_set_parshape_map_aux:nw #1#2 , #3 \q_mark #4 , #5 \q_stop
+\cs_new_protected:Npn \__galley_cutout_set:Nn #1#2
{
- \bool_if:nTF { \tl_if_empty_p:n {#3} || \tl_if_empty_p:n {#5} }
+ \int_zero:N \l__galley_tmp_int
+ \tl_clear:N \l__galley_tmp_tl
+ \seq_map_function:Nc #1 { __galley_cutout_ #2 :n }
+ \int_compare:nNnTF \tex_parshape:D > \l__galley_tmp_int
{
- #1
- \dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) }
- \c_space_tl
- \dim_eval:n { \l_galley_text_width_dim - ( ( #2 ) + ( #4 ) ) }
+ \int_step_function:nnnN
+ { \l__galley_tmp_int + \c_one }
+ \c_one
+ \tex_parshape:D
+ \__galley_cutout_end:n
}
{
- \__galley_set_parshape_map_aux:nw
+ \int_incr:N \l__galley_tmp_int
+ \int_compare:nNnTF \tex_parshape:D = \c_zero
{
- #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
+ \tl_put_right:Nn \l__galley_tmp_tl
+ { \l__galley_total_left_margin_dim \l__galley_text_width_dim }
+ }
+ {
+ \tl_put_right:Nx \l__galley_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
+ }
}
- #3 \q_mark #5 \q_stop
}
+ \tex_parshape:D
+ \l__galley_tmp_int
+ \l__galley_tmp_tl
}
-\cs_new_protected_nopar:Npn \__galley_generate_parshape_lines:
+\cs_new_protected:Npn \__galley_cutout_left:n #1
{
- \int_compare:nNnTF \tex_parshape:D > \g_galley_previous_par_lines_int
+ \int_incr:N \l__galley_tmp_int
+ \tl_put_right:Nx \l__galley_tmp_tl
{
- \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 \__galley_generate_parshape_lines:n
+ \int_compare:nNnTF \l__galley_tmp_int > \tex_parshape:D
+ {
+ \dim_eval:n { \l__galley_total_left_margin_dim + ( #1 ) }
+ \c_space_tl
+ \dim_eval:n { \l__galley_text_width_dim - ( #1 ) }
+ \c_space_tl
+ }
+ {
+ \dim_eval:n { \etex_parshapeindent:D \l__galley_tmp_int + ( #1 ) }
+ \c_space_tl
+ \dim_eval:n { \etex_parshapelength:D \l__galley_tmp_int - ( #1 ) }
+ \c_space_tl
+ }
}
+ }
+\cs_new_protected:Npn \__galley_cutout_right:n #1
+ {
+ \int_incr:N \l__galley_tmp_int
+ \tl_put_right:Nx \l__galley_tmp_tl
{
- \bool_gset_false:N \g__galley_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
+ \dim_eval:n { \etex_parshapeindent:D \l__galley_tmp_int }
+ \c_space_tl
+ \dim_eval:n { \etex_parshapelength:D \l__galley_tmp_int - ( #1 ) }
+ \c_space_tl
}
}
-\cs_new:Npn \__galley_generate_parshape_lines:n #1
+\cs_new_protected:Npn \__galley_cutout_end:n #1
{
- \etex_parshapeindent:D #1
- ~
- \etex_parshapelength:D #1
+ \int_incr:N \l__galley_tmp_int
+ \tl_put_right:Nx \l__galley_tmp_tl
+ {
+ \dim_eval:n { \etex_parshapeindent:D #1 }
+ \c_space_tl
+ \dim_eval:n { \etex_parshapelength:D #1 }
+ \c_space_tl
+ }
}
-\cs_new_protected:Npn \galley_set_user_penalty:n #1
+\cs_new_protected:Npn \galley_penalty_set_single:n #1
{ \tl_gset:Nx \g__galley_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__galley_interpar_vspace_user_tl { \skip_eval:n {#1} } }
\dim_set:Nn \parskip \c_zero_dim
\cs_undefine:N \parskip
@@ -560,7 +682,7 @@
\cs_new_eq:NN \l_galley_par_end_skip \tex_parfillskip:D
\cs_new_eq:NN \l_galley_par_indent_dim \tex_parindent:D
\cs_new_eq:NN \l_galley_last_line_fit_int \etex_lastlinefit:D
-\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!
@@ -607,45 +729,45 @@
\cs_new_eq:NN \l_galley_pre_display_penalty_int \tex_predisplaypenalty:D
\clist_new:N \l_galley_club_penalties_clist
\clist_new:N \l_galley_line_penalties_clist
-\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} \__galley_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} \__galley_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_new_protected:Npn \galley_set_club_penalties:n #1
+\cs_generate_variant:Nn \galley_widow_penalties_set:n { V , v }
+\cs_new:Npn \__galley_set_aux:n #1 { \int_eval:n {#1} ~ }
+\cs_new_protected:Npn \galley_club_penalties_set:n #1
{
\clist_set:Nn \l_galley_club_penalties_clist {#1}
\__galley_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}
\__galley_calc_interline_penalties:
}
-\cs_generate_variant:Nn \galley_set_interline_penalties:n { V , v }
-\cs_new_protected:Npn \galley_set_display_club_penalties:n #1
+\cs_generate_variant:Nn \galley_interline_penalties_set:n { V , v }
+\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} \__galley_set_aux:n
\c_zero
\__galley_calc_interline_penalties:
}
-\cs_generate_variant:Nn \galley_set_display_club_penalties:n { V , v }
-\cs_new_protected:Npn \galley_set_interline_penalty:n #1
+\cs_generate_variant:Nn \galley_display_club_penalties_set:n { V , v }
+\cs_new_protected:Npn \galley_interline_penalty_set:n #1
{
\int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero
{
@@ -653,7 +775,7 @@
\__galley_calc_interline_penalties:
}
{
- \cs_set:Npn \__galley_set_interline_penalty_ii:n ##1
+ \cs_set:Npn \__galley_set_interline_penalty_auxii:n ##1
{
\__int_eval:w
\etex_interlinepenalties:D ##1
@@ -670,34 +792,31 @@
\etex_interlinepenalties:D
\etex_interlinepenalties:D \c_zero
\int_step_function:nnnN \c_one \c_one {#1}
- \__galley_set_interline_penalty_i:n
+ \__galley_set_interline_penalty_auxi:n
\int_step_function:nnnN { #1 + \c_one } \c_one
{ \etex_interlinepenalties:D \c_zero - \c_one }
- \__galley_set_interline_penalty_ii:n
+ \__galley_set_interline_penalty_auxii:n
\__int_eval:w #2 \__int_eval_end:
}
-\cs_new:Npn \__galley_set_interline_penalty_i:n #1
+\cs_new:Npn \__galley_set_interline_penalty_auxi:n #1
{ \etex_interlinepenalties:D \__int_eval:w #1 \__int_eval_end: }
-\cs_new:Npn \__galley_set_interline_penalty_ii:n #1 { }
+\cs_new:Npn \__galley_set_interline_penalty_auxii:n #1 { }
\cs_new_protected_nopar:Npn \__galley_calc_interline_penalties:
{
\exp_args:Nff \__galley_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 }
@@ -706,12 +825,12 @@
{
\etex_interlinepenalties:D #1 ~
\int_step_function:nnnN \c_one \c_one {#2}
- \__galley_calc_interline_penalties_i:n
+ \__galley_calc_interline_penalties_auxi:n
\int_step_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one }
- \__galley_calc_interline_penalties_ii:n
+ \__galley_calc_interline_penalties_auxii:n
\etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
}
-\cs_new:Npn \__galley_calc_interline_penalties_i:n #1
+\cs_new:Npn \__galley_calc_interline_penalties_auxi:n #1
{
\__int_eval:w
\clist_item:Nn \l_galley_line_penalties_clist {#1}
@@ -719,7 +838,7 @@
- \etex_clubpenalties:D #1 ~
\__int_eval_end:
}
-\cs_new:Npn \__galley_calc_interline_penalties_ii:n #1
+\cs_new:Npn \__galley_calc_interline_penalties_auxii:n #1
{
\__int_eval:w
\etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
@@ -737,21 +856,21 @@
{
\int_step_function:nnnN \c_one \c_one
{ \etex_clubpenalties:D \c_zero - \c_one }
- \galley_save_display_club_penalties:_aux:n
+ \__galley_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 \__galley_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
+ \__galley_save_display_widow_penalties:n
}
}
-\cs_new:Npn \galley_save_display_widow_penalties:_aux:n #1
+\cs_new:Npn \__galley_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
{
@@ -759,10 +878,10 @@
{
\int_step_function:nnnN \c_one \c_one
{ \etex_widowpenalties:D \c_zero - \c_one }
- \galley_save_widow_penalties:_aux:n
+ \__galley_save_widow_penalties:n
}
}
-\cs_new:Npn \galley_save_widow_penalties:_aux:n #1
+\cs_new:Npn \__galley_save_widow_penalties:n #1
{ \int_use:N \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , }
\cs_new_protected_nopar:Npn \galley_interline_penalty:
{ \int_use:N \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero }
@@ -782,7 +901,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 }
}
\RenewDocumentCommand \nobreak { }
{ \bool_gset_true:N \g_galley_no_break_next_bool }
@@ -794,20 +913,20 @@
\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} }
}
\RenewDocumentCommand \\ { s O { 0 pt } }
{ \galley_break_line:Nn #1 {#2} }
\RenewDocumentCommand \newline { }
{ \galley_break_line:Nn \c_true_bool { 0 pt } }
-\cs_set_eq:NN \__galleypar \__galley_std_par:
+\cs_set_eq:cN { @ @ par } \galley_par:
\cs_set_protected_nopar:Npn \@afterheading
{
\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
}
\cs_set_protected:Npn \@hangfrom #1
@@ -815,7 +934,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/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
index f8552f3f8e4..f736e2b74a6 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
@@ -48,7 +48,7 @@
%% -----------------------------------------------------------------------
%%
\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}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -111,14 +111,14 @@
\AssignTemplateKeys
\bool_if:NTF \l__galley_parshape_on_left_bool
{
- \galley_parshape_single_par:nVVN
+ \galley_parshape_set_single:nVVN
\l__galley_parshape_lines_int
\l__galley_parshape_indent_dim
\c_zero_dim
\c_false_bool
}
{
- \galley_parshape_single_par:nVVN
+ \galley_parshape_set_single:nVVN
\l__galley_parshape_lines_int
\c_zero_dim
\l__galley_parshape_indent_dim
@@ -144,14 +144,14 @@
}
\bool_if:NTF \l__galley_parshape_on_left_bool
{
- \galley_parshape_single_par:nVVN
+ \galley_parshape_set_single:nVVN
\c_zero
\l__galley_tmpa_clist
\l__galley_tmpb_clist
\c_true_bool
}
{
- \galley_parshape_single_par:nVVN
+ \galley_parshape_set_single:nVVN
\c_zero
\l__galley_tmpb_clist
\l__galley_tmpa_clist
@@ -242,7 +242,7 @@
{
\AssignTemplateKeys
\tl_clear:N \l__galley_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 }
@@ -266,7 +266,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 }
@@ -284,7 +284,7 @@
\tl_gput_right:Nn \g_galley_restore_running_tl
{ \l__galley_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 }
@@ -401,11 +401,11 @@
}
{
\AssignTemplateKeys
- \galley_set_club_penalties:V \l__galley_club_penalty_int
- \galley_set_display_club_penalties:V \l__galley_display_club_penalty_int
- \galley_set_display_widow_penalties:V \l__galley_display_widow_penalty_int
- \galley_set_interline_penalty:n \l__galley_interline_penalty_int
- \galley_set_widow_penalties:V \l__galley_widow_penalty_int
+ \galley_club_penalties_set:V \l__galley_club_penalty_int
+ \galley_display_club_penalties_set:V \l__galley_display_club_penalty_int
+ \galley_display_widow_penalties_set:V \l__galley_display_widow_penalty_int
+ \galley_interline_penalty_set:n \l__galley_interline_penalty_int
+ \galley_widow_penalties_set:V \l__galley_widow_penalty_int
}
\DeclareInstance { paragraph-breaking } { std } { std } { }
\UseInstance { paragraph-breaking } { std }
@@ -451,7 +451,7 @@
\AssignTemplateKeys
\tl_if_empty:NF \l__galley_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__galley_interline_penalty_int
{ \galley_interline_penalty: }
@@ -461,7 +461,7 @@
}
\tl_if_empty:NF \l__galley_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 }
@@ -472,7 +472,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 } }
@@ -486,7 +486,7 @@
\tl_if_empty:cF { l_galley_ ##1 _tl }
{
\use:c { galley_save_ ##1 :N } \l__galley_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__galley_tmpa_clist }