diff options
author | Karl Berry <karl@freefriends.org> | 2016-10-19 20:37:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-10-19 20:37:37 +0000 |
commit | 97a401ad817da2dafd1069df9d87a28ed39df69b (patch) | |
tree | f1555539115424980d80f573f5d17ded80989dd8 /Master/texmf-dist/tex/latex/l3experimental/xgalley | |
parent | 8bd51564ec4daf2be1c0e6767abbd5215cb8b21a (diff) |
l3experimental (18oct16)
git-svn-id: svn://tug.org/texlive/trunk@42305 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/xgalley')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty | 128 |
1 files changed, 66 insertions, 62 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index 8fcffdf3ff0..c2ec8683ada 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -47,8 +47,8 @@ %% %% ----------------------------------------------------------------------- %% -\RequirePackage{expl3}[2016/05/14] -\@ifpackagelater{expl3}{2016/05/14} +\RequirePackage{expl3}[2016/10/19] +\@ifpackagelater{expl3}{2016/10/19} {} {% \PackageError{l3galley}{Support package l3kernel too old} @@ -60,7 +60,7 @@ }% \endinput } -\GetIdInfo$Id: l3galley.dtx 6493 2016-05-14 21:08:13Z joseph $ +\GetIdInfo$Id: l3galley.dtx 6730 2016-10-19 11:19:38Z joseph $ {L3 Experimental galley code} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -69,6 +69,8 @@ \seq_new:N \g__galley_tmpb_seq \seq_new:N \l__galley_tmp_seq \tl_new:N \l__galley_tmp_tl +\bool_new:N \g__galley_cutout_active_bool +\bool_new:N \l__galley_cutout_active_bool \seq_new:N \l__galley_cutout_left_indent_seq \seq_new:N \l__galley_cutout_right_indent_seq \bool_new:N \l__galley_parshape_multipar_bool @@ -110,9 +112,12 @@ \tl_new:N \l__galley_interpar_penalty_user_tl \tl_new:N \g__galley_interpar_vspace_user_tl \tl_new:N \l__galley_interpar_vspace_user_tl -\cs_new_protected_nopar:Npn \__galley_initialise_variables: +\int_new:N \l__galley_group_level_int +\cs_new_protected:Npn \__galley_initialise_variables: { + \int_set:Nn \l__galley_group_level_int { \etex_currentgrouplevel:D } \bool_gset_true:N \g__galley_begin_level_bool + \bool_gset_false:N \g__galley_cutout_active_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 @@ -129,7 +134,7 @@ \tl_gclear:N \g_galley_whatsit_next_tl } \__galley_initialise_variables: -\cs_new_protected_nopar:Npn \__galley_initialise_settings: +\cs_new_protected:Npn \__galley_initialise_settings: { \bool_set_true:N \l__galley_parshape_multipar_bool \seq_clear:N \l__galley_parshape_left_indent_seq @@ -138,10 +143,12 @@ \dim_zero:N \l_galley_total_left_margin_dim \dim_zero:N \l_galley_total_right_margin_dim } -\cs_new_protected_nopar:Npn \__galley_save_parameters: +\cs_new_protected:Npn \__galley_save_parameters: { \bool_set_eq:NN \l__galley_begin_level_bool \g__galley_begin_level_bool + \bool_set_eq:NN \l__galley_cutout_active_bool + \g__galley_cutout_active_bool \seq_set_eq:NN \l__galley_cutout_left_seq \g__galley_cutout_left_seq \seq_set_eq:NN \l__galley_cutout_right_seq @@ -171,10 +178,12 @@ \tl_set_eq:NN \l__galley_whatsit_next_tl \g_galley_whatsit_next_tl } -\cs_new_protected_nopar:Npn \__galley_restore_parameters: +\cs_new_protected:Npn \__galley_restore_parameters: { \bool_gset_eq:NN \g__galley_begin_level_bool \l__galley_begin_level_bool + \bool_gset_eq:NN \g__galley_cutout_active_bool + \l__galley_cutout_active_bool \seq_gset_eq:NN \g__galley_cutout_left_seq \l__galley_cutout_left_seq \seq_gset_eq:NN \g__galley_cutout_right_seq @@ -204,7 +213,7 @@ \tl_gset_eq:NN \g_galley_whatsit_next_tl \l__galley_whatsit_next_tl } -\cs_new_protected_nopar:Npn \galley_level: +\cs_new_protected:Npn \galley_level: { \__galley_save_parameters: \group_begin: @@ -212,14 +221,14 @@ \__galley_initialise_settings: \group_insert_after:N \__galley_level_end: } -\cs_new_protected_nopar:Npn \__galley_level_end: +\cs_new_protected:Npn \__galley_level_end: { \par \__galley_restore_parameters: \group_end: } \__scan_new:N \s__par_omit -\cs_new_protected_nopar:Npn \galley_par: +\cs_new_protected:Npn \galley_par: { \s__par_omit \exp_after:wN \__galley_par_auxi: \exp:w \exp_end_continue_f:w @@ -238,7 +247,7 @@ #1 } } -\cs_new_protected_nopar:Npn \__galley_par_auxii: +\cs_new_protected:Npn \__galley_par_auxii: { \mode_if_vertical:TF { @@ -248,7 +257,8 @@ } { \g_galley_par_end_hook_tl - \__galley_par_set_cutout: + \bool_if:NT \g__galley_cutout_active_bool + { \__galley_parshape_set: } \group_begin: \tex_par:D \group_end: @@ -268,16 +278,7 @@ \tl_gclear:N \g_galley_par_reset_hook_tl \tex_penalty:D \c_ten_thousand } -\cs_new_protected_nopar:Npn \__galley_par_set_cutout: - { - \bool_if:nF - { - \seq_if_empty_p:N \g__galley_cutout_left_seq - && \seq_if_empty_p:N \g__galley_cutout_right_seq - } - { \__galley_parshape_set: } - } -\cs_new_protected_nopar:Npn \__galley_par_update_cutout: +\cs_new_protected:Npn \__galley_par_update_cutout: { \bool_if:nF { @@ -292,6 +293,15 @@ } \__galley_parshape_set: } + \int_compare:nNnT \l__galley_group_level_int = \etex_currentgrouplevel:D + { + \bool_if:nT + { + \seq_if_empty_p:N \g__galley_cutout_left_seq + && \seq_if_empty_p:N \g__galley_cutout_right_seq + } + { \bool_gset_false:N \g__galley_cutout_active_bool } + } } \cs_new_protected:Npn \galley_par:n #1 { @@ -302,9 +312,9 @@ \galley_par: } } -\cs_set_protected_nopar:Npn \par { \galley_par: } +\cs_set_protected:Npn \par { \galley_par: } \tl_set:Nn \@par { \galley_par: } -\cs_new_protected_nopar:Npn \galley_display_begin: +\cs_new_protected:Npn \galley_display_begin: { \group_begin: \__galley_save_parameters: @@ -343,19 +353,19 @@ \skip_gset:Nn \g_galley_vspace_int {#1} } } -\cs_new_protected_nopar:Npn \galley_display_end: +\cs_new_protected:Npn \galley_display_end: { \par \__galley_restore_parameters: \group_end: \group_insert_after:N \__galley_display_par_setup: } -\cs_new_protected_nopar:Npn \__galley_display_par_setup: +\cs_new_protected:Npn \__galley_display_par_setup: { \bool_gset_false:N \g_galley_omit_next_indent_bool \cs_set_eq:NN \par \__galley_display_par: } -\cs_new_protected_nopar:Npn \__galley_display_par: +\cs_new_protected:Npn \__galley_display_par: { \cs_set_eq:NN \par \galley_par: \mode_if_vertical:TF @@ -400,13 +410,13 @@ \tex_noindent:D \group_end: } -\cs_new_protected_nopar:Npn \__galley_start_paragraph_std: +\cs_new_protected:Npn \__galley_start_paragraph_std: { \__galley_start_paragraph_common:N \__galley_insert_vertical_items: \__galley_insert_horizontal_items: \__galley_restore_running_parameters: } -\cs_new_protected_nopar:Npn \__galley_start_paragraph_first: +\cs_new_protected:Npn \__galley_start_paragraph_first: { \bool_gset_false:N \g__galley_begin_level_bool \mode_if_horizontal:TF @@ -415,12 +425,12 @@ \__galley_insert_horizontal_items: \__galley_restore_running_parameters: } -\cs_new_protected_nopar:Npn \__galley_insert_vspace_first: +\cs_new_protected:Npn \__galley_insert_vspace_first: { \tl_if_empty:NF \g__galley_interpar_vspace_user_tl { \skip_vertical:n { \g__galley_interpar_vspace_user_tl } } } -\cs_new_protected_nopar:Npn \__galley_insert_vertical_items: +\cs_new_protected:Npn \__galley_insert_vertical_items: { \g_galley_whatsit_previous_tl \tl_gclear:N \g_galley_whatsit_previous_tl @@ -443,7 +453,7 @@ \tl_gclear:N \g__galley_interpar_vspace_user_tl } } -\cs_new_protected_nopar:Npn \__galley_insert_horizontal_items: +\cs_new_protected:Npn \__galley_insert_horizontal_items: { \g_galley_whatsit_next_tl \tl_gclear:N \g_galley_whatsit_next_tl @@ -456,7 +466,7 @@ \g_galley_par_begin_hook_tl \bool_gset_false:N \g_galley_omit_next_indent_bool } -\cs_new_protected_nopar:Npn \__galley_restore_running_parameters: +\cs_new_protected:Npn \__galley_restore_running_parameters: { \g_galley_restore_running_tl \tl_gclear:N \g_galley_restore_running_tl @@ -487,12 +497,12 @@ } \__galley_parshape_set: } -\cs_new_protected_nopar:Npn \galley_parshape_set_multi:nnnN +\cs_new_protected: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 +\cs_new_protected:Npn \galley_parshape_set_single:nnnN { \bool_set_false:N \l__galley_parshape_multipar_bool \__galley_parshape_set:nnnN @@ -515,9 +525,9 @@ } \__galley_parshape_set: } -\cs_new_protected_nopar:Npn \galley_cutout_left:nn +\cs_new_protected:Npn \galley_cutout_left:nn { \__galley_cutout:nnn { left } } -\cs_new_protected_nopar:Npn \galley_cutout_right:nn +\cs_new_protected:Npn \galley_cutout_right:nn { \__galley_cutout:nnn { right } } \cs_new_protected:Npn \__galley_cutout:nnn #1#2#3 { @@ -534,6 +544,8 @@ { \__galley_cutout:Nc \g__galley_tmpa_seq { g__galley_cutout_ #1 _seq } } \seq_gset_eq:cN { g__galley_cutout_ #1 _seq } \l__galley_tmp_seq } + \seq_if_empty:cF { g__galley_cutout_ #1 _seq } + { \bool_gset_true:N \g__galley_cutout_active_bool } } \cs_new_protected:Npn \__galley_cutout:NN #1#2 { @@ -547,24 +559,13 @@ } } \cs_generate_variant:Nn \__galley_cutout:NN { c , Nc } -\cs_new_protected_nopar:Npn \__galley_parshape_set: +\cs_new_protected:Npn \__galley_parshape_set: { \__galley_parshape_set_margins: \__galley_parshape_set_indents: \__galley_parshape_set_cutouts: - \tl_set:Nx \l__galley_tmp_tl - { - \__int_value:w \tex_parshape:D - \int_step_function:nnnN \c_one \c_one \tex_parshape:D - \tmp - } } - \def\tmp#1{% - \c_space_tl - \__int_value:w \etex_parshapeindent:D #1 \c_space_tl \c_space_tl - \__int_value:w \etex_parshapelength:D #1 \c_space_tl - } -\cs_new_protected_nopar:Npn \__galley_parshape_set_margins: +\cs_new_protected:Npn \__galley_parshape_set_margins: { \bool_if:nTF { @@ -579,7 +580,7 @@ \l_galley_text_width_dim } } -\cs_new_protected_nopar:Npn \__galley_parshape_set_indents: +\cs_new_protected:Npn \__galley_parshape_set_indents: { \bool_if:nF { @@ -608,7 +609,7 @@ \l_galley_text_width_dim - ( ( #1 ) + ( #2 ) ) \__dim_eval_end: } -\cs_new_protected_nopar:Npn \__galley_parshape_set_cutouts: +\cs_new_protected:Npn \__galley_parshape_set_cutouts: { \bool_if:nF { @@ -840,7 +841,7 @@ \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_auxii:n #1 { } -\cs_new_protected_nopar:Npn \__galley_calc_interline_penalties: +\cs_new_protected:Npn \__galley_calc_interline_penalties: { \exp_args:Nff \__galley_calc_interline_penalties:nn { @@ -910,7 +911,10 @@ } } \cs_new:Npn \__galley_save_display_widow_penalties:n #1 - { \__int_value:w \etex_displaywidowpenalties:D \__int_eval:w #1 \__int_eval_end: , } + { + \__int_value:w \etex_displaywidowpenalties:D + \__int_eval:w #1 \__int_eval_end: , + } \cs_new_protected:Npn \galley_save_widow_penalties:N #1 { \clist_set:Nx #1 @@ -922,11 +926,11 @@ } \cs_new:Npn \__galley_save_widow_penalties:n #1 { \__int_value:w \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , } -\cs_new_protected_nopar:Npn \galley_interline_penalty: +\cs_new_protected:Npn \galley_interline_penalty: { \__int_value:w \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero } \__msg_kernel_new:nnn { galley } { no-line-to-end } { There's~no~line~here~to~end. } -\cs_set_nopar:Npn \clearpage +\cs_set:Npn \clearpage { \mode_if_vertical:T { @@ -939,9 +943,9 @@ \newpage \galley_penalty_set_single:n { -\@Mi } } -\cs_set_nopar:Npn \nobreak +\cs_set_protected:Npn \nobreak { \bool_gset_true:N \g_galley_no_break_next_bool } -\cs_set_protected_nopar:Npn \noindent +\cs_set_protected:Npn \noindent { \tex_noindent:D \bool_gset_false:N \g_galley_omit_next_indent_bool @@ -971,9 +975,9 @@ \DeclareRobustCommand \newline { \galley_break_line:Nn \c_true_bool { 0pt } } \cs_set_eq:cN { @ @ par } \galley_par: -\cs_set_nopar:Npn \addpenalty { \galley_penalty_add_single:n } -\cs_set_nopar:Npn \addvspace { \galley_vspace_max_single:n } -\cs_set_nopar:Npn \@afterheading +\cs_set_protected:Npn \addpenalty { \galley_penalty_add_single:n } +\cs_set_protected:Npn \addvspace { \galley_vspace_max_single:n } +\cs_set_protected:Npn \@afterheading { \bool_gset_true:N \g_galley_no_break_next_bool \if@afterindent @@ -981,7 +985,7 @@ \bool_gset_true:N \g_galley_omit_next_indent_bool \fi } -\cs_set:Npn \@hangfrom #1 +\cs_set_protected:Npn \@hangfrom #1 { \bool_gset_true:N \g_galley_omit_next_indent_bool \leavevmode |