[latex3-commits] [git/LaTeX3-latex3-latex3] gh899: Implement \box_ht_plus_dp:N (fixes #899) (8b0106e00)
Bruno Le Floch
blflatex at gmail.com
Tue May 4 22:57:15 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : gh899
Link : https://github.com/latex3/latex3/commit/8b0106e00977e0a84b164bd971e8ae43b7408a42
>---------------------------------------------------------------
commit 8b0106e00977e0a84b164bd971e8ae43b7408a42
Author: Bruno Le Floch <blflatex at gmail.com>
Date: Tue May 4 22:57:15 2021 +0200
Implement \box_ht_plus_dp:N (fixes #899)
>---------------------------------------------------------------
8b0106e00977e0a84b164bd971e8ae43b7408a42
l3kernel/CHANGELOG.md | 1 +
l3kernel/l3candidates.dtx | 21 +++++++++++++++++++++
l3kernel/testfiles/m3box001.lvt | 4 +++-
l3kernel/testfiles/m3box001.ptex.tlg | 10 ++++++++--
l3kernel/testfiles/m3box001.tlg | 10 ++++++++--
l3kernel/testfiles/m3box001.uptex.tlg | 10 ++++++++--
6 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 66550a2ac..cb5deed4c 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -12,6 +12,7 @@ this project uses date-based 'snapshot' version identifiers.
- `\ur{...}` escape in `l3regex` to compose regexes
- `\seq_set_split_keep_spaces:Nnn` (see #784)
- `\seq_set_item:Nnn(TF)` and `\seq_pop_item:NnN(TF)`
+- `\box_ht_plus_dp:N` (issue #899)
### Changed
- Use prevailing catcodes instead of string in regex replacement (issue #621)
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 6cfb0d745..6ca22b96d 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -146,6 +146,14 @@
% operation is applied.
% \end{function}
%
+% \begin{function}[added = 2021-05-05]{\box_ht_plus_dp:N, \box_ht_plus_dp:c}
+% \begin{syntax}
+% \cs{box_ht_plus_dp:N} \meta{box}
+% \end{syntax}
+% Calculates the total vertical size (height plus depth) of the \meta{box}
+% in a form suitable for use in a \meta{dimension expression}.
+% \end{function}
+%
% \section{Additions to \pkg{l3expan}}
%
% \begin{function}[added = 2018-04-04, updated = 2019-02-08]
@@ -861,6 +869,19 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\box_ht_plus_dp:N}
+% The \cs{box_ht:N} and \cs{box_dp:N} primitives do not expand but
+% rather are suitable for use after \tn{the} or inside dimension
+% expressions. Here we obtain the same behaviour by using
+% \cs{@@_dim_eval:n} (basically \tn{dimexpr}) rather than
+% \cs{dim_eval:n} (basically \tn{the} \tn{dimexpr}).
+% \begin{macrocode}
+\cs_new_protected:Npn \box_ht_plus_dp:N #1
+ { \@@_dim_eval:n { \box_ht:N #1 + \box_dp:N #1 } }
+\cs_generate_variant:Nn \box_ht_plus_dp:N { c }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3flag}}
%
% \begin{macrocode}
diff --git a/l3kernel/testfiles/m3box001.lvt b/l3kernel/testfiles/m3box001.lvt
index 4e0feb694..ea45cf406 100644
--- a/l3kernel/testfiles/m3box001.lvt
+++ b/l3kernel/testfiles/m3box001.lvt
@@ -246,12 +246,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\TEST{Sizes}{
\OMIT
- \hbox_set:Nn \l_tempa_box {a}
+ \hbox_set:Nn \l_tempa_box {g}
\TIMO
\dim_show:n { \box_ht:N \l_tempa_box }
\dim_show:n { \box_ht:c {l_tempa_box} }
\dim_show:n { \box_dp:N \l_tempa_box }
\dim_show:n { \box_dp:c {l_tempa_box} }
+ \dim_show:n { \box_ht_plus_dp:N \l_tempa_box * 2 }
+ \dim_show:n { \box_ht_plus_dp:c {l_tempa_box} * 2 }
\dim_show:n { \box_wd:N \l_tempa_box }
\dim_show:n { \box_wd:c {l_tempa_box} }
}
diff --git a/l3kernel/testfiles/m3box001.ptex.tlg b/l3kernel/testfiles/m3box001.ptex.tlg
index adf9b9ccb..3b0a17ad6 100644
--- a/l3kernel/testfiles/m3box001.ptex.tlg
+++ b/l3kernel/testfiles/m3box001.ptex.tlg
@@ -270,10 +270,16 @@ l. ...}
> \box_ht:c {l_tempa_box}=4.30554pt.
<recently read> }
l. ...}
-> \box_dp:N \l_tempa_box =0.0pt.
+> \box_dp:N \l_tempa_box =1.94444pt.
<recently read> }
l. ...}
-> \box_dp:c {l_tempa_box}=0.0pt.
+> \box_dp:c {l_tempa_box}=1.94444pt.
+<recently read> }
+l. ...}
+> \box_ht_plus_dp:N \l_tempa_box *2=12.49997pt.
+<recently read> }
+l. ...}
+> \box_ht_plus_dp:c {l_tempa_box}*2=12.49997pt.
<recently read> }
l. ...}
> \box_wd:N \l_tempa_box =5.00002pt.
diff --git a/l3kernel/testfiles/m3box001.tlg b/l3kernel/testfiles/m3box001.tlg
index 8ef0179b4..8af891c31 100644
--- a/l3kernel/testfiles/m3box001.tlg
+++ b/l3kernel/testfiles/m3box001.tlg
@@ -270,10 +270,16 @@ l. ...}
> \box_ht:c {l_tempa_box}=4.30554pt.
<recently read> }
l. ...}
-> \box_dp:N \l_tempa_box =0.0pt.
+> \box_dp:N \l_tempa_box =1.94444pt.
<recently read> }
l. ...}
-> \box_dp:c {l_tempa_box}=0.0pt.
+> \box_dp:c {l_tempa_box}=1.94444pt.
+<recently read> }
+l. ...}
+> \box_ht_plus_dp:N \l_tempa_box *2=12.49997pt.
+<recently read> }
+l. ...}
+> \box_ht_plus_dp:c {l_tempa_box}*2=12.49997pt.
<recently read> }
l. ...}
> \box_wd:N \l_tempa_box =5.00002pt.
diff --git a/l3kernel/testfiles/m3box001.uptex.tlg b/l3kernel/testfiles/m3box001.uptex.tlg
index adf9b9ccb..3b0a17ad6 100644
--- a/l3kernel/testfiles/m3box001.uptex.tlg
+++ b/l3kernel/testfiles/m3box001.uptex.tlg
@@ -270,10 +270,16 @@ l. ...}
> \box_ht:c {l_tempa_box}=4.30554pt.
<recently read> }
l. ...}
-> \box_dp:N \l_tempa_box =0.0pt.
+> \box_dp:N \l_tempa_box =1.94444pt.
<recently read> }
l. ...}
-> \box_dp:c {l_tempa_box}=0.0pt.
+> \box_dp:c {l_tempa_box}=1.94444pt.
+<recently read> }
+l. ...}
+> \box_ht_plus_dp:N \l_tempa_box *2=12.49997pt.
+<recently read> }
+l. ...}
+> \box_ht_plus_dp:c {l_tempa_box}*2=12.49997pt.
<recently read> }
l. ...}
> \box_wd:N \l_tempa_box =5.00002pt.
More information about the latex3-commits
mailing list.