summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3skip.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3skip.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3skip.dtx65
1 files changed, 37 insertions, 28 deletions
diff --git a/macros/latex/contrib/l3kernel/l3skip.dtx b/macros/latex/contrib/l3kernel/l3skip.dtx
index bf174f74dd..23d32a1b87 100644
--- a/macros/latex/contrib/l3kernel/l3skip.dtx
+++ b/macros/latex/contrib/l3kernel/l3skip.dtx
@@ -44,7 +44,7 @@
% }^^A
% }
%
-% \date{Released 2023-05-22}
+% \date{Released 2023-06-05}
%
% \maketitle
%
@@ -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{} to at most five decimal
% places. If the decimal part of the result is zero, it is omitted,
% together with the decimal marker.
%
@@ -510,7 +510,7 @@
% \end{syntax}
% Evaluates the \meta{dim expr}, and leaves the result,
% expressed in big points (\texttt{bp}) 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{} to at most five decimal
% places. If the decimal part of the result is zero, it is omitted,
% together with the decimal marker.
%
@@ -521,11 +521,14 @@
% leaves |0.99628| in the input stream, \emph{i.e.}~the magnitude of
% one (\TeX{}) point when converted to big points.
% \begin{texnote}
-% The implementation of this functions is re-entrant: the result of
+% The implementation of this function is re-entrant: the result of
% \begin{verbatim}
-% \dim_to_decimal_in_bp:n { <n>bp }
+% \dim_compare:nNnTF
+% { <x>bp } =
+% { \dim_to_decimal_in_bp:n { <x>bp } bp }
% \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}
%
@@ -550,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}
%
@@ -584,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}
@@ -603,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}
@@ -1754,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
@@ -1798,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})$.
%
@@ -1825,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
@@ -1887,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}
@@ -1950,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;
{
@@ -1991,12 +2001,12 @@
\token_if_eq_charcode:NNTF #1 -
{
\exp_after:wN \exp_after:wN \exp_after:wN \@@_get_remainder:w
- \int_eval:w ( 2 * #2 - #3 ) / ( 2 * #3 ) ;
+ \int_eval:n { ( 2 * #2 - #3 ) / ( 2 * #3 ) } ;
#2 ; #3 ; - ;
}
{
\exp_after:wN \exp_after:wN \exp_after:wN \@@_get_remainder:w
- \int_eval:w ( 2 * #1#2 - #3 ) / ( 2 * #3 ) ;
+ \int_eval:n { ( 2 * #1#2 - #3 ) / ( 2 * #3 ) } ;
#1#2 ; #3 ; ;
}
}
@@ -2012,7 +2022,7 @@
\cs_new:Npn \@@_get_remainder:w #1;#2;#3;
{
\exp_after:wN \exp_after:wN \exp_after:wN \@@_convert_remainder:w
- \int_eval:w #2 - #1 * #3 ;
+ \int_eval:n { #2 - #1 * #3 } ;
#3 ; #1 ;
}
% \end{macrocode}
@@ -2025,7 +2035,7 @@
\cs_new:Npn \@@_convert_remainder:w #1;#2;
{
\exp_after:wN \exp_after:wN \exp_after:wN \@@_test_candidate:w
- \int_eval:w #1 * 65536 / #2 ;
+ \int_eval:n { #1 * 65536 / #2 } ;
#1 ; #2 ;
}
% \end{macrocode}
@@ -2046,8 +2056,7 @@
{ \dim_to_decimal:n { #1sp } \@@_eval:w #3sp \@@_eval_end: }
{ \@@_parse_decimal:w #1 ; }
{
- \exp_after:wN \@@_parse_decimal:w
- \int_eval:w #1 + 1 ;
+ \@@_parse_decimal:w \int_eval:n { #1 + 1 } ;
}
}
% \end{macrocode}