summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty112
1 files changed, 66 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
index d95d1b691d5..590062f47ae 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty
@@ -14,7 +14,7 @@
%% 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
+%% (C) 2010-2012 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
@@ -47,8 +47,8 @@
%%
%% -----------------------------------------------------------------------
%%
-\RequirePackage{l3names}
-\GetIdInfo$Id: l3galley.dtx 3205 2012-01-18 22:09:05Z joseph $
+\RequirePackage{xparse}
+\GetIdInfo$Id: l3galley.dtx 3253 2012-01-28 14:59:55Z joseph $
{L3 Experimental galley code}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -252,7 +252,7 @@
}
\par
}
-\cs_new_protected_nopar:Npn \galley_display_penalty:N #1
+\cs_new_protected:Npn \galley_display_penalty:N #1
{
\tl_if_empty:NF #1
{
@@ -264,7 +264,7 @@
\int_gset:Nn \g_galley_penalty_int {#1}
}
}
-\cs_new_protected_nopar:Npn \galley_display_vspace:N #1
+\cs_new_protected:Npn \galley_display_vspace:N #1
{
\tl_if_empty:NF #1
{
@@ -397,7 +397,7 @@
\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
+\cs_new_protected: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}
@@ -408,7 +408,7 @@
- \l_galley_total_right_margin_dim
}
}
-\cs_new_protected_nopar:Npn \galley_margins_set_relative:nn #1#2
+\cs_new_protected: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}
@@ -419,7 +419,7 @@
- \l_galley_total_right_margin_dim
}
}
-\cs_new_protected_nopar:Npn \galley_parshape_fixed_lines:nnn #1#2#3
+\cs_new_protected: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
@@ -428,7 +428,7 @@
\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
+\cs_new_protected: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
@@ -438,7 +438,7 @@
\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
+\cs_new_protected: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
@@ -503,13 +503,12 @@
\dim_use:N \l_galley_text_width_dim
}
}
-\cs_new_nopar:Npn \galley_set_parshape_map:nn #1#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_nopar:Npn \galley_set_parshape_map_aux:nw
- #1#2 , #3 \q_mark #4 , #5 \q_stop
+\cs_new: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} }
+ \bool_if:nTF { \tl_if_empty_p:n {#3} || \tl_if_empty_p:n {#5} }
{
#1
\dim_eval:n { \l_galley_total_left_margin_dim + ( #2 ) }
@@ -548,15 +547,15 @@
\dim_use:N \l_galley_text_width_dim
}
}
-\cs_new_nopar:Npn \galley_generate_parshape_lines_aux:n #1
+\cs_new: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
+\cs_new_protected: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
+\cs_new_protected: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
@@ -567,7 +566,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_nopar:Npn \galley_set_interword_spacing:N #1
+\cs_new_protected:Npn \galley_set_interword_spacing:N #1
{
\bool_if:NTF #1
{ % TODO Hook for font changes required!
@@ -578,6 +577,8 @@
}
{ \tex_spaceskip:D \c_zero_dim }
}
+\int_new:N \l_galley_hyphen_left_int
+\int_set:Nn \l_galley_hyphen_left_int { \tex_lefthyphenmin:D }
\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
@@ -589,6 +590,21 @@
\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_protected:Npn \galley_break_line:Nn #1#2
+ {
+ \mode_if_vertical:TF
+ { \msg_kernel_error:nn { galley } { no-line-to-end } }
+ {
+ \tex_unskip:D
+ \bool_if:NF #1
+ { \tex_vadjust:D { \tex_penalty:D \c_ten_thousand } }
+ \dim_compare:nNnF {#2} = \c_zero_dim
+ { \tex_vadjust:D { \skip_vertical:n {#2} } }
+ \tex_penalty:D \c_ten_thousand
+ \tex_hfil:D
+ \tex_penalty:D -\c_ten_thousand
+ }
+ }
\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
@@ -597,7 +613,7 @@
\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
+\cs_new_protected:Npn \galley_set_display_widow_penalties:n #1
{
\etex_displaywidowpenalties:D
\int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
@@ -605,7 +621,7 @@
\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
+\cs_new_protected:Npn \galley_set_widow_penalties:n #1
{
\etex_widowpenalties:D
\int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
@@ -613,20 +629,20 @@
\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
+\cs_new:Npn \galley_set_aux:n #1 { #1 ~ }
+\cs_new_protected: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
+\cs_new_protected: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
+\cs_new_protected:Npn \galley_set_display_club_penalties:n #1
{
\etex_clubpenalties:D
\int_eval:w \clist_length:n {#1} + \c_one \int_eval_end:
@@ -635,7 +651,7 @@
\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
+\cs_new_protected:Npn \galley_set_interline_penalty:n #1
{
\int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero
{
@@ -643,7 +659,7 @@
\galley_calc_interline_penalties:
}
{
- \cs_set_nopar:Npn \galley_set_interline_penalty_aux_ii:n ##1
+ \cs_set:Npn \galley_set_interline_penalty_aux_ii:n ##1
{
\int_eval:w
\etex_interlinepenalties:D ##1
@@ -655,7 +671,7 @@
{ \clist_length:N \l_galley_line_penalties_clist } {#1}
}
}
-\cs_new_protected_nopar:Npn \galley_set_interline_penalty_aux:nn #1#2
+\cs_new_protected:Npn \galley_set_interline_penalty_aux:nn #1#2
{
\etex_interlinepenalties:D
\etex_interlinepenalties:D \c_zero
@@ -666,9 +682,9 @@
\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
+\cs_new: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: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
@@ -692,8 +708,7 @@
}
{ \clist_length:N \l_galley_line_penalties_clist }
}
-\cs_new_protected_nopar:Npn \galley_calc_interline_penalties_aux:nn
- #1#2
+\cs_new_protected:Npn \galley_calc_interline_penalties_aux:nn #1#2
{
\etex_interlinepenalties:D #1 ~
\prg_stepwise_function:nnnN \c_one \c_one {#2}
@@ -702,8 +717,7 @@
\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
+\cs_new:Npn \galley_calc_interline_penalties_aux_i:n #1
{
\int_eval:w
\clist_item:Nn \l_galley_line_penalties_clist { #1 - \c_one }
@@ -712,8 +726,7 @@
- \etex_clubpenalties:D #1 ~
\int_eval_end:
}
-\cs_new_nopar:Npn \galley_calc_interline_penalties_aux_ii:n
- #1
+\cs_new:Npn \galley_calc_interline_penalties_aux_ii:n #1
{
\int_eval:w
\etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero
@@ -722,11 +735,11 @@
- \etex_clubpenalties:D #1 ~
\int_eval_end:
}
-\cs_new_protected_nopar:Npn \galley_save_club_penalties:N #1
+\cs_new_protected: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
+\cs_new_protected: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
+\cs_new_protected:Npn \galley_save_display_club_penalties:N #1
{
\clist_set:Nx #1
{
@@ -735,9 +748,9 @@
\galley_save_display_club_penalties:_aux:n
}
}
-\cs_new_nopar:Npn \galley_save_display_club_penalties:_aux:n #1
+\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_protected_nopar:Npn \galley_save_display_widow_penalties:N #1
+\cs_new_protected:Npn \galley_save_display_widow_penalties:N #1
{
\clist_set:Nx #1
{
@@ -746,9 +759,9 @@
\galley_save_display_widow_penalties:_aux:n
}
}
-\cs_new_nopar:Npn \galley_save_display_widow_penalties:_aux:n #1
+\cs_new: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
+\cs_new_protected:Npn \galley_save_widow_penalties:N #1
{
\clist_set:Nx #1
{
@@ -757,23 +770,29 @@
\galley_save_widow_penalties:_aux:n
}
}
-\cs_new_nopar:Npn \galley_save_widow_penalties:_aux:n #1
+\cs_new: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 \nobreak
+\msg_kernel_new:nnn { galley } { no-line-to-end }
+ { There's~no~line~here~to~end. }
+\RenewDocumentCommand \nobreak { }
{ \bool_gset_true:N \g_galley_no_break_next_bool }
-\cs_set_protected_nopar:Npn \noindent
+\RenewDocumentCommand \noindent { }
{
\tex_noindent:D
\bool_gset_false:N \g_galley_omit_next_indent_bool
}
-\cs_set_protected_nopar:Npn \vspace #1
+\RenewDocumentCommand \vspace { m }
{
\@ifstar
{ \galley_set_user_vspace:n {#1} }
{ \galley_set_user_vspace:n {#1} }
}
+\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 \@@par \galley_std_par:
\cs_set_protected_nopar:Npn \@afterheading
{
@@ -797,6 +816,7 @@
\bool_gset_true:N \g_galley_omit_next_indent_bool
\box \@tempboxa
}
+\cs_set_eq:Nc \@normalcr { \token_to_str:N \\ }
%%
%%
%% End of file `l3galley.sty'.