[latex3-commits] [latex3/latex3] main: Improvements suggested by Ruixi Zhang (see #1217) (98e464cbe)

github at latex-project.org github at latex-project.org
Fri May 26 09:38:11 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/98e464cbe0add39a0f5e3f10230bf673af86392c

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

commit 98e464cbe0add39a0f5e3f10230bf673af86392c
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Fri May 26 08:36:39 2023 +0100

    Improvements suggested by  Ruixi Zhang (see #1217)


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

98e464cbe0add39a0f5e3f10230bf673af86392c
 l3kernel/l3skip.dtx | 43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/l3kernel/l3skip.dtx b/l3kernel/l3skip.dtx
index d4bf78de5..1893b97bf 100644
--- a/l3kernel/l3skip.dtx
+++ b/l3kernel/l3skip.dtx
@@ -491,7 +491,7 @@
 %   \end{syntax}
 %   Evaluates the \meta{dim expr}, and leaves the result,
 %   expressed in points (\texttt{pt}) in the input stream, with \emph{no
-%     units}.  The result is rounded by \TeX{} to four or five decimal
+%     units}.  The result is rounded by \TeX{} at most five decimal
 %   places.  If the decimal part of the result is zero, it is omitted,
 %   together with the decimal marker.
 %
@@ -525,7 +525,7 @@
 %      \begin{verbatim}
 %        \dim_compare:nNnTF
 %          { <x>bp } =
-%            { \dim_to_decimal_in_bp:n { <x>bp } }
+%            { \dim_to_decimal_in_bp:n { <x>bp } bp }
 %      \end{verbatim}
 %      will be logically \texttt{true}. The decimal representations may
 %      differ provided they produce the same \TeX{} dimension.
@@ -553,28 +553,33 @@
 %   The maximum \TeX{} allowable dimension value (available as
 %   \tn{maxdimen} in plain \TeX{} and \LaTeX{} and \cs{c_max_dim} in
 %   \pkg{expl3}) can only be expressed exactly in the units
-%   \texttt{pt}, \texttt{bp} and \texttt{sp}. Expressed in different units,
-%   the maximum allowable input value to five decimal places is\\
+%   \texttt{pt}, \texttt{bp} and \texttt{sp}. The maximum allowable
+%   input values to five decimal places are\\
 %   \begin{center}
 %     \begin{tabular}{@{}>{$}r<{$}@{\,}l@{}}
 %      1276.00215 & cc \\
 %       575.83174 & cm \\
-%       226.70540 & in \\
 %     15312.02584 & dd \\
+%       226.70540 & in \\
 %      5758.31742 & mm \\
 %      1365.33333 & pc \\
 %     \end{tabular}
 %   \end{center}
+%   (Note that these are not all equal, but rather any larger value will overflow
+%   due to the way \TeX{} converts to \texttt{sp}.)
 %   Values given to five decimal places larger that these will result in \TeX{}
 %   errors; the behavior if additional decimal places are given depends on the
 %   \TeX{} internals and thus larger values are \emph{not} supported by
 %   \pkg{expl3}.
 %   \begin{texnote}
-%      The implementation of this functions is re-entrant: the result of
+%      The implementation of these functions is re-entrant: the result of
 %      \begin{verbatim}
-%        \dim_to_decimal_in_<unit>:n { <n><unit> }
+%        \dim_compare:nNnTF
+%          { <x><unit> } =
+%            { \dim_to_decimal_in_<unit>:n { <x><unit> } <unit> }
 %      \end{verbatim}
-%      will be the value \meta{n}.
+%      will be logically \texttt{true}. The decimal representations may
+%      differ provided they produce the same \TeX{} dimension.
 %   \end{texnote}
 % \end{function}
 %
@@ -587,7 +592,7 @@
 %   units}.  The result is necessarily an integer.
 % \end{function}
 %
-% \begin{function}[added = 2014-07-15, EXP]
+% \begin{function}[added = 2014-07-15, updated = 2023-05-20, EXP]
 %   {\dim_to_decimal_in_unit:nn}
 %   \begin{syntax}
 %     \cs{dim_to_decimal_in_unit:nn} \Arg{dim expr_1} \Arg{dim expr_2}
@@ -606,11 +611,11 @@
 %   leaves |0.35278| in the input stream, \emph{i.e.}~the magnitude of
 %   one big point when expressed in millimetres. The conversions do
 %   \emph{not} guarantee that \TeX{} would yield identical results
-%   for the direct input in an equality test, hence
+%   for the direct input in an equality test, thus for instance
 %   \begin{verbatim}
 %     \dim_compare:nNnTF
-%       { \dim_to_decimal_in_unit:nn { 1bp } { 1mm } mm }
-%       { 1bp }
+%       { 1bp } =
+%         { \dim_to_decimal_in_unit:nn { 1bp } { 1mm } mm }
 %   \end{verbatim}
 %   will take the \texttt{false} branch.
 % \end{function}
@@ -1757,7 +1762,7 @@
 % The code to do this is contributed by Ruixi Zhang.
 %
 % \begin{macro}[EXP]{\dim_to_decimal_in_sp:n}
-%   The one eeasy case: the only requirement here is that we avoid an
+%   The one easy case: the only requirement here is that we avoid an
 %   overflow.
 %    \begin{macrocode}
 \cs_new:Npn \dim_to_decimal_in_sp:n #1
@@ -1801,7 +1806,7 @@
 %   (1)~$\hbox{midpoint}+\frac{1}{2}>N$ and
 %   (2)~$\hbox{midpoint}+\frac{1}{2}<N+1$. In other words,
 %   $N=\lfloor\hbox{midpoint}+\frac{1}{2}\rfloor$. As long as we can
-%   rewrite the midpoint as the result of a ``scaling operation'' of \eTeX,
+%   rewrite the midpoint as the result of a \enquote{scaling operation} of \eTeX,
 %   the $\lfloor\ldots+\frac{1}{2}\rfloor$ part will follow naturally.
 %   Indeed we can: $\hbox{midpoint}=(2X+1)\times(\frac{1}{2}\delta^{-1})$.
 %
@@ -1828,7 +1833,9 @@
 %   Conversions to other units are now coded.
 %   Consult the pdf\/\TeX{} source for each conversion factor~$\delta$.
 %   Each factor $\frac{1}{2}\delta^{-1}$ is hand-coded
-%   for accuracy (and speed).
+%   for accuracy (and speed). As the units \texttt{nc} and \texttt{nd}
+%   are not supported by \XeTeX{} or (u)p\TeX{}, they are not included
+%   here.
 %    \begin{macrocode}
   \@@_tmp:w { in } {   50 /  7227 } % delta = 7227/100
   \@@_tmp:w { pc } {    1 /    24 } % delta = 12/1
@@ -1890,7 +1897,7 @@
 %   |<number2>;{<dimexpr1>}|, where |<number2>| represents |<dimexpr2>| in
 %   |sp| unit.
 %   If |#1| is~|0|$_{12}$, the \enquote{unit} |<dimexpr2>| must also be zero.
-%   So we throw out a ``division by zero'' error message at this point.
+%   So we throw out a \enquote{division by zero} error message at this point.
 %   Otherwise, if |#1| is~|-|$_{12}$, we shall negate both |<dimexpr1>| and
 %   |<dimexpr2>| for later procedures.
 %    \begin{macrocode}
@@ -1953,8 +1960,8 @@
 %   output $q+R'/65536$ in decimal.
 %
 %   Note: $q=\lfloor X/n\rfloor=\lfloor\frac{2X-n}{2n}+\frac{1}{2}\rfloor$
-%   represents the ``integer'' part, while $0\le R'\le65536$ represents the
-%   ``fractional'' part. (Can $R'=65536$ really happen? Didn't investigate.)
+%   represents the \enquote{integer} part, while $0\le R'\le65536$ represents the
+%   \enquote{fractional} part. (Can $R'=65536$ really happen? Didn't investigate.)
 %    \begin{macrocode}
 \cs_new:Npn \@@_branch_unit:w #1;#2;
   {





More information about the latex3-commits mailing list.