From bfd55e1fa306b0e1c0db5fc689fb45b81d5da0c8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 26 Aug 2019 21:05:47 +0000 Subject: l3 (26aug19) git-svn-id: svn://tug.org/texlive/trunk@51962 c570f23f-e606-0410-a88d-b1316a301751 --- .../l3experimental/l3benchmark/l3benchmark.dtx | 4 +- .../latex/l3experimental/l3cctab/l3cctab.dtx | 8 +- .../latex/l3experimental/l3color/l3color.dtx | 4 +- .../latex/l3experimental/l3draw/l3draw-boxes.dtx | 2 +- .../latex/l3experimental/l3draw/l3draw-layers.dtx | 2 +- .../latex/l3experimental/l3draw/l3draw-paths.dtx | 10 +- .../latex/l3experimental/l3draw/l3draw-points.dtx | 31 ++- .../latex/l3experimental/l3draw/l3draw-scopes.dtx | 2 +- .../l3experimental/l3draw/l3draw-softpath.dtx | 22 +- .../latex/l3experimental/l3draw/l3draw-state.dtx | 2 +- .../l3experimental/l3draw/l3draw-transforms.dtx | 2 +- .../source/latex/l3experimental/l3draw/l3draw.dtx | 19 +- .../latex/l3experimental/l3graphics/l3graphics.dtx | 4 +- .../source/latex/l3experimental/l3pdf/l3pdf.dtx | 4 +- .../latex/l3experimental/l3str/l3str-format.dtx | 259 +++++++++++---------- .../l3experimental/l3sys-shell/l3sys-shell.dtx | 5 +- .../latex/l3experimental/xcoffins/xcoffins.dtx | 4 +- .../latex/l3experimental/xgalley/l3galley.dtx | 4 +- .../latex/l3experimental/xgalley/xgalley.dtx | 4 +- 19 files changed, 215 insertions(+), 177 deletions(-) (limited to 'Master/texmf-dist/source/latex/l3experimental') diff --git a/Master/texmf-dist/source/latex/l3experimental/l3benchmark/l3benchmark.dtx b/Master/texmf-dist/source/latex/l3experimental/l3benchmark/l3benchmark.dtx index e06cd58d1d9..c7b172488ae 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3benchmark/l3benchmark.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3benchmark/l3benchmark.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -130,7 +130,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3benchmark}{2019-07-01}{} +\ProvidesExplPackage{l3benchmark}{2019-08-25}{} {L3 Experimental benchmarking} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3cctab/l3cctab.dtx b/Master/texmf-dist/source/latex/l3experimental/l3cctab/l3cctab.dtx index ad4e422bd65..85a029b9bf6 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3cctab/l3cctab.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3cctab/l3cctab.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -150,7 +150,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3cctab}{2019-07-01}{} +\ProvidesExplPackage{l3cctab}{2019-08-25}{} {L3 Experimental category code tables} % % \end{macrocode} @@ -276,7 +276,7 @@ % \begin{macrocode} \cs_new_protected:Npn \cctab_new:N #1 { - \int_gadd:Nn \g_@@_allocate_int { 1 } + \int_gadd:Nn \g_@@_allocate_int { 2 } \int_const:Nn #1 { \g_@@_allocate_int } \intarray_new:cn { g_@@_ \int_use:N #1 _cctab } { 256 } \int_step_inline:nn { 256 } @@ -297,7 +297,7 @@ } \cs_new_protected:Npn \cctab_begin:N #1 { - \int_gadd:Nn \g_@@_stack_int { 1 } + \int_gadd:Nn \g_@@_stack_int { 2 } \int_compare:nNnT \g_@@_stack_int > \c_max_register_int { \__kernel_msg_fatal:nn { kernel } { cctab-stack-full } } \cs_if_exist:cF { g_@@_ \int_use:N \g_@@_stack_int _cctab } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx b/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx index 92e9ff6369c..107d6684d2b 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -265,7 +265,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3color}{2019-07-01}{} +\ProvidesExplPackage{l3color}{2019-08-25}{} {L3 Experimental color support} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx index 1f972d673af..2eeacd0d0a7 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-layers.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-layers.dtx index 4c5c0862746..ad35237954d 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-layers.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-layers.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx index af2f72698da..2981612ac47 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -505,23 +505,23 @@ { \@@_path_arc_auxiii:nn } { \@@_point_transform_noshift:n - { \draw_point_polar:nnn { #1 #4 90 } {#7} {#8} } + { \draw_point_polar:nnn {#7} {#8} { #1 #4 90 } } } \@@_point_process:nnn { \@@_path_arc_auxiv:nnnn } { \draw_point_transform:n - { \draw_point_polar:nnn {#1} {#5} {#6} } + { \draw_point_polar:nnn {#5} {#6} {#1} } } { \draw_point_transform:n - { \draw_point_polar:nnn {#2} {#5} {#6} } + { \draw_point_polar:nnn {#5} {#6} {#2} } } \@@_point_process:nn { \@@_path_arc_auxv:nn } { \@@_point_transform_noshift:n - { \draw_point_polar:nnn { #2 #4 -90 } {#7} {#8} } + { \draw_point_polar:nnn {#7} {#8} { #2 #4 -90 } } } \exp_after:wN \@@_path_curveto:nnnnnn \l_@@_path_tmp_tl \fp_set:Nn \l_@@_path_arc_delta_fp { abs ( #2 - #3 ) } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx index 510b6534bd0..a171b598e76 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -199,9 +199,9 @@ % save on any expression evaluation there and force expansion. % \begin{macrocode} \cs_new:Npn \draw_point_polar:nn #1#2 - { \draw_point_polar:nnn {#1} {#2} {#2} } + { \draw_point_polar:nnn {#1} {#1} {#2} } \cs_new:Npn \draw_point_polar:nnn #1#2#3 - { \@@_draw_polar:fnn { \fp_eval:n {#1} } {#2} {#3} } + { \@@_draw_polar:fnn { \fp_eval:n {#3} } {#1} {#2} } \cs_new:Npn \@@_draw_polar:nnn #1#2#3 { \@@_point_to_dim:n { cosd(#1) * (#2) , sind(#1) * (#3) } } \cs_generate_variant:Nn \@@_draw_polar:nnn { f } @@ -216,24 +216,37 @@ % % \begin{macro}[EXP]{\draw_point_unit_vector:n} % \begin{macro}[EXP]{\@@_point_unit_vector:nn} -% Only a single point expression so the expansion is done here. The -% outcome is the normalised vector from $(0,0)$ in the direction of +% \begin{macro}[EXP]{\@@_point_unit_vector:nnn} +% The outcome is the normalised vector from $(0,0)$ in the direction of % the point, \emph{i.e.} % \[ % P_{x} = \frac{x}{\sqrt{x^{2} + y^{2}}} \quad % P_{y} = \frac{y}{\sqrt{x^{2} + y^{2}}} % \] +% except where the length is zero, in which case a vertical vector is +% returned. % \begin{macrocode} \cs_new:Npn \draw_point_unit_vector:n #1 { \@@_point_process:nn { \@@_point_unit_vector:nn } {#1} } \cs_new:Npn \@@_point_unit_vector:nn #1#2 { - \@@_point_to_dim:n - { ( #1 , #2 ) / (sqrt(#1 * #1 + #2 * #2)) } + \exp_args:Nf \@@_point_unit_vector:nnn + { \fp_eval:n { (sqrt(#1 * #1 + #2 * #2)) } } + {#1} {#2} + } +\cs_new:Npn \@@_point_unit_vector:nnn #1#2#3 + { + \fp_compare:nNnTF {#1} = \c_zero_fp + { 0pt, 1pt } + { + \@@_point_to_dim:n + { ( #2 , #3 ) / #1 } + } } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Intersection calculations} % @@ -856,9 +869,9 @@ % Much the same as the core polar approach. % \begin{macrocode} \cs_new:Npn \draw_point_vec_polar:nn #1#2 - { \draw_point_vec_polar:nnn {#1} {#2} {#2} } + { \draw_point_vec_polar:nnn {#1} {#1} {#2} } \cs_new:Npn \draw_point_vec_polar:nnn #1#2#3 - { \@@_draw_vec_polar:fnn { \fp_eval:n {#1} } {#2} {#3} } + { \@@_draw_vec_polar:fnn { \fp_eval:n {#3} } {#1} {#2} } \cs_new:Npn \@@_draw_vec_polar:nnn #1#2#3 { \@@_point_to_dim:n diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx index 036921ef3bb..d20921a0a95 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx index 4e334c45d7a..5fb02c3cea4 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -300,7 +300,7 @@ % \begin{macro}{\@@_softpath_round_action_close:} % \begin{macro}{\@@_softpath_round_lookahead:NnnNnn} % \begin{macro}{\@@_softpath_round_roundpoint:NnnNnnNnn} -% \begin{macro}{\@@_softpath_round_calc:nnnNnn} +% \begin{macro}{\@@_softpath_round_calc:NnnNnn} % \begin{macro}[EXP] % {\@@_softpath_round_calc:nnnnnn, \@@_softpath_round_calc:fVnnnn} % \begin{macro}[EXP]{\@@_softpath_round_calc:nnnnw} @@ -436,8 +436,9 @@ { \token_if_eq_meaning_p:NN #4 \@@_softpath_close_op:nn } } { - \@@_softpath_round_calc:nnnNnn - \@@_softpath_round_loop:Nnn {#5} {#6} + \@@_softpath_round_calc:NnnNnn + \@@_softpath_round_loop:Nnn + {#5} {#6} } { \token_if_eq_meaning:NNTF #4 \@@_softpath_roundpoint_op:nn @@ -450,16 +451,17 @@ \cs_new_protected:Npn \@@_softpath_round_roundpoint:NnnNnnNnn #1#2#3#4#5#6#7#8#9 { - \@@_softpath_round_calc:nnnNnn + \@@_softpath_round_calc:NnnNnn \@@_softpath_round_loop:Nnn - {#8} {#9} #1 {#2} {#3} + {#8} {#9} + #1 {#2} {#3} #4 {#5} {#6} #7 {#8} {#9} } % \end{macrocode} % We now have all of the data needed to construct a rounded corner: all that % is left to do is to work out the detail! At this stage, we have details -% of where the corner itself is (|#4|, |#5|), and where the next point is -% (|#1|, |#2|). There are two types of calculations to do. First, we +% of where the corner itself is (|#5|, |#6|), and where the next point is +% (|#2|, |#3|). There are two types of calculations to do. First, we % need to interpolate from those two points in the direction of the % corner, in order to work out where the curve we are adding will start % and end. From those, plus the points we already have, we work out where @@ -468,7 +470,7 @@ % is worked out up-front and saved: we need that if dealing with a % close-path operation. % \begin{macrocode} -\cs_new_protected:Npn \@@_softpath_round_calc:nnnNnn #1#2#3#4#5#6 +\cs_new_protected:Npn \@@_softpath_round_calc:NnnNnn #1#2#3#4#5#6 { \tl_set:Nx \l_@@_softpath_curve_end_tl { @@ -546,7 +548,7 @@ { \use:x { - \@@_softpath_round_calc:nnnNnn + \@@_softpath_round_calc:NnnNnn { \tl_set:Nx \exp_not:N \l_@@_softpath_move_tl { diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx index 7e646d76c3a..e0718ef4d9d 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx index 9b25c60043c..3ab6a81bd69 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx index bb2661de0c5..971ebc6caa0 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx @@ -110,7 +110,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -404,8 +404,8 @@ % % \begin{function}[EXP]{\draw_point_polar:nn, \draw_point_polar:nnn} % \begin{syntax} -% \cs{draw_point_polar:nn} \Arg{angle} \Arg{radius} -% \cs{draw_point_polar:nnn} \Arg{angle} \Arg{radius-a} \Arg{radius-b} +% \cs{draw_point_polar:nn} \Arg{radius} \Arg{angle} +% \cs{draw_point_polar:nnn} \Arg{radius-a} \Arg{radius-b} \Arg{angle} % \end{syntax} % Gives the co-ordinates of the point at \meta{angle} (an \meta{fp expr} in % \emph{degrees}) and \meta{radius}. The three-argument version accepts @@ -421,7 +421,8 @@ % \cs{draw_point_unit_vector:n} \Arg{point} % \end{syntax} % Expands to the co-ordinates of a unit vector in the direction of the -% \meta{point} from the origin. +% \meta{point} from the origin. If the \meta{point} is at the origin, +% a vertical unit vector is returned % \end{function} % % \begin{function}[EXP]{\draw_point_transform:n} @@ -462,8 +463,8 @@ % % \begin{function}[EXP]{\draw_point_vec_polar:nn, \draw_point_vec_polar:nnn} % \begin{syntax} -% \cs{draw_point_vec_polar:nn} \Arg{angle} \Arg{radius} -% \cs{draw_point_vec_polar:nnn} \Arg{angle} \Arg{radius-a} \Arg{radius-b} +% \cs{draw_point_vec_polar:nn} \Arg{radius} \Arg{angle} +% \cs{draw_point_vec_polar:nnn} \Arg{radius-a} \Arg{radius-b} \Arg{angle} % \end{syntax} % Gives the co-ordinates of the point at \meta{angle} (an \meta{fp expr} in % \emph{degrees}) and \meta{radius}, relative to the prevailing @@ -580,11 +581,11 @@ % \draw_begin: % \draw_path_corner_arc:nn { 4pt } { 4pt } % \draw_path_moveto:n -% { \draw_point_polar:nn { 0 } { 1cm } } +% { \draw_point_polar:nn { 1cm } { 0 } } % \int_step_inline:nnnn { 72 } { 72 } { 359 } % { % \draw_path_lineto:n -% { \draw_point_polar:nn { #1 } { 1cm } } +% { \draw_point_polar:nn { 1cm } { #1 } } % } % \draw_path_close: % \draw_path_use_clear:n { stroke } @@ -1145,7 +1146,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3draw}{2019-07-01}{} +\ProvidesExplPackage{l3draw}{2019-08-25}{} {L3 Experimental core drawing support} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3graphics/l3graphics.dtx b/Master/texmf-dist/source/latex/l3experimental/l3graphics/l3graphics.dtx index e8e58babb09..d65bce66d40 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3graphics/l3graphics.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3graphics/l3graphics.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -241,7 +241,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3graphics}{2019-07-01}{} +\ProvidesExplPackage{l3graphics}{2019-08-25}{} {L3 Experimental graphics inclusion support} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3pdf/l3pdf.dtx b/Master/texmf-dist/source/latex/l3experimental/l3pdf/l3pdf.dtx index a8eff007f4b..413122a9966 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3pdf/l3pdf.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3pdf/l3pdf.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -185,7 +185,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3pdf}{2019-07-01}{} +\ProvidesExplPackage{l3pdf}{2019-08-25}{} {L3 Experimental core PDF support} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index 1afe6ea2da4..17c2dad4a0f 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -48,7 +48,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -127,7 +127,7 @@ % \end{syntax} % Evaluates the \meta{floating point expression} and converts the % result to a string according to the \meta{format specification}. -% The \meta{precision} defaults to $6$. The \meta{style} can be +% The \meta{style} can be % \begin{itemize} % \item |e| for scientific notation, with one digit before and % \meta{precision} digits after the decimal separator, and an @@ -138,6 +138,9 @@ % in the range $[10^{-4}, 10^{\meta{precision}})$ and style |e| % otherwise. % \end{itemize} +% When there is no \meta{style} specifier nor \meta{precision} the +% number is displayed without rounding. Otherwise the +% \meta{precision} defaults to~$6$. % \end{function} % % \section{Possibilities, and things to do} @@ -164,7 +167,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3str-format}{2019-07-01}{} +\ProvidesExplPackage{l3str-format}{2019-08-25}{} {L3 Experimental string formatting} % % \end{macrocode} @@ -692,11 +695,13 @@ % \subsection{Formatting floating points} % % \begin{macro}[EXP]{\fp_format:nn} -% Evaluate the first argument to an internal floating point number, and -% feed it to \cs{@@_format_fp:nn}. +% Evaluate the first argument to a floating point number, and feed it +% to \cs{@@_format_fp:nn}. It would be more efficient to use internal +% floating point numbers but efficiency is not essential and the code +% is cleaner this way. % \begin{macrocode} \cs_new:Npn \fp_format:nn #1 - { \exp_args:Nf \@@_format_fp:nn { \__fp_parse:n {#1} } } + { \exp_args:Nf \@@_format_fp:nn { \fp_to_tl:n {#1} } } % \end{macrocode} % \end{macro} % @@ -708,20 +713,19 @@ { \tl_to_str:f { - \exp_last_unbraced:Nf \@@_format_fp:NNNnnNw + \exp_last_unbraced:Nf \@@_format_fp:NNNnnNn { \@@_format_parse:n {#2} } - #1 + {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_format_fp:NNNnnNw} +% \begin{macro}[EXP]{\@@_format_fp:NNNnnNn} % \begin{quote} -% \cs{@@_format_fp:NNNnnNw} \meta{fill} \meta{alignment} +% \cs{@@_format_fp:NNNnnNn} \meta{fill} \meta{alignment} % \meta{format sign} \Arg{width} \Arg{precision} \meta{style} -% \cs{s__fp} \cs{__fp_chk:w} \meta{fp type} \meta{fp sign} \meta{fp -% body} |;| +% \Arg{floating point} % \end{quote} % First set the default alignment |?| to |>|. Place the modified % information after a trailing \cs{s_stop} for later retrieval. Then @@ -732,16 +736,17 @@ % (default), put nothing, represented as a brace group. The width % |#4| will be useful later, store it after \cs{s_stop}. Afterwards, % check the \meta{precision}: if it was not given, replace it by $6$ -% (default precision). Finally, dispatch depending on the -% \meta{style}. +% (default precision) unless no \meta{style} was given: in that case +% we want to use whatever precision is needed to fully describe the +% number. Finally, dispatch depending on the \meta{style}. % \begin{macrocode} -\cs_new:Npn \@@_format_fp:NNNnnNw - #1#2#3#4#5#6 \s__fp \__fp_chk:w #7 #8 +\cs_new:Npn \@@_format_fp:NNNnnNn + #1#2#3#4#5#6#7 { \token_if_eq_charcode:NNTF #2 ? { \@@_format_put:nw { #1 > } } { \@@_format_put:nw { #1 #2 } } - \token_if_eq_meaning:NNTF 2 #8 + \tl_if_head_eq_charcode:nNTF {#7} - { \@@_format_put:nw { - } } { \str_case:nnF {#3} @@ -753,176 +758,200 @@ } \@@_format_put:nw { {#4} } \tl_if_empty:nTF {#5} - { \@@_format_put:nw { { 6} } } + { + \token_if_eq_meaning:NNTF #6 ? + { \@@_format_put:nw { { } } } + { \@@_format_put:nw { { 6} } } + } { \@@_format_put:nw { {#5} } } \str_case:nnF {#6} { - { e } { \@@_format_fp:wnnnNNw \@@_format_fp_e:wn } - { f } { \@@_format_fp:wnnnNNw \@@_format_fp_f:wn } - { g } { \@@_format_fp:wnnnNNw \@@_format_fp_g:wn } - { ? } { \@@_format_fp:wnnnNNw \@@_format_fp_g:wn } + { e } { \@@_format_fp:wnnnNNn \@@_format_fp_e:nn } + { f } { \@@_format_fp:wnnnNNn \@@_format_fp_f:nn } + { g } { \@@_format_fp:wnnnNNn \@@_format_fp_g:nn } + { ? } { \@@_format_fp:wnnnNNn \@@_format_fp_g:nn } } { \__kernel_msg_expandable_error:nnnn { str } { invalid-style-format } {#6} { fp } - \@@_format_fp:wnnnNNw \@@_format_fp_g:wn + \@@_format_fp:wnnnNNn \@@_format_fp_g:nn } - \s_stop - \s__fp \__fp_chk:w #7 #8 + \s_stop {#7} } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_format_fp:wnnnNNw} +% \begin{macro}[EXP]{\@@_format_fp:wnnnNNn} % \begin{quote} -% \cs{@@_format_fp:wnnnNNw} \meta{formatting function} \cs{s_stop} +% \cs{@@_format_fp:wnnnNNn} \meta{formatting function} \cs{s_stop} % \Arg{precision} \Arg{width} \Arg{sign} \meta{fill} -% \meta{alignment} \cs{s__fp} \cs{__fp_chk:w} \meta{fp type} -% \meta{fp sign} \meta{fp body} |;| +% \meta{alignment} \Arg{floating point} % \end{quote} % \begin{macrocode} -\cs_new:Npn \@@_format_fp:wnnnNNw - #1 \s_stop #2 #3 #4 #5#6 #7 ; +\cs_new:Npn \@@_format_fp:wnnnNNn + #1 \s_stop #2 #3 #4 #5#6 #7 { \exp_args:Nc \exp_args:Nf { @@_format_align_#6:nnnN } - { #1 #7 ; {#2} } + { #1 {#7} {#2} } {#4} {#3} #5 } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_format_fp_round:wn} -% Round the given floating point (not its absolute value, to play -% nicely with unusual rounding modes). +% \begin{macro}[EXP]{\@@_format_fp_round:nn} +% Round the given floating point and take the absolute value (in this +% order, to play nicely with unusual rounding modes if we ever +% implement these). % \begin{macrocode} -\cs_new:Npn \@@_format_fp_round:wn #1 ; #2 - { \__fp_parse:n { round ( #1; , #2 - \__fp_exponent:w #1; ) } } +\cs_new:Npn \@@_format_fp_round:nn #1 #2 + { \fp_to_tl:n { abs ( round ( #1 , #2 - logb(#1) - 1 ) ) } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_format_fp_e:wn} -% \begin{macro}[EXP]{\@@_format_fp_e_aux:wn} -% With the |e| type, first filter out special cases. In the normal -% case, round to |#4+1| significant figures (one before the decimal -% separator, |#4| after). +% \begin{macro}[EXP]{\@@_format_fp_e:nn} +% \begin{macro}[EXP]{\@@_format_fp_e_aux:nn, \@@_format_fp_e_aux:wwn} +% With the |e| type, first round to |#4+1| significant figures (one +% before the decimal separator, |#4| after), then filter out special +% cases, then convert to scientific notations. This order is +% important because rounding can produce infinities or zeros and +% because \cs{fp_to_scientific:n} does not accept |nan| nor |inf|. % \begin{macrocode} -\cs_new:Npn \@@_format_fp_e:wn \s__fp \__fp_chk:w #1#2#3 ; #4 +\cs_new:Npn \@@_format_fp_e:nn #1#2 + { + \exp_args:Nf \@@_format_fp_e_aux:nn + { \@@_format_fp_round:nn {#1} { #2 + 1 } } + {#2} + } +\cs_new:Npn \@@_format_fp_e_aux:nn #1#2 { - \int_case:nnF {#1} + \str_case:nnF {#1} { - { 0 } { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } e 0 } - { 2 } { inf } - { 3 } { nan } + { inf } { inf } + { nan } { nan } } { - \exp_last_unbraced:Nf \@@_format_fp_e_aux:wn - { \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2#3 ; { #4 + 1 } } - {#4} + \exp_last_unbraced:Nf \@@_format_fp_e_aux:wwn + { \fp_to_scientific:n {#1} } ; + {#2} } } -\cs_new:Npn \@@_format_fp_e_aux:wn - \s__fp \__fp_chk:w #1#2 #3 #4#5#6#7 ; #8 +\cs_new:Npn \@@_format_fp_e_aux:wwn #1 . #2 e #3 ; #4 { - \@@_format_put:fw { \int_eval:n { #3 - 1 } } - \@@_format_put:nw { e } - \int_compare:nNnTF {#8} > \c__fp_prec_int + \@@_format_put:nw { e #3 } + \int_compare:nNnTF {#4} < \c__fp_prec_int { - \@@_format_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } - \@@_format_put:fw { \use_none:n #4#5#6#7 } + \@@_format_put:fw { \str_range:nnn { #2 } { 1 } { #4 } } + \@@_format_put:nw { #1 . } } { \@@_format_put:fw - { \str_range:nnn { #4#5#6#7 0 } { 2 } { #8 + 1 } } + { \prg_replicate:nn { #4 - \c__fp_prec_int + 1 } { 0 } } + \@@_format_put:nw { #1 . #2 } } - \@@_format_put:fw { \use_i:nnnn #4 . } \use_none:n \s_stop } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\@@_format_fp_f:wn} +% \begin{macro}[EXP]{\@@_format_fp_f:nn} % \begin{macro}[EXP]{\@@_format_fp_f_aux:wwwn} -% With the |f| type, first filter out special cases. In the normal -% case, round to |#4| (absolute) decimal places. +% With the |f| type, first round to |#4| (absolute) decimal places +% then filter out special cases, then in normal cases pad with zeros. % \begin{macrocode} -\cs_new:Npn \@@_format_fp_f:wn \s__fp \__fp_chk:w #1#2#3 ; #4 +\cs_new:Npn \@@_format_fp_f:nn #1#2 + { + \exp_args:Nf \@@_format_fp_f_aux:nn + { \fp_to_tl:n { abs ( round ( #1 , #2 ) ) } } + {#2} + } +\cs_new:Npn \@@_format_fp_f_aux:nn #1#2 { - \int_case:nnF {#1} + \str_case:nnF {#1} { - {0} { \use:nf { 0 . } { \prg_replicate:nn {#4} { 0 } } } - {2} { inf } - {3} { nan } + { inf } { inf } + { nan } { nan } } { \exp_last_unbraced:Nf \@@_format_fp_f_aux:wwwn - { - \fp_to_decimal:n - { abs ( round ( \s__fp \__fp_chk:w #1#2#3 ; , #4 ) ) } - } - . . ; - {#4} + { \fp_to_decimal:n {#1} } . . ; {#2} } } \cs_new:Npn \@@_format_fp_f_aux:wwwn #1 . #2 . #3 ; #4 { - \use:nf - { #1 . #2 } + \use:nf { #1 . #2 } { \prg_replicate:nn { #4 - \@@_count:n {#2} } {0} } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\@@_format_fp_g:wn} +% \begin{macro}[EXP]{\@@_format_fp_g:nn} % \begin{macro}[EXP]{\@@_format_fp_g_aux:wn} % \begin{macro}[EXP]{\@@_format_fp_to_scientific:n, \@@_format_fp_trim:w} -% With the |g| type, first filter out special cases. In the normal -% case, round to |#4| significant figures, then test the exponent: if -% $-4\leq \meta{exponent} < \meta{precision}$, use the presentation -% type |f|, otherwise use the presentation type |e|. Also, a -% \meta{precision} of $0$ is treated like a precision of $1$. -% Actually, we don't reuse the |e| and |f| auxiliaries, because we -% want to trim trailing zeros. Thankfully, this is done by -% \cs{fp_to_decimal:n} and \cs{fp_to_scientific:n}, acting on the -% (absolute value of the) rounded value. -% \begin{macrocode} -\cs_new:Npn \@@_format_fp_g:wn \s__fp \__fp_chk:w #1#2 ; #3 - { - \int_case:nnF {#1} - { - {0} { 0 } - {2} { inf } - {3} { nan } - } +% With the |g| type, a special case is when |#2| is empty (no style +% nor precision in the original specification): then we output the +% number without rounding (and without its sign). Otherwise round to +% |#2| significant figures before filtering out special cases. (A +% \meta{precision} of $0$ is treated like a precision of $1$.) +% Distinguish exponents $-4\leq \meta{exponent} < \meta{precision}$ +% from others and use essentially the |f| or |e| presentations in +% these two cases, but trimming trailing zeros. Because we don't need +% to keep a fixed number of digits after the decimal point we can +% simply use \cs{fp_to_decimal:n} and \cs{fp_to_scientific:n}, and in +% the second case post-process the result by trimming zeros and a +% period. +% \begin{macrocode} +\cs_new:Npn \@@_format_fp_g:nn #1#2 + { + \tl_if_empty:nTF {#2} { \fp_to_tl:n { abs(#1) } } { - \exp_last_unbraced:Nf \@@_format_fp_g_aux:wn - { - \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2 ; - { \int_max:nn {1} {#3} } - } - { \int_max:nn {1} {#3} } + \exp_args:Nf \@@_format_fp_g_aux:nn + { \@@_format_fp_round:nn {#1} { \int_max:nn {1} {#2} } } + { \int_max:nn {1} {#2} } } } -\cs_new:Npn \@@_format_fp_g_aux:wn #1; #2 +\cs_new:Npn \@@_format_fp_g_aux:nn #1#2 { - \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } - { \@@_format_to_scientific:n } + \str_case:nnF {#1} { - \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} - { \@@_format_to_scientific:n } - { \fp_to_decimal:n } + { 0 } { 0 } + { inf } { inf } + { nan } { nan } + } + { + \fp_compare:nTF { 1e-4 <= #1 < 1e#2 } + { \fp_to_decimal:n {#1} } + { + \exp_last_unbraced:Nf \@@_format_fp_trim:w + { \fp_to_scientific:n {#1} } + } } - { \__fp_set_sign_o:w 0 #1; @ \prg_do_nothing: } } -\cs_new:Npn \@@_format_to_scientific:n +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\@@_format_fp_trim:w} +% \begin{macro}[EXP] +% {\@@_format_fp_trim_loop:w, \@@_format_fp_trim_dot:w, \@@_format_fp_trim_end:w} +% If |#1| ends with a $0$, the \texttt{loop} auxiliary takes that zero +% as an end-delimiter for its first argument, and the second argument +% is the same \texttt{loop} auxiliary. Once the last trailing zero is +% reached, the second argument is the \texttt{dot} auxiliary, +% which removes a trailing dot if any. We then clean-up with the +% \texttt{end} auxiliary, keeping only the number. +% \begin{macrocode} +\cs_new:Npn \@@_format_fp_trim:w #1 e { - \exp_after:wN \@@_format_fp_trim:w - \exp:w \exp_end_continue_f:w \fp_to_scientific:n + \@@_format_fp_trim_loop:w #1 + ; \@@_format_fp_trim_loop:w 0; \@@_format_fp_trim_dot:w .; \s_stop e } -\cs_new:Npn \@@_format_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } +\cs_new:Npn \@@_format_fp_trim_loop:w #1 0; #2 { #2 #1 ; #2 } +\cs_new:Npn \@@_format_fp_trim_dot:w #1 .; { \@@_format_fp_trim_end:w #1 ; } +\cs_new:Npn \@@_format_fp_trim_end:w #1 ; #2 \s_stop { #1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -944,14 +973,6 @@ { Invalid~style~'#1'~for~type~'#2'. } % \end{macrocode} % -% \subsection{Todos} -% -% \begin{itemize} -% \item Check what happens during floating point formatting when a -% number is rounded to $0$ or $\infty$. I think the |e| and |f| -% types break horribly. -% \end{itemize} -% % \begin{macrocode} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3sys-shell/l3sys-shell.dtx b/Master/texmf-dist/source/latex/l3experimental/l3sys-shell/l3sys-shell.dtx index da41be80f00..4f8c3bee409 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3sys-shell/l3sys-shell.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3sys-shell/l3sys-shell.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -136,7 +136,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3sys-shell}{2019-07-01}{} +\ProvidesExplPackage{l3sys-shell}{2019-08-25}{} {L3 Experimental system shell functions} % % \end{macrocode} @@ -321,6 +321,7 @@ \char_set_catcode_other:N \exp_not:N \~ \char_set_catcode_other:N \exp_not:N \% \char_set_catcode_space:N \exp_not:N \ % + \tex_endlinechar:D -1 \scan_stop: } \exp_not:N \l_@@_tmp_tl \str_set:NV #1 \exp_not:N \l_@@_tmp_tl diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx index a86d0701923..3e9f723488d 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx @@ -56,7 +56,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -675,7 +675,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xcoffins}{2019-07-01}{} +\ProvidesExplPackage{xcoffins}{2019-08-25}{} {L3 Experimental design level coffins} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index 34dade048a3..2db96ef33b3 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -687,7 +687,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3galley}{2019-07-01}{} +\ProvidesExplPackage{l3galley}{2019-08-25}{} {L3 Experimental galley code} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index e10cb7b13b6..5544223ad7f 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -734,7 +734,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xgalley}{2019-07-01}{} +\ProvidesExplPackage{xgalley}{2019-08-25}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} % \end{macrocode} -- cgit v1.2.3