[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add .muskip:(N|c) (fixes #565) (d422260)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun May 5 22:28:06 CEST 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/d422260cd914981961b0d3e48ee36f6445526cd2

>---------------------------------------------------------------

commit d422260cd914981961b0d3e48ee36f6445526cd2
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun May 5 21:27:25 2019 +0100

    Add .muskip:(N|c) (fixes #565)


>---------------------------------------------------------------

d422260cd914981961b0d3e48ee36f6445526cd2
 l3kernel/CHANGELOG.md            |    4 +++
 l3kernel/l3keys.dtx              |   25 ++++++++++++++++
 l3kernel/testfiles/m3keys002.lvt |   58 +++++++++++++++++++++++++++++++++++++-
 l3kernel/testfiles/m3keys002.tlg |   46 +++++++++++++++++++++++++-----
 4 files changed, 125 insertions(+), 8 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 099a1fc..ee291e4 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,10 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Added
+
+- `.muskip:N` property
+
 ## [2019-05-05]
 
 ### Added
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index 28718aa..a266804 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -382,6 +382,16 @@
 %   Choices are discussed in detail in section~\ref{sec:l3keys:choice}.
 % \end{function}
 %
+% \begin{function}[added = 2019-05-05]
+%   {.muskip_set:N, .muskip_set:c, .muskip_gset:N, .muskip_gset:c}
+%   \begin{syntax}
+%     \meta{key} .muskip_set:N = \meta{muskip}
+%   \end{syntax}
+%   Defines \meta{key} to set \meta{muskip} to \meta{value} (which
+%   must be a muskip expression). If the variable does not exist, it
+%   is created globally at the point that the key is set up.
+% \end{function}
+%
 % \begin{function}[added = 2019-01-31]
 %   {.prop_put:N, .prop_put:c, .prop_gput:N, .prop_gput:c}
 %   \begin{syntax}
@@ -1997,6 +2007,21 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{.muskip_set:N, .muskip_set:c, .muskip_gset:N, .muskip_gset:c}
+%   Setting a variable is very easy: just pass the data along.
+%    \begin{macrocode}
+\cs_new_protected:cpn { \c_@@_props_root_tl .muskip_set:N } #1
+  { \@@_variable_set:NnnN #1 { muskip } { } n }
+\cs_new_protected:cpn { \c_@@_props_root_tl .muskip_set:c } #1
+  { \@@_variable_set:cnnN {#1} { muskip } { } n }
+\cs_new_protected:cpn { \c_@@_props_root_tl .muskip_gset:N } #1
+  { \@@_variable_set:NnnN #1 { muskip } { g } n }
+\cs_new_protected:cpn { \c_@@_props_root_tl .muskip_gset:c } #1
+  { \@@_variable_set:cnnN {#1} { muskip } { g } n }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{.prop_put:N, .prop_put:c, .prop_gput:N, .prop_gput:c}
 %   Setting a variable is very easy: just pass the data along.
 %    \begin{macrocode}
diff --git a/l3kernel/testfiles/m3keys002.lvt b/l3kernel/testfiles/m3keys002.lvt
index 279fcef..641fb3f 100644
--- a/l3kernel/testfiles/m3keys002.lvt
+++ b/l3kernel/testfiles/m3keys002.lvt
@@ -1,4 +1,4 @@
-% Copyright (C) 2013,2015,2018 The LaTeX3 Project
+% Copyright (C) 2013,2015,2018,2019 The LaTeX3 Project
 
 
 \documentclass{minimal}
@@ -297,6 +297,62 @@
     \fp_log:N \g_mya_fp
   }
 
+\TEST { .muskip_set:N }
+  {
+    \keys_define:nn { module }
+      {
+        key-one   .muskip_set:N  = \l_tmpa_muskip ,
+        key-two   .muskip_set:N  = \l_tmpb_muskip  ,
+        key-three .muskip_gset:N = \g_tmpa_muskip ,
+        key-four  .muskip_gset:N = \g_tmpb_muskip  ,
+      }
+    \group_begin:
+      \keys_set:nn { module }
+        {
+          key-one   = 1mu ,
+          key-two   = 2mu ,
+          key-three = 3mu ,
+          key-four  = 4mu ,
+        }
+      \muskip_log:N \l_tmpa_muskip
+      \muskip_log:N \l_tmpb_muskip
+      \muskip_log:N \g_tmpa_muskip
+      \muskip_log:N \g_tmpb_muskip
+    \group_end:
+    \muskip_log:N \l_tmpa_muskip
+    \muskip_log:N \l_tmpb_muskip
+    \muskip_log:N \g_tmpa_muskip
+    \muskip_log:N \g_tmpb_muskip
+  }
+
+\TEST { .skip_set:c }
+  {
+    \keys_define:nn { module }
+      {
+        key-one   .muskip_set:c  = { l_tmpa_muskip } ,
+        key-two   .muskip_set:c  = { l_tmpb_muskip }  ,
+        key-three .muskip_gset:c = { g_tmpa_muskip } ,
+        key-four  .muskip_gset:c = { g_tmpb_muskip }  ,
+      }
+    \group_begin:
+      \keys_set:nn { module }
+        {
+          key-one   = 1mu ,
+          key-two   = 2mu ,
+          key-three = 3mu ,
+          key-four  = 4mu ,
+        }
+      \muskip_log:N \l_tmpa_muskip
+      \muskip_log:N \l_tmpb_muskip
+      \muskip_log:N \g_tmpa_muskip
+      \muskip_log:N \g_tmpb_muskip
+    \group_end:
+    \muskip_log:N \l_tmpa_muskip
+    \muskip_log:N \l_tmpb_muskip
+    \muskip_log:N \g_tmpa_muskip
+    \muskip_log:N \g_tmpb_muskip
+  }
+
 \TEST { .skip_set:N }
   {
     \keys_define:nn { module }
diff --git a/l3kernel/testfiles/m3keys002.tlg b/l3kernel/testfiles/m3keys002.tlg
index 85571c5..51f337a 100644
--- a/l3kernel/testfiles/m3keys002.tlg
+++ b/l3kernel/testfiles/m3keys002.tlg
@@ -244,7 +244,39 @@ Defining key module/key-four on line ...
 > \g_mya_fp=76.38888888888888.
 ============================================================
 ============================================================
-TEST 11: .skip_set:N
+TEST 11: .muskip_set:N
+============================================================
+Defining key module/key-one on line ...
+Defining key module/key-two on line ...
+Defining key module/key-three on line ...
+Defining key module/key-four on line ...
+> \l_tmpa_muskip=1.0mu.
+> \l_tmpb_muskip=2.0mu.
+> \g_tmpa_muskip=3.0mu.
+> \g_tmpb_muskip=4.0mu.
+> \l_tmpa_muskip=0.0mu.
+> \l_tmpb_muskip=0.0mu.
+> \g_tmpa_muskip=3.0mu.
+> \g_tmpb_muskip=4.0mu.
+============================================================
+============================================================
+TEST 12: .skip_set:c
+============================================================
+Defining key module/key-one on line ...
+Defining key module/key-two on line ...
+Defining key module/key-three on line ...
+Defining key module/key-four on line ...
+> \l_tmpa_muskip=1.0mu.
+> \l_tmpb_muskip=2.0mu.
+> \g_tmpa_muskip=3.0mu.
+> \g_tmpb_muskip=4.0mu.
+> \l_tmpa_muskip=0.0mu.
+> \l_tmpb_muskip=0.0mu.
+> \g_tmpa_muskip=3.0mu.
+> \g_tmpb_muskip=4.0mu.
+============================================================
+============================================================
+TEST 13: .skip_set:N
 ============================================================
 Defining key module/key-one on line ...
 Defining \l_mya_skip on line ...
@@ -264,7 +296,7 @@ Defining key module/key-four on line ...
 > \g_mya_skip=40.0pt plus 10.0pt.
 ============================================================
 ============================================================
-TEST 12: .skip_set:c
+TEST 14: .skip_set:c
 ============================================================
 Defining key module/key-one on line ...
 Defining key module/key-two on line ...
@@ -280,7 +312,7 @@ Defining key module/key-four on line ...
 > \g_mya_skip=40.0pt plus 5.0pt.
 ============================================================
 ============================================================
-TEST 13: .tl_set:N
+TEST 15: .tl_set:N
 ============================================================
 Defining key module/key-one on line ...
 Defining \l_mya_tl on line ...
@@ -298,7 +330,7 @@ Defining key module/key-four on line ...
 > \g_mya_tl=bar.
 ============================================================
 ============================================================
-TEST 14: .tl_set:c
+TEST 16: .tl_set:c
 ============================================================
 Defining key module/key-one on line ...
 Defining key module/key-two on line ...
@@ -314,7 +346,7 @@ Defining key module/key-four on line ...
 > \g_mya_tl=barbar.
 ============================================================
 ============================================================
-TEST 15: .tl_set_x:N
+TEST 17: .tl_set_x:N
 ============================================================
 Defining key module/key-one on line ...
 Defining key module/key-two on line ...
@@ -330,7 +362,7 @@ Defining key module/key-four on line ...
 > \g_mya_tl=foo.
 ============================================================
 ============================================================
-TEST 16: .tl_set_x:c
+TEST 18: .tl_set_x:c
 ============================================================
 Defining key module/key-one on line ...
 Defining key module/key-two on line ...
@@ -346,7 +378,7 @@ Defining key module/key-four on line ...
 > \g_mya_tl=foobar.
 ============================================================
 ============================================================
-TEST 17: .prop_put:N
+TEST 19: .prop_put:N
 ============================================================
 Defining key module/key-one on line ...
 Defining \l_mya_prop on line ...





More information about the latex3-commits mailing list