[latex3-commits] [l3svn] branch master updated: More work on adding space in the galley
noreply at latex-project.org
noreply at latex-project.org
Sat May 14 21:45:16 CEST 2016
This is an automated email from the git hooks/post-receive script.
joseph pushed a commit to branch master
in repository l3svn.
The following commit(s) were added to refs/heads/master by this push:
new 07b645b More work on adding space in the galley
07b645b is described below
commit 07b645b69c2be849c359f78cb07991da26935512
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sat May 14 20:45:13 2016 +0100
More work on adding space in the galley
The set/add/max split is in galley2 so presumably the plan was to keep
it: overlooked earlier!
---
l3experimental/xgalley/l3galley.dtx | 82 +++++++++++++++++++++++++----------
1 file changed, 58 insertions(+), 24 deletions(-)
diff --git a/l3experimental/xgalley/l3galley.dtx b/l3experimental/xgalley/l3galley.dtx
index 77391a6..88c567e 100644
--- a/l3experimental/xgalley/l3galley.dtx
+++ b/l3experimental/xgalley/l3galley.dtx
@@ -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}
@@ -1966,7 +1975,14 @@
%
% \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 +1990,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_penalty_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:nNnF
+ { \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
@@ -2507,15 +2559,7 @@
\@vspace
\@vspace
}
-\cs_set:Npn \@vspace #1
- {
- \galley_vspace_set_single:n
- {
- \tl_if_empty:NF \g_@@_interpar_vspace_user_tl
- { \g_@@_interpar_vspace_user_tl + }
- #1
- }
- }
+\cs_set:Npn \@vspace #1 { \galley_vspace_add_single:n {#1} }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -2563,18 +2607,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:Npn \addvspace #1
- {
- \tl_if_empty:NTF \g_@@_interpar_vspace_user_tl
- { \galley_vspace_set_single:n {#1} }
- {
- \dim_compare:nNnF
- { \etex_glueexpr:D \g_@@_interpar_vspace_user_tl }
- > { \etex_glueexpr:D #1 \scan_stop: }
- { \galley_vspace_set_single:n {#1} }
- }
- }
+\cs_set_nopar:Npn \addpenalty { \galley_penalty_add_single:n }
+\cs_set_nopar:Npn \addvspace { \galley_vspace_max_single:n }
% \end{macrocode}
%\end{macro}
%
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the latex3-commits
mailing list