summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/xgalley
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-10 21:53:20 +0000
committerKarl Berry <karl@freefriends.org>2011-10-10 21:53:20 +0000
commit8fdc0d5c9ee743261c162302bdafbb83f9cfb542 (patch)
tree05e2062f23f57880ed2e0a26ad898e81b9d813be /Master/texmf-dist/tex/latex/l3experimental/xgalley
parentd2d088ff389655c2c3aad324760138895af2a9d3 (diff)
l3experimental 2900 (10oct11)
git-svn-id: svn://tug.org/texlive/trunk@24258 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.sty764
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty616
2 files changed, 1380 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
new file mode 100644
index 00000000000..b626f072d30
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
@@ -0,0 +1,764 @@
+%%
+%% This is file `l3galley.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% l3galley.dtx (with options: `package')
+%%
+%% EXPERIMENTAL CODE
+%%
+%% Do not distribute this file without also distributing the
+%% source files specified above.
+%%
+%% Do not distribute a modified version of this file.
+%%
+%% File: l3galley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach
+%% (C) 2010,2011 The LaTeX3 Project
+%%
+%% It may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License (LPPL), either version 1.3c of this
+%% license or (at your option) any later version. The latest version
+%% of this license is in the file
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This file is part of the "l3experimental bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%%
+%% The released version of this bundle is available from CTAN.
+%%
+%% -----------------------------------------------------------------------
+%%
+%% The development version of the bundle can be found at
+%%
+%% http://www.latex-project.org/svnroot/experimental/trunk/
+%%
+%% for those people who are interested.
+%%
+%%%%%%%%%%%
+%% NOTE: %%
+%%%%%%%%%%%
+%%
+%% Snapshots taken from the repository represent work in progress and may
+%% not work or may contain conflicting material! We therefore ask
+%% people _not_ to put them into distributions, archives, etc. without
+%% prior consultation with the LaTeX Project Team.
+%%
+%% -----------------------------------------------------------------------
+%%
+\RequirePackage{l3names}
+\GetIdInfo$Id: l3galley.dtx 2899 2011-10-09 21:22:06Z joseph $
+ {L3 Experimental galley code}
+\ProvidesExplPackage
+ {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+\package_check_loaded_expl:
+\cs_new_protected_nopar:Npn \galley_leave_vmode:
+ { \tex_unhbox:D \c_empty_box }
+\clist_new:N \l_galley_parshape_left_indent_clist
+\clist_new:N \l_galley_parshape_right_indent_clist
+\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
+\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
+\int_new:N \l_galley_interpar_penalty_int
+\skip_new:N \l_galley_interpar_vspace_skip
+\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
+\bool_gset_true:N \g_galley_begin_level_bool
+\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_nobreak_next_bool
+\bool_new:N \l_galley_nobreak_next_bool
+\tl_new:N \g_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_par_end_hook_tl
+\tl_new:N \g_galley_par_after_hook_tl
+\tl_new:N \l_galley_par_after_hook_tl
+\int_new:N \g_galley_previous_par_lines_int
+\int_new:N \l_galley_previous_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
+\tl_new:N \l_galley_whatsit_next_tl
+\tl_new:N \g_galley_whatsit_previous_tl
+\tl_new:N \l_galley_whatsit_previous_tl
+\tl_new:N \g_galley_interpar_penalty_user_tl
+\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:
+ {
+ \bool_gset_true:N \g_galley_begin_level_bool
+ \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_nobreak_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
+ \int_gzero:N \g_galley_previous_par_lines_int
+ \tl_gclear:N \g_galley_restore_running_tl
+ \tl_gclear:N \g_galley_whatsits_previous_tl
+ \tl_gclear:N \g_galley_whatsits_next_tl
+ }
+\cs_new_protected_nopar:Npn \galley_initialise_settings:
+ {
+ \dim_set_eq:NN \l_galley_text_width_dim \l_galley_width_dim
+ \dim_zero:N \l_galley_left_margin_dim
+ \dim_zero:N \l_galley_right_margin_dim
+ \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:
+ {
+ \bool_set_eq:NN \l_galley_begin_level_bool
+ \g_galley_begin_level_bool
+ \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
+ \g_galley_interpar_vspace_user_tl
+ \bool_set_eq:NN \l_galley_omit_next_indent_bool
+ \g_galley_omit_next_indent_bool
+ \bool_set_eq:NN \l_galley_nobreak_next_bool
+ \g_galley_nobreak_next_bool
+ \tl_set_eq:NN \l_galley_par_begin_hook_tl
+ \g_galley_par_begin_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
+ \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
+ \g_galley_restore_running_tl
+ \tl_set_eq:NN \l_galley_whatsits_previous_tl
+ \g_galley_whatsits_previous_tl
+ \tl_set_eq:NN \l_galley_whatsits_next_tl
+ \g_galley_whatsits_next_tl
+ }
+\cs_new_protected_nopar:Npn \galley_restore_parameters:
+ {
+ \bool_gset_eq:NN \g_galley_begin_level_bool
+ \l_galley_begin_level_bool
+ \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
+ \l_galley_interpar_vspace_user_tl
+ \bool_gset_eq:NN \g_galley_omit_next_indent_bool
+ \l_galley_omit_next_indent_bool
+ \bool_gset_eq:NN \g_galley_nobreak_next_bool
+ \l_galley_nobreak_next_bool
+ \tl_gset_eq:NN \g_galley_par_begin_hook_tl
+ \l_galley_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_galley_par_after_hook_tl
+ \bool_gset_eq:NN \g_galley_parshape_set_bool
+ \l_galley_parshape_set_bool
+ \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
+ \l_galley_restore_running_tl
+ \tl_gset_eq:NN \g_galley_whatsits_previous_tl
+ \l_galley_whatsits_previous_tl
+ \tl_gset_eq:NN \g_galley_whatsits_next_tl
+ \l_galley_whatsits_next_tl
+ }
+\cs_new_protected_nopar:Npn \galley_level:
+ {
+ \galley_save_parameters:
+ \group_begin:
+ \galley_initialise_variables:
+ \galley_initialise_settings:
+ \group_insert_after:N \galley_level_end:
+ }
+\cs_new_protected_nopar:Npn \galley_level_end:
+ {
+ \par
+ \galley_restore_parameters:
+ \group_end:
+ }
+\cs_new_protected_nopar:Npn \galley_std_par:
+ {
+ \mode_if_vertical:TF
+ { \tex_par:D }
+ {
+ \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
+ }
+ \g_galley_par_after_hook_tl
+ \tl_gclear:N \g_galley_par_after_hook_tl
+ \tex_penalty:D \c_ten_thousand
+ }
+\cs_set_protected_nopar:Npn \par { \galley_std_par: }
+\tl_set:Nn \@par { \galley_std_par: }
+\cs_new_protected_nopar:Npn \galley_display_begin:
+ {
+ \group_begin:
+ \galley_save_parameters:
+ \mode_if_vertical:TF
+ {
+ \galley_display_penalty:N \l_galley_display_begin_par_penalty_tl
+ \galley_display_vspace:N \l_galley_display_begin_par_vspace_tl
+ }
+ {
+ \galley_display_penalty:N \l_galley_display_begin_penalty_tl
+ \galley_display_vspace:N \l_galley_display_begin_vspace_tl
+ }
+ \par
+ }
+\cs_new_protected_nopar:Npn \galley_display_penalty:N #1
+ {
+ \tl_if_empty:NF #1
+ {
+ \tl_gput_right:Nx \g_galley_restore_running_tl
+ {
+ \int_gset:Nn \exp_not:N \g_galley_penalty_int
+ { \int_use:N \g_galley_penalty_int }
+ }
+ \int_gset:Nn \g_galley_penalty_int {#1}
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_display_vspace:N #1
+ {
+ \tl_if_empty:NF #1
+ {
+ \tl_gput_right:Nx \g_galley_restore_running_tl
+ {
+ \skip_gset:Nn \exp_not:N \g_galley_vspace_skip
+ { \skip_use:N \g_galley_vspace_skip }
+ }
+ \skip_gset:Nn \g_galley_vspace_int {#1}
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_display_end:
+ {
+ \par
+ \galley_restore_parameters:
+ \group_end:
+ \group_insert_after:N \group_insert_after:N
+ \group_insert_after:N \galley_display_par_setup:
+ }
+\cs_new_protected_nopar: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_set_eq:NN \par \galley_std_par:
+ \mode_if_vertical:TF
+ {
+ \par
+ \bool_gset_false:N \g_galley_omit_next_indent_bool
+ \galley_display_penalty:N \l_galley_display_end_par_penalty_tl
+ \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
+ \galley_display_penalty:N \l_galley_display_end_penalty_tl
+ \galley_display_vspace:N \l_galley_display_end_vspace_tl
+ }
+ }
+\cs_undefine:N \everypar
+\newtoks \everypar
+\AtBeginDocument
+ {
+ \tex_everypar:D
+ {
+ \bool_if:NTF \g_galley_begin_level_bool
+ { \galley_start_paragraph_first: }
+ { \galley_start_paragraph_std: }
+ \tex_the:D \everypar
+ }
+ }
+\box_new:N \g_galley_last_box
+\cs_new_protected_nopar:Npn \galley_start_paragraph_std:
+ {
+ \group_begin:
+ \box_gset_to_last:N \g_galley_last_box
+ \tex_par:D
+ \galley_insert_vertical_items:
+ \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:
+ }
+\cs_new_protected_nopar:Npn \galley_start_paragraph_first:
+ {
+ \bool_gset_false:N \g_galley_begin_level_bool
+ \mode_if_horizontal:TF
+ {
+ \group_begin:
+ \box_gset_to_last:N \g_galley_last_box
+ \tex_par:D
+ \galley_insert_vspace:
+ \tex_everypar:D { }
+ \tex_noindent:D
+ \group_end:
+ }
+ { \galley_insert_vspace: }
+ \galley_insert_horizontal_items:
+ \galley_restore_running_parameters:
+ }
+\cs_new_protected_nopar:Npn \galley_insert_vertical_items:
+ {
+ \g_galley_whatsit_previous_tl
+ \tl_gclear:N \g_galley_whatsit_previous_tl
+ \tl_if_empty:NTF \g_galley_interpar_penalty_user_tl
+ {
+ \bool_if:NTF \g_galley_nobreak_next_bool
+ { \tex_penalty:D \c_ten_thousand }
+ { \tex_penalty:D \l_galley_interpar_penalty_int }
+ }
+ {
+ \tex_penalty:D
+ \int_eval:w \g_galley_interpar_penalty_user_tl \int_eval_end:
+ \tl_gclear:N \g_galley_interpar_penalty_user_tl
+ }
+ \bool_gset_false:N \g_galley_nobreak_next_bool
+ \galley_insert_vspace:
+ }
+\cs_new_protected_nopar:Npn \galley_insert_vspace:
+ {
+ \tl_if_empty:NTF \g_galley_interpar_vspace_user_tl
+ { \skip_vertical:N \l_galley_interpar_vspace_skip }
+ {
+ \skip_vertical:n { \g_galley_interpar_vspace_user_tl }
+ \tl_gclear:N \g_galley_interpar_vspace_user_tl
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_insert_horizontal_items:
+ {
+ \g_galley_whatsit_next_tl
+ \tl_gclear:N \g_galley_whatsit_next_tl
+ \bool_if:NT \g_galley_omit_next_indent_bool
+ {
+ \box_if_empty:NF \g_galley_last_box
+ { \hbox_to_wd:nn \l_galley_par_indent_dim { } }
+ }
+ \skip_horizontal:N \l_galley_par_begin_skip
+ \g_galley_par_begin_hook_tl
+ \bool_gset_true:N \g_galley_omit_next_indent_bool
+ }
+\cs_new_protected_nopar:Npn \galley_restore_running_parameters:
+ {
+ \g_galley_restore_running_tl
+ \tl_gclear:N \g_galley_restore_running_tl
+ }
+\cs_new_protected_nopar:Npn \galley_margins_set_absolute:nn #1#2
+ {
+ \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
+ {
+ \l_galley_width_dim
+ - \l_galley_total_left_margin_dim
+ - \l_galley_total_right_margin_dim
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_margins_set_relative:nn #1#2
+ {
+ \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
+ {
+ \l_galley_width_dim
+ - \l_galley_total_left_margin_dim
+ - \l_galley_total_right_margin_dim
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_parshape_fixed_lines:nnn #1#2#3
+ {
+ \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
+ }
+\cs_new_protected_nopar:Npn \galley_parshape_multi_par:nnnN #1#2#3#4
+ {
+ \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
+ }
+\cs_new_protected_nopar:Npn \galley_parshape_single_par:nnnN #1#2#3#4
+ {
+ \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
+ }
+\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:
+ {
+ \bool_if:NTF \g_galley_parshape_set_bool
+ {
+ \bool_if:NTF \l_galley_parshape_fixed_lines_bool
+ {
+ \int_compare:nNnTF \g_galley_previous_par_lines_int > \c_zero
+ { \galley_generate_parshape_lines: }
+ { \galley_generate_parshape: }
+ }
+ {
+ \bool_gset_eq:NN \g_galley_parshape_set_bool
+ \l_galley_parshape_multipar_bool
+ \galley_generate_parshape:
+ }
+ }
+ {
+ \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
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_generate_parshape:
+ {
+ \tex_global:D \tex_parshape:D
+ \int_eval:w
+ \l_galley_parshape_std_lines_int +
+ \int_min:nn
+ { \clist_length:N \l_galley_parshape_left_indent_clist }
+ { \clist_length:N \l_galley_parshape_right_indent_clist }
+ \bool_if:NT \l_galley_parshape_resume_std_bool { + 1 }
+ \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
+ }
+ }
+\cs_new_nopar: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_nopar:Npn \galley_set_parshape_map_aux:nw
+ #1#2 , #3 \q_mark #4 , #5 \q_stop
+ {
+ \bool_if:nTF { \tl_if_empty_p:n {#3} || \tl_if_empty_p:n {#4} }
+ {
+ #1
+ \dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) }
+ \c_space_tl
+ \dim_eval:n { \l_galley_text_width_dim - ( ( #2 ) + ( #4 ) ) }
+ }
+ {
+ \galley_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
+ }
+ #3 \q_mark #5 \q_stop
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_generate_parshape_lines:
+ {
+ \int_compare:nNnTF \tex_parshape:D > \g_galley_previous_par_lines_int
+ {
+ \tex_global:D \tex_parshape:D
+ \int_eval:w \tex_parshape:D - \g_galley_previous_par_lines_int
+ \int_eval_end:
+ \prg_stepwise_function:nnnN
+ { \g_galley_previous_par_lines_int + \c_one }
+ \c_one \tex_parshape:D \galley_generate_parshape_lines_aux:n
+ }
+ {
+ \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
+ }
+ }
+\cs_new_nopar:Npn \galley_generate_parshape_lines_aux:n #1
+ {
+ \etex_parshapeindent:D #1
+ ~
+ \etex_parshapelength:D #1
+ }
+\cs_new_protected_nopar:Npn \galley_set_user_penalty:n #1
+ { \tl_gset:Nx \g_galley_interpar_penalty_user_tl { \int_eval:n {#1} } }
+\cs_new_protected_nopar:Npn \galley_set_user_vspace: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
+\skip_new:N \parskip
+\cs_new_eq:NN \l_galley_line_left_skip \tex_leftskip:D
+\cs_new_eq:NN \l_galley_line_right_skip \tex_rightskip:D
+\dim_new:N \l_galley_par_begin_skip
+\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_nopar:Npn \galley_set_interword_spacing:N #1
+ {
+ \bool_if:NTF #1
+ { % TODO Hook for font changes required!
+ \dim_compare:nNnTF { \tex_fontdimen:D \c_three \tex_font:D }
+ = \c_zero_dim
+ { \tex_spaceskip:D \c_zero_dim }
+ { \tex_spaceskip:D \tex_fontdimen:D \c_two \tex_font:D }
+ }
+ { \tex_spaceskip:D \c_zero_dim }
+ }
+\cs_new_eq:NN \l_galley_binop_penalty_int \tex_binoppenalty:D
+\cs_new_eq:NN \l_galley_double_hyphen_demerits_int \tex_doublehyphendemerits:D
+\cs_new_eq:NN \l_galley_emergency_stretch_skip \tex_emergencystretch:D
+\cs_new_eq:NN \l_galley_final_hyphen_demerits_int \tex_finalhyphendemerits:D
+\cs_new_eq:NN \l_galley_linebreak_badness_int \tex_hbadness:D
+\cs_new_eq:NN \l_galley_linebreak_fuzz_dim \tex_hfuzz:D
+\cs_new_eq:NN \l_galley_linebreak_penalty_int \tex_linepenalty:D
+\cs_new_eq:NN \l_galley_linebreak_pretolerance_int \tex_pretolerance:D
+\cs_new_eq:NN \l_galley_mismatch_demerits_int \tex_adjdemerits:D
+\cs_new_eq:NN \l_galley_relation_penalty_int \tex_relpenalty:D
+\cs_new_eq:NN \l_galley_linebreak_tolerance_int \tex_tolerance:D
+\cs_new_eq:NN \l_galley_broken_penalty_int \tex_brokenpenalty:D
+\cs_new_eq:NN \l_galley_interline_penalty_int \tex_interlinepenalty:D
+\cs_new_eq:NN \l_galley_parbreak_badness_int \tex_vbadness:D
+\cs_new_eq:NN \l_galley_parbreak_fuzz_dim \tex_vfuzz:D
+\cs_new_eq:NN \l_galley_post_display_penalty_int \tex_postdisplaypenalty:D
+\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_nopar:Npn \galley_set_display_widow_penalties:n #1
+ {
+ \etex_displaywidowpenalties:D
+ \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \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_nopar:Npn \galley_set_widow_penalties:n #1
+ {
+ \etex_widowpenalties:D
+ \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \clist_map_function:nN {#1} \galley_set_aux:n
+ \c_zero
+ }
+\cs_generate_variant:Nn \galley_set_widow_penalties:n { V , v }
+\cs_new_nopar:Npn \galley_set_aux:n #1 { #1 ~ }
+\cs_new_protected_nopar:Npn \galley_set_club_penalties: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_nopar:Npn \galley_set_interline_penalties: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_nopar:Npn \galley_set_display_club_penalties:n #1
+ {
+ \etex_clubpenalties:D
+ \int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
+ \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_nopar:Npn \galley_set_interline_penalty:n #1
+ {
+ \int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero
+ {
+ \etex_interlinepenalties:D \c_one \int_eval:w #1 \int_eval_end:
+ \galley_calc_interline_penalties:
+ }
+ {
+ \cs_set_nopar:Npn \galley_set_interline_penalty_aux_ii:n ##1
+ {
+ \int_eval:w
+ \etex_interlinepenalties:D ##1
+ - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
+ + #1
+ \int_eval_end:
+ }
+ \exp_args:Nf \galley_set_interline_penalty_aux:nn
+ { \clist_length:N \l_galley_line_penalties_clist } {#1}
+ }
+ }
+\cs_new_protected_nopar:Npn \galley_set_interline_penalty_aux:nn #1#2
+ {
+ \etex_interlinepenalties:D
+ \etex_interlinepenalties:D \c_zero
+ \prg_stepwise_function:nnnN \c_one \c_one {#1}
+ \galley_set_interline_penalty_aux_i:n
+ \prg_stepwise_function:nnnN { #1 + \c_one } \c_one
+ { \etex_interlinepenalties:D \c_zero - \c_one }
+ \galley_set_interline_penalty_aux_ii:n
+ \int_eval:w #2 \int_eval_end:
+ }
+\cs_new_nopar:Npn \galley_set_interline_penalty_aux_i:n #1
+ { \etex_interlinepenalties:D \int_eval:w #1 \int_eval_end: }
+\cs_new_nopar:Npn \galley_set_interline_penalty_aux_ii:n #1 { }
+\cs_new_protected_nopar:Npn \galley_calc_interline_penalties:
+ {
+ \exp_args:Nff \galley_calc_interline_penalties_aux:nn
+ {
+ \int_eval:n
+ {
+ \int_max:nn
+ {
+ \clist_length:N \l_galley_club_penalties_clist
+ + \c_one
+ }
+ {
+ \int_max:nn
+ {
+ \clist_length:N \l_galley_line_penalties_clist
+ + \c_one
+ }
+ { \etex_clubpenalties:D \c_zero }
+ }
+ }
+ }
+ { \clist_length:N \l_galley_line_penalties_clist }
+ }
+\cs_new_protected_nopar:Npn \galley_calc_interline_penalties_aux:nn
+ #1#2
+ {
+ \etex_interlinepenalties:D #1 ~
+ \prg_stepwise_function:nnnN \c_one \c_one {#2}
+ \galley_calc_interline_penalties_aux_i:n
+ \prg_stepwise_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one }
+ \galley_calc_interline_penalties_aux_ii:n
+ \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
+ }
+\cs_new_nopar:Npn \galley_calc_interline_penalties_aux_i:n
+ #1
+ {
+ \int_eval:w
+ \clist_item:Nn \l_galley_line_penalties_clist { #1 - \c_one }
+ + 0 \clist_item:Nn \l_galley_club_penalties_clist
+ { #1 - \c_one }
+ - \etex_clubpenalties:D #1 ~
+ \int_eval_end:
+ }
+\cs_new_nopar:Npn \galley_calc_interline_penalties_aux_ii:n
+ #1
+ {
+ \int_eval:w
+ \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
+ + 0 \clist_item:Nn \l_galley_club_penalties_clist
+ { #1 - \c_one }
+ - \etex_clubpenalties:D #1 ~
+ \int_eval_end:
+ }
+\cs_new_protected_nopar:Npn \galley_save_club_penalties:N #1
+ { \clist_set_eq:NN #1 \l_galley_club_penalties_clist }
+\cs_new_protected_nopar:Npn \galley_save_interline_penalties:N #1
+ { \clist_set_eq:NN #1 \l_galley_line_penalties_clist }
+\cs_new_protected_nopar:Npn \galley_save_display_club_penalties:N #1
+ {
+ \clist_set:Nx #1
+ {
+ \prg_stepwise_function:nnnN \c_one \c_one
+ { \etex_clubpenalties:D \c_zero - \c_one }
+ \galley_save_display_club_penalties:_aux:n
+ }
+ }
+\cs_new_nopar:Npn \galley_save_display_club_penalties:_aux:n #1
+ { \int_use:N \etex_clubpenaltes:D \int_eval:w #1 \int_eval_end: , }
+\cs_new_protected_nopar:Npn \galley_save_display_widow_penalties:N #1
+ {
+ \clist_set:Nx #1
+ {
+ \prg_stepwise_function:nnnN \c_one \c_one
+ { \etex_displaywidowpenalties:D \c_zero - \c_one }
+ \galley_save_display_widow_penalties:_aux:n
+ }
+ }
+\cs_new_nopar:Npn \galley_save_display_widow_penalties:_aux:n #1
+ { \int_use:N \etex_displaywidowpenalties:D \int_eval:w #1 \int_eval_end: , }
+\cs_new_protected_nopar:Npn \galley_save_widow_penalties:N #1
+ {
+ \clist_set:Nx #1
+ {
+ \prg_stepwise_function:nnnN \c_one \c_one
+ { \etex_widowpenalties:D \c_zero - \c_one }
+ \galley_save_widow_penalties:_aux:n
+ }
+ }
+\cs_new_nopar:Npn \galley_save_widow_penalties:_aux: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 }
+\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
+ \fi
+ }
+\cs_set_protected:Npn \@hangfrom #1
+ {
+ \setbox \@tempboxa = \hbox { {#1} }
+ \galley_parshape_single_par:nnnN
+ \c_one
+ { \box_wd:N \@tempboxa }
+ \c_zero_dim
+ \c_false_bool
+ \bool_gset_true:N \g_galley_no_break_next_bool
+ \bool_gset_true:N \galley_omit_next_indent_bool
+ \box \@tempboxa
+ }
+\cs_set_protected:Npn \@makefntext #1
+ {
+ \UseTemplate { justification } { std } { indent-width = 1 em }
+ \bool_gset_true:N \galley_omit_next_indent_bool
+ \galley_leave_vmode:
+ \hb@xt@ 1.8em { \hss \@makefnmark } #1
+ }
+%%
+%%
+%% End of file `l3galley.sty'.
diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
new file mode 100644
index 00000000000..160fca57631
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty
@@ -0,0 +1,616 @@
+%%
+%% This is file `xgalley.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xgalley.dtx (with options: `package')
+%%
+%% EXPERIMENTAL CODE
+%%
+%% Do not distribute this file without also distributing the
+%% source files specified above.
+%%
+%% Do not distribute a modified version of this file.
+%%
+%% File: xgalley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach
+%% (C) 2010,2011 The LaTeX3 Project
+%%
+%% It may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License (LPPL), either version 1.3c of this
+%% license or (at your option) any later version. The latest version
+%% of this license is in the file
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This file is part of the "l3experimental bundle" (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%%
+%% The released version of this bundle is available from CTAN.
+%%
+%% -----------------------------------------------------------------------
+%%
+%% The development version of the bundle can be found at
+%%
+%% http://www.latex-project.org/svnroot/experimental/trunk/
+%%
+%% for those people who are interested.
+%%
+%%%%%%%%%%%
+%% NOTE: %%
+%%%%%%%%%%%
+%%
+%% Snapshots taken from the repository represent work in progress and may
+%% not work or may contain conflicting material! We therefore ask
+%% people _not_ to put them into distributions, archives, etc. without
+%% prior consultation with the LaTeX Project Team.
+%%
+%% -----------------------------------------------------------------------
+%%
+\RequirePackage{l3names}
+\GetIdInfo$Id: xgalley.dtx 2895 2011-10-09 15:58:19Z joseph $
+ {L3 Experimental galley}
+\ProvidesExplPackage
+ {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+\RequirePackage{xparse,xtemplate,l3galley}
+\clist_new:N \l_galley_tmpa_clist
+\clist_new:N \l_galley_tmpb_clist
+\DeclareObjectType { measure } { 0 }
+\DeclareTemplateInterface { measure } { absolute } { 0 }
+ {
+ left-margin : length = 0 pt ,
+ right-margin : length = 0 pt
+ }
+\DeclareTemplateInterface { measure } { relative } { 0 }
+ {
+ left-margin : length = 0 pt ,
+ right-margin : length = 0 pt
+ }
+\cs_new_eq:NN \l_galley_left_margin_dim \leftmargin
+\cs_new_eq:NN \l_galley_right_margin_dim \rightmargin
+\DeclareTemplateCode { measure } { absolute } { 0 }
+ {
+ left-margin = \l_galley_left_margin_dim ,
+ right-margin = \l_galley_right_margin_dim
+ }
+ {
+ \AssignTemplateKeys
+ \galley_margins_set_absolute:nn \l_galley_left_margin_dim
+ \l_galley_right_margin_dim
+ }
+\DeclareTemplateCode { measure } { relative } { 0 }
+ {
+ left-margin = \l_galley_left_margin_dim ,
+ right-margin = \l_galley_right_margin_dim
+ }
+ {
+ \AssignTemplateKeys
+ \galley_margins_set_relative:nn \l_galley_left_margin_dim
+ \l_galley_right_margin_dim
+ }
+\DeclareObjectType { parshape } { 0 }
+\DeclareTemplateInterface { parshape } { hang } { 0 }
+ {
+ indent : length = 0 pt ,
+ on-left-side : boolean = true ,
+ lines : integer = 1
+ }
+\DeclareTemplateInterface { parshape } { initial } { 0 }
+ {
+ indent : length = 0 pt ,
+ on-left-side : boolean = true ,
+ lines : integer = 2
+ }
+\DeclareTemplateCode { parshape } { hang } { 0 }
+ {
+ indent = \l_galley_parshape_indent_dim ,
+ on-left-side = \l_galley_parshape_on_left_bool ,
+ lines = \l_galley_parshape_lines_int
+ }
+ {
+ \AssignTemplateKeys
+ \bool_if:NTF \l_galley_parshape_on_left_bool
+ {
+ \galley_parshape_single_par:nVVN
+ \l_galley_parshape_lines_int
+ \l_galley_parshape_indent_dim
+ \c_zero_dim
+ \c_false_bool
+ }
+ {
+ \galley_parshape_single_par:nVVN
+ \l_galley_parshape_lines_int
+ \c_zero_dim
+ \l_galley_parshape_indent_dim
+ \c_false_bool
+ }
+ }
+\DeclareTemplateCode { parshape } { initial } { 0 }
+ {
+ indent = \l_galley_parshape_indent_dim ,
+ on-left-side = \l_galley_parshape_on_left_bool ,
+ lines = \l_galley_parshape_lines_int
+ }
+ {
+ \AssignTemplateKeys
+ \clist_clear:N \l_galley_tmpa_clist
+ \clist_clear:N \l_galley_tmpb_clist
+ \prg_replicate:nn { \l_galley_parshape_lines_int }
+ {
+ \clist_put_right:Nn \l_galley_tmpa_clist
+ { \l_galley_parshape_indent_dim }
+ \clist_put_right:Nn \l_galley_tmpb_clist
+ { \c_zero_dim }
+ }
+ \bool_if:NTF \l_galley_parshape_on_left_bool
+ {
+ \galley_parshape_single_par:nVVN
+ \c_zero
+ \l_galley_tmpa_clist
+ \l_galley_tmpb_clist
+ \c_true_bool
+ }
+ {
+ \galley_parshape_single_par:nVVN
+ \c_zero
+ \l_galley_tmpb_clist
+ \l_galley_tmpa_clist
+ \c_true_bool
+ }
+ }
+\DeclareTemplateInterface { parshape } { std } { 0 } { }
+\DeclareTemplateCode { parshape } { std } { 0 } { } { }
+\DeclareObjectType { hyphenation } { 0 }
+\DeclareTemplateInterface { hyphenation } { std } { 0 }
+ {
+ enable : boolean = true ,
+ enable-upper-case : boolean = true ,
+ penalty : choice { low , medium , high } = low
+ }
+\DeclareTemplateCode { hyphenation } { std } { 0 }
+ {
+ enable = \l_galley_hyphen_enable_bool ,
+ enable-upper-case = \l_galley_hyphen_uppercase_bool ,
+ penalty =
+ {
+ low =
+ {
+ \int_set:Nn \tex_hyphenpenalty:D { 51 }
+ \int_set:Nn \tex_exhyphenpenalty:D { 51 }
+ } ,
+ medium =
+ {
+ \int_set:Nn \tex_hyphenpenalty:D { 151 }
+ \int_set:Nn \tex_exhyphenpenalty:D { 151 }
+ } ,
+ high =
+ {
+ \int_set:Nn \tex_hyphenpenalty:D { 301 }
+ \int_set:Nn \tex_exhyphenpenalty:D { 301 }
+ } ,
+ }
+ }
+ {
+ \AssignTemplateKeys
+ \int_set:Nn \tex_lefthyphenmin:D
+ {
+ \bool_if:NTF \l_galley_hyphen_enable_bool
+ { \l_galley_hyphen_left_int } { 63 }
+ }
+ \int_set:Nn \tex_uchyph:D
+ { \bool_if:NTF \l_galley_hyphen_uppercase_bool { 1 } { 0 } }
+ }
+\tex_defaulthyphenchar:D 45 \scan_stop:
+\tl_new:N \l_galley_justification_other_tl
+\DeclareObjectType { justification } { 0 }
+\DeclareTemplateInterface { justification } { std } { 0 }
+ {
+ end-skip : skip = 0 pt plus 1 fil ,
+ fixed-word-spacing : boolean = false ,
+ indent-width : length ,
+ left-skip : skip = 0 pt ,
+ right-skip : skip = 0 pt ,
+ start-skip : skip = 0 pt ,
+ stretch-last-line : boolean = false
+ }
+\DeclareTemplateInterface { justification } { single } { 0 }
+ {
+ end-skip : skip = 0 pt plus 1 fil ,
+ fixed-word-spacing : boolean = false ,
+ indent-width : length ,
+ left-skip : skip = 0 pt ,
+ right-skip : skip = 0 pt ,
+ start-skip : skip = 0 pt ,
+ stretch-last-line : boolean = false
+ }
+\DeclareTemplateCode { justification } { std } { 0 }
+ {
+ end-skip = \l_galley_par_end_skip ,
+ fixed-word-spacing = \l_galley_fixed_spacing_bool ,
+ indent-width = \l_galley_par_indent_dim ,
+ left-skip = \l_galley_line_left_skip ,
+ right-skip = \l_galley_line_right_skip ,
+ start-skip = \l_galley_par_begin_skip ,
+ stretch-last-line = \l_galley_par_stretch_last_bool
+ }
+ {
+ \AssignTemplateKeys
+ \tl_clear:N \l_galley_justification_other_tl
+ \galley_set_interword_spacing: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 }
+ \skip_set:Nn \@rightskip { \l_galley_line_right_skip }
+ }
+\DeclareTemplateCode { justification } { single } { 0 }
+ {
+ end-skip = \l_galley_par_end_skip ,
+ fixed-word-spacing = \l_galley_fixed_spacing_bool ,
+ indent-width = \l_galley_par_indent_dim ,
+ left-skip = \l_galley_line_left_skip ,
+ right-skip = \l_galley_line_right_skip ,
+ start-skip = \l_galley_par_begin_skip ,
+ stretch-last-line = \l_galley_par_stretch_last_bool
+ }
+ {
+ \tl_put_left:Nx \l_galley_justification_other_tl
+ {
+ \skip_set:Nn \exp_not:N \l_galley_par_end_skip
+ { \skip_use:N \l_galley_par_end_skip }
+ \bool_if:NTF \l_galley_fixed_spacing_bool
+ { \bool_set_true:N \exp_not:N \l_galley_fixed_spacing_bool }
+ { \bool_set_false:N \exp_not:N \l_galley_fixed_spacing_bool }
+ \galley_set_interword_space:N
+ \exp_not:N \l_galley_fixed_spacing_bool
+ \dim_set:Nn \exp_not:N \l_galley_par_indent_dim
+ { \dim_use:N \l_galley_par_indent_dim }
+ \skip_set:Nn \l_galley_line_left_skip
+ { \skip_use:N \l_galley_line_left_skip }
+ \skip_set:Nn \exp_not:N \l_galley_line_right_skip
+ { \skip_use:N \l_galley_line_right_skip }
+ \skip_set:Nn \exp_not:N \l_galley_par_start_skip
+ { \skip_use:N \l_galley_par_start_skip }
+ \int_set:Nn \exp_not:N \l_galley_last_line_fit_int
+ { \int_use:N \l_galley_last_line_fit_int }
+ \skip_set:Nn \exp_not:N \@rightskip
+ { \skip_use:N \l_galley_line_right_skip }
+ }
+ \tl_gput_right:Nn \g_galley_restore_running_tl
+ { \l_galley_justification_other_tl }
+ \AssignTemplateKeys
+ \galley_set_interword_spacing: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 }
+ \skip_set:Nn \@rightskip { \l_galley_line_right_skip }
+ }
+\DeclareInstance { justification } { justified } { std }
+ { indent-width = 15 pt }
+\UseInstance { justification } { justified }
+\DeclareInstance { justification } { noindent } { std }
+ {
+ end-skip = 15 pt plus 1 fil ,
+ indent-width = 0 pt
+ }
+\DeclareInstance { justification } { centered } { std }
+ {
+ end-skip = 0 pt ,
+ fixed-word-spacing = true ,
+ indent-width = 0 pt ,
+ left-skip = 0 pt plus 1 em ,
+ right-skip = 0 pt plus 1 em
+ }
+\DeclareInstance { justification } { ragged-left } { std }
+ {
+ end-skip = 0 pt ,
+ fixed-word-spacing = true ,
+ indent-width = 0 pt ,
+ left-skip = 0 pt plus 2 em ,
+ right-skip = 0 pt
+ }
+\DeclareInstance { justification } { ragged-right } { std }
+ {
+ end-skip = 0 pt plus 1 fil ,
+ fixed-word-spacing = true ,
+ indent-width = 0 pt ,
+ left-skip = 0 pt ,
+ right-skip = 0 pt plus 2 em
+ }
+\DeclareInstance { justification } { centering } { std }
+ {
+ end-skip = 0 pt ,
+ fixed-word-spacing = true ,
+ indent-width = 0 pt ,
+ left-skip = 0 pt plus 1 fil ,
+ right-skip = 0 pt plus 1 fil
+ }
+\DeclareTemplateInterface { justification } { compound } { 0 }
+ {
+ first-paragraph : instance { justification } ,
+ other-paragraphs : instance { justification }
+ }
+\DeclareTemplateCode { justification } { compound } { 0 }
+ {
+ first-paragraph = \galley_justification_first: ,
+ other-paragraphs = \galley_justification_other:
+ }
+ {
+ \AssignTemplateKeys
+ \galley_justification_first:
+ \tl_set:Nn \l_galley_justification_other_tl
+ { \galley_justification_other: }
+ \tl_gput_right:Nn \g_galley_restore_running_tl
+ { \l_galley_justification_other_tl }
+ }
+\DeclareObjectType { line-breaking } { 0 }
+\DeclareTemplateInterface { line-breaking } { std } { 0 }
+ {
+ badness : integer = 1000 ,
+ binop-penalty : integer = 700 ,
+ double-hyphen-demerits : integer = 10 000 ,
+ emergency-stretch : skip = 0 pt ,
+ final-hyphen-demerits : integer = 5000 ,
+ fuzz : length = 0.1 pt ,
+ line-penalty : integer = 10 ,
+ mismatch-demerits : integer = 10 000 ,
+ pretolerance : integer = 100 ,
+ relation-penalty : integer = 500 ,
+ tolerance : integer = 200
+ }
+\DeclareTemplateCode{ line-breaking } { std } { 0 }
+ {
+ badness = \l_galley_linebreak_badness_int ,
+ binop-penalty = \l_galley_binop_penalty_int ,
+ double-hyphen-demerits = \l_galley_double_hyphen_demerits_int ,
+ emergency-stretch = \l_galley_emergency_stretch_skip ,
+ final-hyphen-demerits = \l_galley_final_hyphen_demerits_int ,
+ fuzz = \l_galley_linebreak_fuzz_dim ,
+ line-penalty = \l_galley_linebreak_penalty_int ,
+ mismatch-demerits = \l_galley_mismatch_demerits_int ,
+ pretolerance = \l_galley_linebreak_pretolerance_int ,
+ relation-penalty = \l_galley_relation_penalty_int ,
+ tolerance = \l_galley_linebreak_tolerance_int
+ }
+ { \AssignTemplateKeys }
+\DeclareInstance { line-breaking } { std } { std } { }
+\UseInstance { line-breaking } { std }
+\DeclareObjectType { paragraph-breaking } { 0 }
+\DeclareTemplateInterface { paragraph-breaking } { std } { 0 }
+ {
+ badness : integer = 1000 ,
+ broken-penalty : integer = 100 ,
+ club-penalty : integer = 150 ,
+ display-club-penalty : integer = 150 ,
+ display-widow-penalty : integer = 150 ,
+ fuzz : length = 0.1 pt ,
+ interline-penalty : integer = 0 ,
+ post-display-penalty : integer = 0 ,
+ pre-display-penalty : integer = 10 000 ,
+ widow-penalty : integer = 150
+ }
+\DeclareTemplateCode { paragraph-breaking } { std } { 0 }
+ {
+ badness = \l_galley_parbreak_badness_int ,
+ broken-penalty = \l_galley_broken_penalty_int ,
+ club-penalty = \l_galley_club_penalty_int ,
+ display-club-penalty = \l_galley_display_club_penalty_int ,
+ display-widow-penalty = \l_galley_display_widow_penalty_int ,
+ fuzz = \l_galley_parbreak_fuzz_dim ,
+ interline-penalty = \l_galley_interline_penalty_int ,
+ post-display-penalty = \l_galley_post_display_penalty_int ,
+ pre-display-penalty = \l_galley_pre_display_penalty_int ,
+ widow-penalty = \l_galley_widow_penalty_int
+ }
+ {
+ \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
+ }
+\DeclareInstance { paragraph-breaking } { std } { std } { }
+\UseInstance { paragraph-breaking } { std }
+\DeclareInstance { paragraph-breaking } { nobreak } { std }
+ {
+ interline-penalty = 10 000 ,
+ post-display-penalty = 10 000
+ }
+\DeclareInstance { paragraph-breaking } { nolone } { std }
+ {
+ club-penalty = 10 000 ,
+ display-club-penalty = 10 000 ,
+ display-widow-penalty = 10 000 ,
+ widow-penalty = 10 000
+ }
+\DeclareTemplateInterface { paragraph-breaking } { single } { 0 }
+ {
+ badness : tokenlist ,
+ broken-penalty : tokenlist ,
+ club-penalty : tokenlist ,
+ display-club-penalty : tokenlist ,
+ display-widow-penalty : tokenlist ,
+ fuzz : tokenlist ,
+ interline-penalty : tokenlist ,
+ post-display-penalty : tokenlist ,
+ pre-display-penalty : tokenlist ,
+ widow-penalty : tokenlist
+ }
+\DeclareTemplateCode { paragraph-breaking } { single } { 0 }
+ {
+ badness = \l_galley_parbreak_badness_tl ,
+ broken-penalty = \l_galley_broken_penalty_tl ,
+ club-penalty = \l_galley_club_penalties_tl ,
+ display-club-penalty = \l_galley_display_club_penalties_tl ,
+ display-widow-penalty = \l_galley_display_widow_penalties_tl ,
+ fuzz = \l_galley_parbreak_fuzz_tl ,
+ interline-penalty = \l_galley_interline_penalty_tl ,
+ post-display-penalty = \l_galley_post_display_penalty_tl ,
+ pre-display-penalty = \l_galley_pre_display_penalty_tl ,
+ widow-penalty = \l_galley_widow_penalties_tl
+ }
+ {
+ \AssignTemplateKeys
+ \tl_if_empty:NF \l_galley_interline_penalty_tl
+ {
+ \tl_gput_right:Nx \g_galley_par_after_hook_tl
+ {
+ \int_set:Nn \exp_not:N \l_galley_interline_penalty_int
+ { \galley_interline_penalty: }
+ }
+ \int_set:Nn \l_galley_interline_penalty_int
+ { \l_galley_interline_penalty_tl }
+ }
+ \tl_if_empty:NF \l_galley_parbreak_fuzz_tl
+ {
+ \tl_gput_right:Nx \g_galley_par_after_hook_tl
+ {
+ \dim_set:Nn \exp_not:N \l_galley_parbreak_fuzz_dim
+ { \dim_use:N \l_galley_parbreak_fuzz_dim }
+ }
+ \dim_set:Nn \l_galley_parbreak_fuzz_dim { \l_galley_parbreak_fuzz_tl }
+ }
+ \seq_map_inline:Nn \c_galley_parbreak_single_seq
+ {
+ \tl_if_empty:cF { l_galley_ ##1 _tl }
+ {
+ \tl_gput_right:Nx \g_galley_par_after_hook_tl
+ {
+ \int_set:Nn \exp_not:c { l_galley_ ##1 _int }
+ { \int_use:c { l_galley_ ##1 _int } }
+ }
+ \int_set:cn { l_galley_ ##1 _int }
+ { \tl_use:c { l_galley_ ##1 _tl } }
+ }
+ }
+ \seq_map_inline:Nn \c_galley_parbreak_multi_seq
+ {
+ \tl_if_empty:cF { l_galley_ ##1 _tl }
+ {
+ \use:c { galley_save_ ##1 :N } \l_galley_tmpa_clist
+ \tl_gput_right:Nx \g_galley_par_after_hook_tl
+ {
+ \exp_not:c { galley_set_ ##1 :n }
+ { \exp_not:o \l_galley_tmpa_clist }
+ }
+ \use:c { galley_set_ ##1 :v } { l_galley_ ##1 _tl }
+ }
+ }
+ }
+\seq_new:N \c_galley_parbreak_multi_seq
+\seq_gput_right:Nn \c_galley_parbreak_multi_seq { club_penalties }
+\seq_gput_right:Nn \c_galley_parbreak_multi_seq { display_club_penalties }
+\seq_gput_right:Nn \c_galley_parbreak_multi_seq { display_widow_penalties }
+\seq_gput_right:Nn \c_galley_parbreak_multi_seq { widow_penalties }
+\seq_new:N \c_galley_parbreak_single_seq
+\seq_gput_right:Nn \c_galley_parbreak_single_seq { parbreak_badness }
+\seq_gput_right:Nn \c_galley_parbreak_single_seq { broken_penalty }
+\seq_gput_right:Nn \c_galley_parbreak_single_seq { post_display_penalty }
+\seq_gput_right:Nn \c_galley_parbreak_single_seq { pre_display_penalty }
+\DeclareInstance { paragraph-breaking } { single-std } { single } { }
+\DeclareInstance { paragraph-breaking } { single-nobreak } { single }
+ {
+ interline-penalty = 10 000 ,
+ post-display-penalty = 10 000
+ }
+\DeclareInstance { paragraph-breaking } { single-noclub } { single }
+ {
+ club-penalty = 10 000 ,
+ display-club-penalty = 10 000
+ }
+\DeclareInstance { paragraph-breaking } { single-nolone } { single }
+ {
+ club-penalty = 10 000 ,
+ display-club-penalty = 10 000 ,
+ display-widow-penalty = 10 000 ,
+ widow-penalty = 10 000
+ }
+\DeclareInstance { paragraph-breaking } { single-nowidow } { single }
+ {
+ display-widow-penalty = 10 000 ,
+ widow-penalty = 10 000
+ }
+\DeclareObjectType { display-begin } { 0 }
+\DeclareObjectType { display-end } { 0 }
+\DeclareTemplateInterface { display-begin } { std } { 0 }
+ {
+ par-penalty : tokenlist ,
+ par-space : tokenlist ,
+ penalty : tokenlist ,
+ space : tokenlist
+ }
+\DeclareTemplateInterface { display-end } { std } { 0 }
+ {
+ par-penalty : tokenlist ,
+ par-space : tokenlist ,
+ penalty : tokenlist ,
+ space : tokenlist
+ }
+\DeclareTemplateCode { display-begin } { std } { 0 }
+ {
+ par-penalty = \l_galley_display_begin_par_vpenalty_tl ,
+ par-space = \l_galley_display_begin_par_vspace_tl ,
+ penalty = \l_galley_display_begin_vpenalty_tl ,
+ space = \l_galley_display_begin_vspace_tl
+ }
+ {
+ \AssignTemplateKeys
+ \tl_if_empty:NF \l_galley_display_begin_par_vpenalty_tl
+ {
+ \tl_set:Nx \l_galley_display_begin_par_vpenalty_tl
+ { \int_eval:n { \l_galley_display_begin_par_vpenalty_tl } }
+ }
+ \tl_if_empty:NF \l_galley_display_begin_par_vspace_tl
+ {
+ \tl_set:Nx \l_galley_display_begin_par_vspace_tl
+ { \skip_eval:n { \l_galley_display_begin_par_vspace_tl } }
+ }
+ \tl_if_empty:NF \l_galley_display_begin_vpenalty_tl
+ {
+ \tl_set:Nx \l_galley_display_begin_vpenalty_tl
+ { \int_eval:n { \l_galley_display_begin_vpenalty_tl } }
+ }
+ \tl_if_empty:NF \l_galley_display_begin_vspace_tl
+ {
+ \tl_set:Nx \l_galley_display_begin_vspace_tl
+ { \skip_eval:n { \l_galley_display_begin_vspace_tl } }
+ }
+ }
+\DeclareTemplateCode { display-end } { std } { 0 }
+ {
+ par-penalty = \l_galley_display_end_par_vpenalty_tl ,
+ par-space = \l_galley_display_end_par_vspace_tl ,
+ penalty = \l_galley_display_end_vpenalty_tl ,
+ space = \l_galley_display_end_vspace_tl
+ }
+ {
+ \AssignTemplateKeys
+ \tl_if_empty:NF \l_galley_display_end_par_vpenalty_tl
+ {
+ \tl_set:Nx \l_galley_display_end_par_vpenalty_tl
+ { \int_eval:n { \l_galley_display_end_par_vpenalty_tl } }
+ }
+ \tl_if_empty:NF \l_galley_display_end_par_vspace_tl
+ {
+ \tl_set:Nx \l_galley_display_end_par_vspace_tl
+ { \skip_eval:n { \l_galley_display_end_par_vspace_tl } }
+ }
+ \tl_if_empty:NF \l_galley_display_end_vpenalty_tl
+ {
+ \tl_set:Nx \l_galley_display_end_vpenalty_tl
+ { \int_eval:n { \l_galley_display_end_vpenalty_tl } }
+ }
+ \tl_if_empty:NF \l_galley_display_end_vspace_tl
+ {
+ \tl_set:Nx \l_galley_display_end_vspace_tl
+ { \skip_eval:n { \l_galley_display_end_vspace_tl } }
+ }
+ }
+\RenewDocumentCommand \nobreak { }
+ { \bool_gset_true:N \g_galley_no_break_next_bool }
+\RenewDocumentCommand \noindent { }
+ { \bool_gset_false:N \g_galley_omit_next_indent_bool }
+\RenewDocumentCommand \vspace { s m } { \galley_set_vspace_user:n {#2} }
+%%
+%%
+%% End of file `xgalley.sty'.