[latex3-commits] [git/LaTeX3-latex3-latex3] master: xbox: Add \rule (efd5e98da)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Aug 25 22:03:40 CEST 2020


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

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

commit efd5e98dadf1e393a762212a9d0e42febf902a03
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Aug 25 21:03:40 2020 +0100

    xbox: Add \rule
    
    Also re-arrange the args to \rule:nnn


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

efd5e98dadf1e393a762212a9d0e42febf902a03
 l3trial/xbox/xbox.dtx | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/l3trial/xbox/xbox.dtx b/l3trial/xbox/xbox.dtx
index 3bd0dfcc8..1eee452e2 100644
--- a/l3trial/xbox/xbox.dtx
+++ b/l3trial/xbox/xbox.dtx
@@ -322,6 +322,16 @@
 %   of the content is aligned with the current typesetting baseline.
 % \end{function}
 %
+% \section{Other box-like commands}
+%
+% \begin{function}{\rule}
+%   \begin{syntax}
+%     \cs{rule}\oarg{raised}\marg{width}\marg{height}
+%   \end{syntax}
+%   Inserts a rule of \meta{width} and \meta{height}, \meta{raised}
+%   if specified.
+% \end{function}
+%
 % \section{Plain \TeX{} commands inherited by \LaTeX{}}
 %
 % \begin{function}{\clap, \llap, \rlap}
@@ -578,7 +588,7 @@
 %
 % \begin{function}{\rule:nnn}
 %   \begin{syntax}
-%     \cs{rule:nnn} \Arg{height} \Arg{depth} \Arg{width}
+%     \cs{rule:nnn} \Arg{width} \Arg{height} \Arg{depth}
 %   \end{syntax}
 %   Inserts a rule of \meta{height}, \meta{depth} and \meta{width}
 %   (all dimension expressions) in horizontal mode. The vertical dimensions
@@ -1265,9 +1275,9 @@
     \hbox:n
       {
         \tex_vrule:D
-          height \dim_eval:n {#1} \exp_stop_f:
-          depth  \dim_eval:n {#2} \exp_stop_f:
-          width  \dim_eval:n {#3} \exp_stop_f:
+          height \dim_eval:n {#2} \exp_stop_f:
+          depth  \dim_eval:n {#3} \exp_stop_f:
+          width  \dim_eval:n {#1} \exp_stop_f:
       }
   }
 \cs_new_protected:Npn \rule_horizontal:nn #1#2
@@ -1408,6 +1418,16 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\rule}
+
+%    \begin{macrocode}
+\RenewDocumentCommand \rule { O { 0pt } m m }
+  {
+    \mode_leave_vertical:
+  }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\underline}
 %   In text mode, this is like \cs{framebox}, in math mode there is a
 %   primitive (which ideally needs a new name).
@@ -1540,7 +1560,7 @@
 \RenewDocumentCommand \rule { O { 0pt } m m }
   {
     \mode_leave_vertical:
-    \rule:nnn  { #1 + ( #3 ) } { 0pt - ( #1 ) } {#2}
+    \rule:nnn {#2} { #3 + #1 } { -#1 }
   }
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list.