[latex3-commits] [git/LaTeX3-latex3-latex3] master: xbox: \underline should use same rule/sep as the primitive (139399216)

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


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

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

commit 139399216fb585d4c8e2933d653ca7f811227ea5
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Aug 25 18:03:58 2020 +0100

    xbox: \underline should use same rule/sep as the primitive


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

139399216fb585d4c8e2933d653ca7f811227ea5
 l3trial/xbox/xbox.dtx | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/l3trial/xbox/xbox.dtx b/l3trial/xbox/xbox.dtx
index 011fb849f..3bd0dfcc8 100644
--- a/l3trial/xbox/xbox.dtx
+++ b/l3trial/xbox/xbox.dtx
@@ -180,8 +180,10 @@
 %     \cs{underline}\marg{content}
 %   \end{syntax}
 %   In text mode, inserts the \meta{content} in a horizontal box and underlines
-%   it with a rule of width \cs{fboxrule} and separation \cs{fboxsep}. In math
-%   mode, uses the \TeX{} math mode primitive to directly underline content.
+%   it. In math mode, uses the \TeX{} math mode primitive to directly underline
+%   content. Both cases use font dimension $8$ of the extension font
+%   (|\textfont3|) to determine the line thickness and separation from the
+%   content.
 % \end{function}
 %
 % \section{Typesetting material in frames}
@@ -518,17 +520,19 @@
 %   ( \meta{content} )$. See also \cs{hbox_frame:nnn}.
 % \end{function}
 %
-% \begin{function}{\hbox_underline:nnn, \hbox_underline:nVV}
+% \begin{function}{\hbox_underline:nnn}
 %   \begin{syntax}
 %     \cs{hbox_underline:nnn} \Arg{content} \Arg{thickness} \Arg{border}
 %   \end{syntax}
 %   Inserts the \meta{content} in a horizontal box and underlines
 %   with a rule of \meta{thickness}. A \meta{border} is left between the
-%   \meta{content} and the frame. The frame will overprint any part of the
-%   \meta{content} which lies outside of the bounding box at natural size
-%   (\emph{i.e.}~the frame is printed \enquote{after} the \meta{content}).
-%   The apparent size of the inserted box includes the frame and the border,
-%   this affects only the depth (contrast with \cs{hbox_frame:nnn}).
+%   \meta{content} and the underline. The underline will overprint any part
+%   of the \meta{content} which lies outside of the bounding box at natural
+%   size (\emph{i.e.}~the frame is printed \enquote{after} the \meta{content}).
+%   The apparent size of the inserted box includes the underline and the
+%   border, this affects only the depth (contrast with \cs{hbox_frame:nnn}).
+%   The underline is placed relative to the \emph{baseline} of the content,
+%   not the \emph{bottom}.
 % \end{function}
 %
 % \begin{function}{\hbox_line_left:n, \hbox_line_center:n, \hbox_line_right:n}
@@ -1169,13 +1173,12 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\hbox_underline:nnn, \hbox_underline:nVV}
+% \begin{macro}{\hbox_underline:nnn}
 % \begin{macro}{\@@_underline:nnn, \@@_underline:ffn}
 %   Much like framing, but with only one line.
 %    \begin{macrocode}
 \cs_new_protected:Npn \hbox_underline:nnn #1#2#3
   { \@@_underline:ffn { \dim_eval:n {#2} } { \dim_eval:n {#3} } {#1} }
-\cs_generate_variant:Nn \hbox_underline:nnn { nVV }
 \cs_new_protected:Npn \@@_underline:nnn #1#2#3
   {
     \group_begin:
@@ -1393,6 +1396,7 @@
 %    \begin{macrocode}
 \RenewDocumentCommand \raisebox { m o o +m }
   {
+    \mode_leave_vertical:
     \IfNoValueTF {#2}
       { \xbox_raise:nn {#1} {#4} }
       {
@@ -1410,9 +1414,15 @@
 %    \begin{macrocode}
 \RenewDocumentCommand \underline { m }
   {
+    \mode_leave_vertical:
     \mode_if_math:TF
       { \tex_underline:D {#1} }
-      { \hbox_underline:nVV {#1} \fboxrule \fboxsep }
+      {
+        \check at mathfonts
+        \hbox_underline:nnn {#1}
+          {   \tex_fontdimen:D 8 ~ \tex_textfont:D 3 ~ }
+          { 3 \tex_fontdimen:D 8 ~ \tex_textfont:D 3 ~ }
+      }
   }
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list.