summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx80
1 files changed, 62 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
index 5e8185bd7b2..a35de8f7643 100644
--- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx
@@ -38,8 +38,8 @@
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2016/04/20]
-%<package>\@ifpackagelater{expl3}{2016/04/20}
+\RequirePackage{expl3}[2016/05/14]
+%<package>\@ifpackagelater{expl3}{2016/05/14}
%<package> {}
%<package> {%
%<package> \PackageError{l3galley}{Support package l3kernel too old}
@@ -51,7 +51,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: l3galley.dtx 6476 2016-04-20 19:46:45Z joseph $
+\GetIdInfo$Id: l3galley.dtx 6493 2016-05-14 21:08:13Z joseph $
{L3 Experimental galley code}
%</driver|package>
%<*driver>
@@ -227,20 +227,29 @@
% \begin{function}{\galley_penalty_set_single:n}
% \begin{syntax}
% \cs{galley_penalty_set_single:n} \Arg{penalty}
+% \cs{galley_penalty_add_single:n} \Arg{penalty}
% \end{syntax}
% Sets the \meta{penalty} for a break between the current and next
% paragraph on a one-off basis. This function is intended for user-level
% adjustments to design, and takes precedent over both settings from
% \cs{l_galley_interpar_penalty_int} and from \cs{galley_no_break_next:}.
+% The \texttt{add} variant adds the penalty to any existing values.
% \end{function}
%
-% \begin{function}{\galley_vspace_set_single:n}
+% \begin{function}
+% {
+% \galley_vspace_set_single:n ,
+% \galley_vspace_add_single:n ,
+% \galley_vspace_max_single:n
+% }
% \begin{syntax}
% \cs{galley_vspace_set_single:n} \Arg{space}
% \end{syntax}
% Sets the \meta{space} to be inserted between the current and next
% paragraph on a one-off basis. This function is intended for user-level
-% adjustments to design.
+% adjustments to design. The \texttt{add} and \texttt{max} variants add
+% to the existing spacing and set to the maximum of the existing value
+% and the argument, respectively.
% \end{function}
%
% \subsection{Paragraph shape}
@@ -909,7 +918,6 @@
\int_new:N \l_@@_current_par_lines_int
% \end{macrocode}
% \end{variable}
-% \end{variable}
%
% \begin{variable}{\g_galley_restore_running_tl, \l_@@_restore_running_tl}
% When a parameter is altered from the \enquote{running} value to a
@@ -1249,7 +1257,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\galley_par:n}
% Inserts tokens such that they are appended to the end of the last
@@ -1767,8 +1774,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \subsection{Setting the primitive paragraph shape}
%
@@ -1962,11 +1967,17 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \subsection{Between paragraphs}
%
-% \begin{macro}{\galley_penalty_set_single:n, \galley_vspace_set_single:n}
+% \begin{macro}
+% {
+% \galley_penalty_set_single:n,
+% \galley_penalty_add_single:n,
+% \galley_vspace_set_single:n,
+% \galley_vspace_add_single:n,
+% \galley_vspace_max_single:n
+% }
% User supplied penalties and spaces only apply for a single paragraph.
% In both cases, the input values need to be checked for the correct
% form but are stored as token lists. The \texttt{x}-type expansion
@@ -1974,10 +1985,46 @@
% \begin{macrocode}
\cs_new_protected:Npn \galley_penalty_set_single:n #1
{ \tl_gset:Nx \g_@@_interpar_penalty_user_tl { \int_eval:n {#1} } }
+\cs_new_protected:Npn \galley_penalty_add_single:n #1
+ {
+ \tl_gset:Nx \g_@@_interpar_penalty_user_tl
+ {
+ \int_eval:n
+ {
+ \tl_if_empty:NF \g_@@_interpar_penalty_user_tl
+ { \g_@@_interpar_penalty_user_tl + }
+ #1
+ }
+ }
+ }
\cs_new_protected:Npn \galley_vspace_set_single:n #1
{ \tl_gset:Nx \g_@@_interpar_vspace_user_tl { \skip_eval:n {#1} } }
+\cs_new_protected:Npn \galley_vspace_add_single:n #1
+ {
+ \tl_gset:Nx \g_@@_interpar_vspace_user_tl
+ {
+ \skip_eval:n
+ {
+ \tl_if_empty:NF \g_@@_interpar_vspace_user_tl
+ { \g_@@_interpar_vspace_user_tl + }
+ #1
+ }
+ }
+ }
+\cs_new_protected:Npn \galley_vspace_max_single:n #1
+ {
+ \tl_if_empty:NTF \g_@@_interpar_vspace_user_tl
+ { \galley_vspace_set_single:n {#1} }
+ {
+ \dim_compare:nNnT
+ { \etex_glueexpr:D \g_@@_interpar_vspace_user_tl }
+ < { \etex_glueexpr:D #1 \scan_stop: }
+ { \galley_vspace_set_single:n {#1} }
+ }
+ }
% \end{macrocode}
% \end{macro}
+%
%
% \begin{macro}{\parskip}
% For the package, the \cs{parskip} primitive is moved out of the
@@ -2472,9 +2519,6 @@
}
}
\newpage
- \tl_gput_right:Nn \g_galley_whatsit_next_tl
- { \iow_shipout:Nx \c_minus_one { } }
- \tex_vbox:D { }
\galley_penalty_set_single:n { -\@Mi }
}
% \end{macrocode}
@@ -2503,14 +2547,14 @@
% \begin{macrocode}
% At present we don't have a proper handling for the starred version
% of \tn{vspace}: just ignore it for the moment!
-% \end{macrocode}
+% \begin{macrocode}
\DeclareRobustCommand \vspace
{
\@ifstar
\@vspace
\@vspace
}
-\cs_set:Npn \@vspace #1 { \galley_vspace_set_single:n {#1} }
+\cs_set:Npn \@vspace #1 { \galley_vspace_add_single:n {#1} }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -2558,8 +2602,8 @@
% \begin{macro}{\addpenalty, \addvspace}
% The mechanism here is entirely different, but at least this works!
% \begin{macrocode}
-\cs_set_nopar:Npn \addpenalty { \galley_penalty_set_single:n }
-\cs_set_nopar:Npn \addvspace { \galley_vspace_set_single:n }
+\cs_set_nopar:Npn \addpenalty { \galley_penalty_add_single:n }
+\cs_set_nopar:Npn \addvspace { \galley_vspace_max_single:n }
% \end{macrocode}
%\end{macro}
%