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 --- .../source/latex/l3backend/l3backend-basics.dtx | 2 +- .../source/latex/l3backend/l3backend-box.dtx | 2 +- .../source/latex/l3backend/l3backend-color.dtx | 2 +- .../source/latex/l3backend/l3backend-draw.dtx | 2 +- .../source/latex/l3backend/l3backend-graphics.dtx | 2 +- .../source/latex/l3backend/l3backend-pdf.dtx | 36 +-- .../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 +- Master/texmf-dist/source/latex/l3kernel/expl3.dtx | 4 +- .../texmf-dist/source/latex/l3kernel/l3alloc.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3basics.dtx | 2 +- .../source/latex/l3kernel/l3bootstrap.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3box.dtx | 2 +- .../source/latex/l3kernel/l3candidates.dtx | 30 ++- .../texmf-dist/source/latex/l3kernel/l3clist.dtx | 13 +- .../texmf-dist/source/latex/l3kernel/l3coffins.dtx | 2 +- .../source/latex/l3kernel/l3color-base.dtx | 2 +- .../source/latex/l3kernel/l3deprecation.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3doc.dtx | 2 +- .../source/latex/l3kernel/l3docstrip.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3expan.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3file.dtx | 6 +- .../texmf-dist/source/latex/l3kernel/l3final.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3flag.dtx | 2 +- .../source/latex/l3kernel/l3fp-assign.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3fp-aux.dtx | 16 +- .../source/latex/l3kernel/l3fp-basics.dtx | 2 +- .../source/latex/l3kernel/l3fp-convert.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3fp-expo.dtx | 2 +- .../source/latex/l3kernel/l3fp-extended.dtx | 2 +- .../source/latex/l3kernel/l3fp-logic.dtx | 19 +- .../source/latex/l3kernel/l3fp-parse.dtx | 2 +- .../source/latex/l3kernel/l3fp-random.dtx | 2 +- .../source/latex/l3kernel/l3fp-round.dtx | 20 +- .../source/latex/l3kernel/l3fp-traps.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3fp-trig.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3fp.dtx | 14 +- .../texmf-dist/source/latex/l3kernel/l3fparray.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 2 +- .../source/latex/l3kernel/l3intarray.dtx | 2 +- .../source/latex/l3kernel/l3kernel-functions.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3keys.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3legacy.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3luatex.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3msg.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3names.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3prop.dtx | 108 +++++---- .../texmf-dist/source/latex/l3kernel/l3quark.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3regex.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3seq.dtx | 10 +- Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3sort.dtx | 2 +- .../source/latex/l3kernel/l3str-convert.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3str.dtx | 18 +- Master/texmf-dist/source/latex/l3kernel/l3sys.dtx | 2 +- .../source/latex/l3kernel/l3tl-analysis.dtx | 5 +- Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 145 +++++++----- .../texmf-dist/source/latex/l3kernel/l3token.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3unicode.dtx | 2 +- 77 files changed, 553 insertions(+), 371 deletions(-) (limited to 'Master/texmf-dist/source/latex') diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx index 04df933c831..930d011cff4 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx index ef25fe95e1e..bb224d62e00 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx index 0e80de0117c..c67528515f2 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-color.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx index e451d30a3e6..276e1aee9f4 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-draw.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx index b146bcdae69..1dda6b33cab 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-graphics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx b/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx index 63e993e16ea..fc75aae39bb 100644 --- a/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx +++ b/Master/texmf-dist/source/latex/l3backend/l3backend-pdf.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-07-01} +% \date{Released 2019-08-25} % % \maketitle % @@ -271,7 +271,7 @@ \__kernel_backend_postscript_header:n { /pdf.linkmargin { 1 ~ pdf.pt.dvi } def - /pdf.linkdp.pad { 0 } def + /pdf.linkdp.pad { 0 } def /pdf.linkht.pad { 0 } def } % \end{macrocode} @@ -597,7 +597,7 @@ 3 ~ exch ~ put ~ dup ~ pdf.outerbox ~ 2 ~ get ~ - pdf.linkmargin ~ add ~ + pdf.linkmargin ~ add ~ 2 ~ exch ~ put ~ dup ~ dup ~ 3 ~ get ~ @@ -799,7 +799,7 @@ \int_gset_eq:NN \g_@@_backend_annotation_int \g_@@_backend_object_int \@@_backend_pdfmark:x { - + /_objdef { pdf.obj \int_use:N \g_@@_backend_object_int } pdf.rect ~ #4 ~ @@ -1057,7 +1057,7 @@ \dim_to_decimal:n { \tex_baselineskip:D } ~ dup ~ 0 ~ gt { pdf.pt.dvi ~ def } { pop ~ pop } - ifelse + ifelse } } \cs_new_protected:Npn \@@_backend_link_sf_save: @@ -1197,7 +1197,7 @@ /Dest ( #1 ) cvn /DEST } - \group_end: + \group_end: } % \end{macrocode} % \end{macro} @@ -1321,7 +1321,7 @@ % \begin{macrocode} \cs_new:Npx \@@_backend_link_last: { - \exp_not:N \int_value:w + \exp_not:N \int_value:w \cs_if_exist:NTF \tex_pdffeedback:D { \exp_not:N \tex_pdffeedback:D lastlink ~ } { \exp_not:N \tex_pdflastlink:D } @@ -1374,14 +1374,14 @@ \hbox_set:Nn \l_@@_internal_box {#2} \cs_if_exist:NTF \tex_pdfextension:D { \exp_not:N \tex_pdfextension:D dest ~ } - { \exp_not:N \tex_pdfdest:D } + { \exp_not:N \tex_pdfdest:D } name {#1} fitr ~ width \exp_not:N \box_wd:N \l_@@_internal_box height \exp_not:N \box_ht:N \l_@@_internal_box - depth \exp_not:N \box_dp:N \l_@@_internal_box + depth \exp_not:N \box_dp:N \l_@@_internal_box \box_use:N \l_@@_internal_box - \group_end: + \group_end: } % \end{macrocode} % \end{macro} @@ -1472,7 +1472,7 @@ } { stream } { - stream ~ attr ~ { \@@_exp_not_i:nn ##2 } ~ + stream ~ attr ~ { \@@_exp_not_i:nn ##2 } ~ { \@@_exp_not_ii:nn ##2 } } } @@ -1510,7 +1510,7 @@ } { stream } { - stream ~ attr ~ { \@@_exp_not_i:nn ##2 } ~ + stream ~ attr ~ { \@@_exp_not_i:nn ##2 } ~ { \@@_exp_not_ii:nn ##2 } } } @@ -1702,7 +1702,7 @@ \prop_gput:Nnn \g_@@_backend_object_prop {#1} {#2} } \cs_new:Npn \@@_backend_object_ref:n #1 - { @pdf.obj \int_use:c { g_@@_backend_object_ \tl_to_str:n {#1} _int } } + { @pdf.obj \int_use:c { c_@@_backend_object_ \tl_to_str:n {#1} _int } } % \end{macrocode} % \end{macro} % \end{macro} @@ -1949,7 +1949,7 @@ } } } - \group_end: + \group_end: } % \end{macrocode} % \end{macro} @@ -1975,15 +1975,15 @@ % {\@@_backend_version_major_gset:n, \@@_backend_version_minor_gset:n} % We start with the assumption that the default is active. % \begin{macrocode} -\cs_new_protected:Npn \@@_backend_version_major:n #1 +\cs_new_protected:Npn \@@_backend_version_major_gset:n #1 { \cs_gset:Npx \@@_backend_version_major: { \int_eval:n {#1} } - \__kernel_backend_literal:x { pdf:majorversion \@@_backend_version_major: } + \__kernel_backend_literal:x { pdf:majorversion~ \@@_backend_version_major: } } -\cs_new_protected:Npn \@@_backend_version_minor:n #1 +\cs_new_protected:Npn \@@_backend_version_minor_gset:n #1 { \cs_gset:Npx \@@_backend_version_minor: { \int_eval:n {#1} } - \__kernel_backend_literal:x { pdf:minorversion \@@_backend_version_minor: } + \__kernel_backend_literal:x { pdf:minorversion~ \@@_backend_version_minor: } } % \end{macrocode} % \end{macro} 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} diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index fc7bc8fe1c2..7733d54a7a2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -23,7 +23,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2019-08-14}% +\def\ExplFileDate{2019-08-25}% % %<*driver> \documentclass[full]{l3doc} @@ -51,7 +51,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index f17f27e12fb..1c74174aeb0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 8764b0d589d..8bd1bd8e6c0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 3cfdd3985f9..35ab971e153 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 81f989d21ad..8067a6ca6a6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 82a756fa782..a92db3ebedf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -246,6 +246,15 @@ % is~$0$. % \end{function} % +% \begin{function}[pTF, added = 2019-08-25]{\fp_if_nan:n} +% \begin{syntax} +% \cs{fp_if_nan:n} \Arg{fpexpr} +% \end{syntax} +% Evaluates the \meta{fpexpr} and tests whether the result is exactly +% \nan{}. The test returns \texttt{false} for any other result, even +% a tuple containing \nan{}. +% \end{function} +% % \section{Additions to \pkg{l3fparray}} % % \begin{function}[added = 2018-05-05]{\fparray_new:Nn} @@ -326,22 +335,26 @@ % until reaching the end of the file, stores the \meta{lines} in the % \meta{tl~var} then applies the \meta{code}. The \meta{code} will % usually make use of the \meta{variable}, but this is not enforced. -% The assignments to the \meta{variable} are local. \TeX{} ignores +% The assignments to the \meta{variable} are local. +% Its value after the loop is the last set of \meta{lines}, or its +% original value if the \meta{stream} is empty. \TeX{} ignores % any trailing new-line marker from the file it reads. % This function is typically faster than \cs{ior_map_inline:Nn}. % \end{function} % % \begin{function}[added = 2019-01-13]{\ior_str_map_variable:NNn} % \begin{syntax} -% \cs{ior_str_map_variable:NNn} \meta{stream} \meta{tl~var} \Arg{code} +% \cs{ior_str_map_variable:NNn} \meta{stream} \meta{variable} \Arg{code} % \end{syntax} % For each \meta{line} in the \meta{stream}, stores the \meta{line} in -% the \meta{tl~var} then applies the \meta{code}. The material is +% the \meta{variable} then applies the \meta{code}. The material is % read from the \meta{stream} as a series of tokens with category code % $12$ (other), with the exception of space characters which are given % category code $10$ (space). The \meta{code} will usually make use % of the \meta{variable}, but this is not enforced. The assignments -% to the \meta{variable} are local. Note that \TeX{} removes trailing +% to the \meta{variable} are local. Its value after the loop is the +% last \meta{line}, or its original value if the \meta{stream} is +% empty. Note that \TeX{} removes trailing % space and tab characters (character codes 32 and 9) from every line % upon input. \TeX{} also ignores any trailing new-line marker from % the file it reads. @@ -611,7 +624,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[added = 2017-11-28] +% \begin{function}[added = 2017-11-28, updated = 2019-08-25] % { % \prop_set_from_keyval:Nn, \prop_set_from_keyval:cn, % \prop_gset_from_keyval:Nn, \prop_gset_from_keyval:cn, @@ -624,10 +637,10 @@ % \} % \end{syntax} % Sets \meta{prop~var} to contain key--value pairs given in the second -% argument. +% argument. If duplicate keys appear only one of the values is kept. % \end{function} % -% \begin{function}[added = 2017-11-28] +% \begin{function}[added = 2017-11-28, updated = 2019-08-25] % {\prop_const_from_keyval:Nn, \prop_const_from_keyval:cn} % \begin{syntax} % \cs{prop_const_from_keyval:Nn} \meta{prop~var} @@ -639,6 +652,7 @@ % Creates a new constant \meta{prop~var} or raises an error if the % name is already taken. The \meta{prop~var} is set globally to % contain key--value pairs given in the second argument. +% If duplicate keys appear only one of the values is kept. % \end{function} % % \section{Additions to \pkg{l3seq}} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index bcac2b813ea..fa743396b72 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -401,6 +401,9 @@ % % The functions described in this section apply a specified function % to each item of a comma list. +% All mappings are done at the current group level, \emph{i.e.}~any +% local assignments made by the \meta{function} or \meta{code} discussed +% below remain in effect after the loop. % % When the comma list is given explicitly, as an \texttt{n}-type argument, % spaces are trimmed around each item. @@ -448,7 +451,9 @@ % (token list) \meta{variable} and applies the \meta{code}. The % \meta{code} will usually make use of the \meta{variable}, but this % is not enforced. The assignments to the \meta{variable} are local. -% The \meta{items} are returned from left to right. +% Its value after the loop is the last \meta{item} in the \meta{comma +% list}, or its original value if there were no \meta{item}. The +% \meta{items} are returned from left to right. % \end{function} % % \begin{function}[rEXP, updated = 2012-06-29]{\clist_map_break:} @@ -1694,6 +1699,8 @@ % additionally we store each item in the given variable. % As for inline mappings, space trimming for the \texttt{n} % variant is done by storing the comma list in a variable. +% The quark test is done before assigning the item to the variable: +% this avoids storing a quark which the user wouldn't expect. % The strange \cs{use:n} avoids unlikely problems when |#2| would % contain \cs{q_recursion_stop}. % \begin{macrocode} @@ -1715,8 +1722,8 @@ } \cs_new_protected:Npn \@@_map_variable:Nnw #1#2#3, { + \quark_if_recursion_tail_stop:n {#3} \tl_set:Nn #1 {#3} - \quark_if_recursion_tail_stop:N #1 \use:n {#2} \@@_map_variable:Nnw #1 {#2} } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index aca74650f23..fa54e318251 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx index 247064bee14..4881aae53ed 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index 9a229be9c95..50219502b02 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index 58827a110da..9c00e79283b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -79,7 +79,7 @@ and all files in that bundle must be distributed together. % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % \maketitle % \tableofcontents % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index b24ee78747b..722ed3f484d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 34c38df4836..a8101b0f6c1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 334375a07f5..017c9954f70 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -241,6 +241,10 @@ % \end{texnote} % \end{function} % +% All mappings are done at the current group level, \emph{i.e.}~any +% local assignments made by the \meta{function} or \meta{code} discussed +% below remain in effect after the loop. +% % \begin{function}[added = 2012-02-11]{\ior_map_inline:Nn} % \begin{syntax} % \cs{ior_map_inline:Nn} \meta{stream} \Arg{inline function} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index 9ce9adc05c6..13ad327dbc7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index d2683e35357..7b829b4418d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index 289f8e837a8..0245f807f79 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index 5784ed97bcf..616cce45f36 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -369,6 +369,20 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\@@_kind:w} +% Expands to $0$ for zeros, $1$ for normal floating point numbers, $2$ +% for infinities, $3$ for \nan{}, $4$ for tuples. +% \begin{macrocode} +\cs_new:Npn \@@_kind:w #1 + { + \@@_if_type_fp:NTwFw + #1 \@@_use_ii_until_s:nnw + \s_@@ { \@@_use_i_until_s:nw 4 } + \q_stop + } +% \end{macrocode} +% \end{macro} +% % \subsection{Overflow, underflow, and exact zero} % %^^A todo: the sign of exact zeros should depend on the rounding mode. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index e0929efcf5f..4c0e12ffcf8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index da7059822ed..cd545aec517 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index 2d6a76c40de..72c4020d6c1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 90e1b1d79f1..d78a0290385 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index 01aa7777c8a..c0584cde425 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -83,7 +83,7 @@ % \cs{@@_ternary_auxii:NwwN} have to be understood. % \end{itemize} % -% \subsection{Existence test} +% \subsection{Tests} % % \begin{macro}[pTF]{\fp_if_exist:N, \fp_if_exist:c} % Copies of the \texttt{cs} functions defined in \pkg{l3basics}. @@ -93,6 +93,21 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[pTF]{\fp_if_nan:n} +% Evaluate and check if the result is a floating point of the same +% kind as \nan{}. +% \begin{macrocode} +\prg_new_conditional:Npnn \fp_if_nan:n #1 { TF , T , F , p } + { + \if:w 3 \exp_last_unbraced:Nf \@@_kind:w { \@@_parse:n {#1} } + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +% \end{macrocode} +% \end{macro} +% % \subsection{Comparison} % % \begin{macro}[pTF, EXP]{\fp_compare:n} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index 9e2c1bdaf1e..b3d7b32bc85 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index 5337ccdfd72..9c74c70774c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 5610b11fc4c..9bedd90aab2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -483,14 +483,26 @@ % \@@_round_special:NwwNnn , % \@@_round_special_aux:Nw % } +% If the number of digits to round to is an integer or infinity all is +% good; if it is \texttt{nan} then just produce a \texttt{nan}; +% otherwise invalid as we have something like |round(1,3.14)| where +% the number of digits is not an integer. % \begin{macrocode} \cs_new:Npn \@@_round:Nww #1#2 ; #3 ; { \@@_small_int:wTF #3; { \@@_round:Nwn #1#2; } { - \@@_invalid_operation_tl_o:ff - { \@@_round_name_from_cs:N #1 } - { \@@_array_to_clist:n { #2; #3; } } + \if:w 3 \@@_kind:w #3 ; + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { \exp_after:wN \c_nan_fp } + { + \@@_invalid_operation_tl_o:ff + { \@@_round_name_from_cs:N #1 } + { \@@_array_to_clist:n { #2; #3; } } + } } } \cs_new:Npn \@@_round:Nwn #1 \s_@@ \@@_chk:w #2#3#4; #5 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index ff1f77ceeed..aad063f831a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index d8f4755b30b..085641bafd5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index f8983540573..a74b27f9006 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -1089,6 +1089,7 @@ % $x$~to $n$~places. If $n$~is an integer, this rounds~$x$ to a % multiple of~$10^{-n}$; if $n=+\infty$, this always yields~$x$; if % $n=-\infty$, this yields one of $\pm 0$, $\pm\infty$, or~\nan{}; if +% $n=\nan{}$, this yields \nan{}; if % $n$~is neither $\pm\infty$ nor an integer, then an \enquote{invalid % operation} exception is raised. When \meta{fpexpr_2} is omitted, % $n=0$, \emph{i.e.}, \meta{fpexpr_1} is rounded to an integer. The @@ -1096,7 +1097,7 @@ % \begin{itemize} % \item |round| yields the multiple of~$10^{-n}$ closest to~$x$, % with ties ($x$ half-way between two such multiples) rounded -% as follows. If $t$ is \texttt{nan} or not given the even +% as follows. If $t$ is \texttt{nan} (or not given) the even % multiple is chosen (\enquote{ties to even}), if $t=\pm 0$ the % multiple closest to $0$ is chosen (\enquote{ties to zero}), % if $t$ is positive/negative the multiple closest to $\infty$/$-\infty$ is chosen @@ -1370,9 +1371,10 @@ % \end{syntax} % Evaluates the \meta{floating point expression} as described for % \cs{fp_eval:n} and leaves the absolute value of the result in the -% input stream. If the argument is a tuple, \enquote{invalid -% operation} occurs, but no other case raises exceptions. Within -% floating point expressions, |abs()| can be used. +% input stream. If the argument is $\pm\infty$, \nan{} or a tuple, +% \enquote{invalid operation} occurs. Within floating point +% expressions, |abs()| can be used; it accepts $\pm\infty$ and \nan{} +% as arguments. % \end{function} % % \begin{function}[EXP, added = 2012-09-26, tested = m3fp-convert003] @@ -1418,7 +1420,7 @@ % \item Add an |array(1,2,3)| and |i=complex(0,1)|. % \item Provide an experimental |map| function? Perhaps easier to % implement if it is a single character, |@sin(1,2)|? -% \item Provide \cs{fp_if_nan:nTF}, and an |isnan| function? +% \item Provide an |isnan| function analogue of \cs{fp_if_nan:nTF}? % \item Support keyword arguments? % \end{itemize} % \pkg{Pgfmath} also provides box-measurements (depth, height, width), but diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx index afafba0ce09..5a80f4cfe04 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 544f90cdacc..7c0dd3caec8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx index ecdad58fa41..a371b6ee635 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx index ae7f4ac240c..e8d675eebaa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 2d187d698b5..074ca85b6e3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx b/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx index f1e24059383..90ca8c5d0e7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 3cfa869f020..9557fc8a085 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 627d61f3039..d005a8131f1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index e31335e15d9..9f0bc82400e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 211dcfe7dd0..5e4fa7732c0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 7b0fb5aa39f..d79073065dc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -339,6 +339,10 @@ % % \section{Mapping to property lists} % +% All mappings are done at the current group level, \emph{i.e.}~any +% local assignments made by the \meta{function} or \meta{code} discussed +% below remain in effect after the loop. +% % \begin{function}[updated = 2013-01-08, rEXP] % {\prop_map_function:NN, \prop_map_function:cN} % \begin{syntax} @@ -634,6 +638,13 @@ % \end{variable} % \end{variable} % +% \begin{variable}{\l_@@_internal_prop} +% Property list used by \cs{prop_set_from_keyval:Nn} and others. +% \begin{macrocode} +\prop_new:N \l_@@_internal_prop +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\prop_set_from_keyval:Nn, \prop_set_from_keyval:cn} % \begin{macro}{\prop_gset_from_keyval:Nn, \prop_gset_from_keyval:cn} % \begin{macro}{\prop_const_from_keyval:Nn, \prop_const_from_keyval:cn} @@ -647,69 +658,80 @@ % \@@_from_keyval_value:n, % \@@_from_keyval_value:w % } -% Loop through items separated by commas, with \cs{q_mark} to avoid -% losing braces. After checking for termination, split the item at -% the first then at the second |=| (which ought to be the first of the -% trailing~|=|). At both splits, trim spaces and -% call \cs{@@_from_keyval_key:w}, then \cs{@@_from_keyval_value:w}, -% followed by the trimmed material, \cs{q_nil}, the subsequent part of -% the item, and the trailing |=|'s and \cs{q_stop}. After finding the -% \meta{key} just store it after \cs{q_stop}. After finding the -% \meta{value} ignore completely empty items (both trailing~|=| were -% used as delimiters and all parts are empty); if the remaining -% part~|#2| consists exactly of the second trailing~|=| (namely there -% was exactly one |=|~in the item) then output one key--value pair for -% the property list; otherwise complain about a missing or extra~|=|. +% To avoid tracking throughout the loop the variable name and whether +% the assignment is local/global, do everything in a scratch variable +% and empty it afterwards to avoid wasting memory. Loop through items +% separated by commas, with \cs{prg_do_nothing:} to avoid losing +% braces. After checking for termination, split the item at the first +% and then at the second |=| (which ought to be the first of the +% trailing~|=| that we added). For both splits trim spaces and call a +% function (first \cs{@@_from_keyval_key:w} then +% \cs{@@_from_keyval_value:w}), followed by the trimmed material, +% \cs{q_nil}, the subsequent part of the item, and the trailing |=|'s +% and \cs{q_stop}. After finding the \meta{key} just store it after +% \cs{q_stop}. After finding the \meta{value} ignore completely empty +% items (both trailing~|=| were used as delimiters and all parts are +% empty); if the remaining part~|#2| consists exactly of the second +% trailing~|=| (namely there was exactly one |=|~in the item) then +% output one key--value pair for the property list; otherwise complain +% about a missing or extra~|=|. % \begin{macrocode} \cs_new_protected:Npn \prop_set_from_keyval:Nn #1#2 - { \tl_set:Nx #1 { \@@_from_keyval:n {#2} } } + { + \prop_clear:N \l_@@_internal_prop + \@@_from_keyval:n {#2} + \prop_set_eq:NN #1 \l_@@_internal_prop + \prop_clear:N \l_@@_internal_prop + } \cs_generate_variant:Nn \prop_set_from_keyval:Nn { c } \cs_new_protected:Npn \prop_gset_from_keyval:Nn #1#2 - { \tl_gset:Nx #1 { \@@_from_keyval:n {#2} } } + { + \prop_clear:N \l_@@_internal_prop + \@@_from_keyval:n {#2} + \prop_gset_eq:NN #1 \l_@@_internal_prop + \prop_clear:N \l_@@_internal_prop + } \cs_generate_variant:Nn \prop_gset_from_keyval:Nn { c } \cs_new_protected:Npn \prop_const_from_keyval:Nn #1#2 - { \tl_const:Nx #1 { \@@_from_keyval:n {#2} } } + { + \prop_clear:N \l_@@_internal_prop + \@@_from_keyval:n {#2} + \tl_const:Nx #1 { \exp_not:o \l_@@_internal_prop } + \prop_clear:N \l_@@_internal_prop + } \cs_generate_variant:Nn \prop_const_from_keyval:Nn { c } -\cs_new:Npn \@@_from_keyval:n #1 +\cs_new_protected:Npn \@@_from_keyval:n #1 { - \s_@@ - \@@_from_keyval_loop:w \q_mark #1 , + \@@_from_keyval_loop:w \prg_do_nothing: #1 , \q_recursion_tail , \q_recursion_stop } -\cs_new:Npn \@@_from_keyval_loop:w #1 , +\cs_new_protected:Npn \@@_from_keyval_loop:w #1 , { - \quark_if_recursion_tail_stop:o { \use_none:n #1 } + \quark_if_recursion_tail_stop:o {#1} \@@_from_keyval_split:Nw \@@_from_keyval_key:n - #1 = = \q_stop { \use_none:n #1 } - \@@_from_keyval_loop:w \q_mark + #1 = = \q_stop {#1} + \@@_from_keyval_loop:w \prg_do_nothing: } -\cs_new:Npn \@@_from_keyval_split:Nw #1#2 = - { - \tl_trim_spaces_apply:oN { \use_none:n #2 } #1 - \q_nil - } -\cs_new:Npn \@@_from_keyval_key:n #1 - { \@@_from_keyval_key:w #1 } -\cs_new:Npn \@@_from_keyval_key:w #1 \q_nil #2 \q_stop +\cs_new_protected:Npn \@@_from_keyval_split:Nw #1#2 = + { \tl_trim_spaces_apply:oN {#2} #1 } +\cs_new_protected:Npn \@@_from_keyval_key:n #1 + { \@@_from_keyval_key:w #1 \q_nil } +\cs_new_protected:Npn \@@_from_keyval_key:w #1 \q_nil #2 \q_stop { \@@_from_keyval_split:Nw \@@_from_keyval_value:n - \q_mark #2 \q_stop {#1} + \prg_do_nothing: #2 \q_stop {#1} } -\cs_new:Npn \@@_from_keyval_value:n #1 - { \@@_from_keyval_value:w #1 } -\cs_new:Npn \@@_from_keyval_value:w #1 \q_nil #2 \q_stop #3#4 +\cs_new_protected:Npn \@@_from_keyval_value:n #1 + { \@@_from_keyval_value:w #1 \q_nil } +\cs_new_protected:Npn \@@_from_keyval_value:w #1 \q_nil #2 \q_stop #3#4 { \tl_if_empty:nF { #3 #1 #2 } { \str_if_eq:nnTF {#2} { = } + { \prop_put:Nnn \l_@@_internal_prop {#3} {#1} } { - \exp_not:N \@@_pair:wn \tl_to_str:n {#3} - \s_@@ { \exp_not:n {#1} } - } - { - \__kernel_msg_expandable_error:nnf - { kernel } { prop-keyval } - { \exp_after:wN \exp_stop_f: #4 } + \__kernel_msg_error:nnx { kernel } { prop-keyval } + { \exp_not:o {#4} } } } } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 4828431c13c..9ef207f3462 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx index db5b3030412..f4f3fb1ddd5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 9b57df58637..2a0083bd6af 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -486,6 +486,10 @@ % % \section{Mapping to sequences} % +% All mappings are done at the current group level, \emph{i.e.}~any +% local assignments made by the \meta{function} or \meta{code} discussed +% below remain in effect after the loop. +% % \begin{function}[rEXP, updated = 2012-06-29] % {\seq_map_function:NN, \seq_map_function:cN} % \begin{syntax} @@ -521,7 +525,9 @@ % Stores each \meta{item} of the \meta{sequence} in turn in the (token % list) \meta{variable} and applies the \meta{code}. The \meta{code} % will usually make use of the \meta{variable}, but this is not -% enforced. The assignments to the \meta{variable} are local. The +% enforced. The assignments to the \meta{variable} are local. Its +% value after the loop is the last \meta{item} in the \meta{sequence}, +% or its original value if the \meta{sequence} is empty. The % \meta{items} are returned from left to right. % \end{function} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 2dc86854f70..7f086805832 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index 90debbc4743..ddff3a85835 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx index 56271d4fdd1..1343955f7a4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str-convert.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index 437ca6caa05..32dd203cfc4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -401,6 +401,10 @@ % % \section{Mapping to strings} % +% All mappings are done at the current group level, \emph{i.e.}~any +% local assignments made by the \meta{function} or \meta{code} discussed +% below remain in effect after the loop. +% % \begin{function}[added = 2017-11-14, rEXP] % {\str_map_function:NN, \str_map_function:cN} % \begin{syntax} @@ -454,7 +458,9 @@ % in turn in the (string or token list) \meta{variable} and applies % the \meta{code}. The \meta{code} will usually make use of the % \meta{variable}, but this is not enforced. The assignments to the -% \meta{variable} are local. See also \cs{str_map_inline:Nn}. +% \meta{variable} are local. Its value after the loop is the last +% \meta{character} in the \meta{string}, or its original value if the +% \meta{string} is empty. See also \cs{str_map_inline:Nn}. % \end{function} % % \begin{function}[added = 2017-11-14] @@ -467,7 +473,9 @@ % the (string or token list) \meta{variable} and applies the % \meta{code}. The \meta{code} will usually make use of the % \meta{variable}, but this is not enforced. The assignments to the -% \meta{variable} are local. See also \cs{str_map_inline:Nn}. +% \meta{variable} are local. Its value after the loop is the last +% \meta{character} in the \meta{string}, or its original value if the +% \meta{string} is empty. See also \cs{str_map_inline:Nn}. % \end{function} % % \begin{function}[added = 2017-10-08, rEXP]{\str_map_break:} @@ -1275,6 +1283,10 @@ % times speed up by testing only every $9$-th character for whether it % is \cs{q_recursion_tail} (also by converting $9$ spaces at a time in % the \cs{str_map_function:nN} case). +% +% For the \texttt{map_variable} functions we use a string assignment +% to store each character because spaces are made catcode~$12$ before +% the loop. % \begin{macrocode} \cs_new:Npn \str_map_function:nN #1#2 { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index d27f71cdf4d..149c5771882 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index d75531e26ea..02e08827b44 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -88,6 +88,9 @@ % parameter, 7: superscript, 8: subscript, A: space, B: letter, % C:other, D:active). % \end{itemize} +% As all other mappings the mapping is done at the current group +% level, \emph{i.e.}~any local assignments made by the \meta{inline +% function} remain in effect after the loop. % \end{function} % % \end{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index cb617cc5a25..77444e6d13c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % @@ -505,6 +505,10 @@ % % \section{Mapping to token lists} % +% All mappings are done at the current group level, \emph{i.e.}~any +% local assignments made by the \meta{function} or \meta{code} discussed +% below remain in effect after the loop. +% % \begin{function}[updated = 2012-06-29, rEXP] % {\tl_map_function:NN, \tl_map_function:cN} % \begin{syntax} @@ -555,8 +559,10 @@ % Stores each \meta{item} of the \meta{tl~var} in turn in the (token % list) \meta{variable} and applies the \meta{code}. The \meta{code} % will usually make use of the \meta{variable}, but this is not -% enforced. The assignments to the \meta{variable} are local. See -% also \cs{tl_map_inline:Nn}. +% enforced. The assignments to the \meta{variable} are local. Its +% value after the loop is the last \meta{item} in the \meta{tl~var}, +% or its original value if the \meta{tl~var} is blank. See also +% \cs{tl_map_inline:Nn}. % \end{function} % % \begin{function}[updated = 2012-06-29]{\tl_map_variable:nNn} @@ -567,6 +573,8 @@ % (token list) \meta{variable} and applies the \meta{code}. The % \meta{code} will usually make use of the \meta{variable}, but this % is not enforced. The assignments to the \meta{variable} are local. +% Its value after the loop is the last \meta{item} in the +% \meta{tl~var}, or its original value if the \meta{tl~var} is blank. % See also \cs{tl_map_inline:nn}. % \end{function} % @@ -1558,12 +1566,12 @@ % \begin{macro}[EXP]{\@@_rescan:NNw} % In a group, after some initial setup explained below and the user % setup~|#3| (followed by \cs{scan_stop:} to be safe), there is a call -% to \cs{@@_set_rescan:nNN}. This shared auxiliary distinguishes -% single-line and multi-line files as explained below. In the -% simplest case of multi-line files it calls (with the same arguments) +% to \cs{@@_set_rescan:nNN}. This shared auxiliary defined later +% distinguishes single-line and multi-line ``files''. In the simplest +% case of multi-line files, it calls (with the same arguments) % \cs{@@_set_rescan_multi:nNN}, whose code is included here to help -% understand the approach: it rescans its argument |#1|, closes the -% group, and performs the assignment. +% understand the approach. This function rescans its argument |#1|, +% closes the group, and performs the assignment. % % One difficulty when rescanning is that \tn{scantokens} treats the % argument as a file, and without the correct settings a \TeX{} error @@ -1575,9 +1583,9 @@ % \tn{scantokens} and closing it inside that temporary file; we avoid % that by setting \tn{tracingnesting}. The standard solution to the % ``File ended'' error is to grab the rescanned tokens as a delimited -% argument of an auxiliary, here \cs{@@_set_rescan:NNw}, that performs -% the assignment, then let \TeX{} ``execute'' the end of file marker. -% As usual in delimited arguments we use \cs{prg_do_nothing:} to avoid +% argument of an auxiliary, here \cs{@@_rescan:NNw}, that performs the +% assignment, then let \TeX{} ``execute'' the end of file marker. As +% usual in delimited arguments we use \cs{prg_do_nothing:} to avoid % stripping an outer set braces: this is removed by using % \texttt{o}-expanding assignments. The delimiter cannot appear % within the rescanned token list because it contains twice the same @@ -1589,6 +1597,19 @@ % rescanned result is code that looks further in the input stream for % arguments, it would break. % +% For multi-line files the only subtlety is that \tn{newlinechar} +% should be equal to \tn{endlinechar} because \tn{newlinechar} +% characters become new lines and then become \tn{endlinechar} +% characters when writing to an abstract file and reading back. This +% equality is ensured by setting \tn{newlinechar} equal to +% \tn{endlinechar}. Prior to this, \tn{endlinechar} is set to $-1$ if +% it was $32$ (in particular true after \cs{ExplSyntaxOn}) to avoid +% unreasonable line-breaks at every space for instance in error +% messages triggered by the user setup. Another side effect of +% reading back from the file is that spaces (catcode $10$) are ignored +% at the beginning of lines, and spaces and tabs (character code $32$ +% and $9$) are ignored at the end of lines. +% % The two \cs{if_false:} \ldots{} \cs{fi:} are there to prevent % alignment tabs to cause a change of tabular cell while rescanning. % We put the \enquote{opening} one after \cs{group_begin:} so that if @@ -1596,22 +1617,21 @@ % remain balanced. This is essential in \texttt{e}-type arguments % when \tn{expanded} is not available. % \begin{macrocode} -\cs_new_protected:Npn \tl_set_rescan:Nnn - { \@@_set_rescan:NNnn \tl_set:No } -\cs_new_protected:Npn \tl_gset_rescan:Nnn - { \@@_set_rescan:NNnn \tl_gset:No } \cs_new_protected:Npn \tl_rescan:nn #1#2 { \tl_set_rescan:Nnn \l_@@_internal_a_tl {#1} {#2} \exp_after:wN \tl_clear:N \exp_after:wN \l_@@_internal_a_tl \l_@@_internal_a_tl } +\cs_new_protected:Npn \tl_set_rescan:Nnn + { \@@_set_rescan:NNnn \tl_set:No } +\cs_new_protected:Npn \tl_gset_rescan:Nnn + { \@@_set_rescan:NNnn \tl_gset:No } \cs_new_protected:Npn \@@_set_rescan:NNnn #1#2#3#4 { \group_begin: \if_false: { \fi: \int_set_eq:NN \tex_tracingnesting:D \c_zero_int - \exp_args:No \tex_everyeof:D { \c_@@_rescan_marker_tl } \int_compare:nNnT \tex_endlinechar:D = { 32 } { \int_set:Nn \tex_endlinechar:D { -1 } } \int_set_eq:NN \tex_newlinechar:D \tex_endlinechar:D @@ -1621,6 +1641,7 @@ } \cs_new_protected:Npn \@@_set_rescan_multi:nNN #1#2#3 { + \exp_args:No \tex_everyeof:D { \c_@@_rescan_marker_tl } \exp_after:wN \@@_rescan:NNw \exp_after:wN #2 \exp_after:wN #3 @@ -1645,27 +1666,14 @@ % \end{macro} % % \begin{macro}{\@@_set_rescan:nNN} -% \begin{macro}{\@@_set_rescan_single:nnNN, \@@_set_rescan_single_aux:nnNN} -% This function calls \cs{@@_set_rescan_multi:nNN} or -% \cs{@@_set_rescan_single:nnNN} |{ ' }| depending on whether its -% argument is a single-line fragment of code/data or is made of -% multiple lines by testing for the presence of a \tn{newlinechar} -% character. If \tn{newlinechar} is out of range, the argument is -% assumed to be a single line. -% -% The case of multiple lines is a straightforward application of -% \tn{scantokens} as described above. The only subtlety is that -% \tn{newlinechar} should be equal to \tn{endlinechar} because -% \tn{newlinechar} characters become new lines and then become -% \tn{endlinechar} characters when writing to an abstract file and -% reading back. This equality is ensured by setting \tn{newlinechar} -% equal to \tn{endlinechar}. Prior to this, \tn{endlinechar} is set -% to $-1$ if it was $32$ (in particular true after \cs{ExplSyntaxOn}) -% to avoid unreasonable line-breaks at every space for instance in -% error messages triggered by the user setup. Another side effect of -% reading back from the file is that spaces (catcode $10$) are -% ignored at the beginning of lines, and spaces and tabs (character -% code $32$ and $9$) are ignored at the end of lines. +% \begin{macro}{\@@_set_rescan_single:nnNN, \@@_set_rescan_single_aux:nnnNN} +% \begin{macro}[rEXP]{\@@_set_rescan_single_aux:w} +% The function \cs{@@_set_rescan:nNN} calls \cs{@@_set_rescan_multi:nNN} or +% \cs{@@_set_rescan_single:nnNN} |{ ' }| depending on whether its argument +% is a single-line fragment of code/data or is made of multiple lines +% by testing for the presence of a \tn{newlinechar} character. If +% \tn{newlinechar} is out of range, the argument is assumed to be a +% single line. % % For a single line, no \tn{endlinechar} should be added, so it is % set to $-1$, and spaces should not be removed. @@ -1682,13 +1690,27 @@ % of starting point was made because this is the start of a very long % range of characters whose standard category is letter or other, % thus minimizing the number of steps needed by the loop (most often -% just a single one). Once a valid character is found, run some code -% very similar to \cs{@@_set_rescan_multi:nNN} but with that character -% put at the start and end. The auxiliary \cs{@@_rescan:NNw} must be -% redefined to also remove the additional character (with the -% appropriate catcode thanks to \cs{char_generate:nn}). If no valid -% character is found (very rare), fall-back on -% \cs{@@_set_rescan_multi:nNN}. +% just a single one). If no valid character is found (very rare), +% fall-back on \cs{@@_set_rescan_multi:nNN}. +% +% Otherwise, once a valid character is found (let us use |'| in this +% explanation) run some code very similar to \cs{@@_set_rescan_multi:nNN} +% but with |'| added at both ends of the input. Of course, we need to +% define the auxiliary \cs{@@_set_rescan_single:NNww} on the fly to remove +% the additional~|'| that is just before |::| (by which we mean +% \cs{c_@@_rescan_marker_tl}). Note that the argument must be +% delimited by |'| with the current catcode; this is done thanks to +% \cs{char_generate:nn}. Yet another issue is that the rescanned +% token list may contain a comment character, in which case the |'| we +% expected is not there. We fix this as follows: rather than just +% |::| we set \tn{everyeof} to |::|\Arg{code1} |'::|\Arg{code2} +% \cs{q_stop}. The auxiliary \cs{@@_set_rescan_single:NNww} runs the +% \texttt{o}-expanding assignment, expanding either \meta{code1} or +% \meta{code2} before its the main argument~|#3|. In the typical case +% without comment character, \meta{code1} is expanded, removing the +% leading~|'|. In the rarer case with comment character, \meta{code2} +% is expanded, calling \cs{@@_set_rescan_single_aux:w}, which removes the +% trailing |::|\Arg{code1} and the leading~|'|. % \begin{macrocode} \cs_new_protected:Npn \@@_set_rescan:nNN #1 { @@ -1710,7 +1732,8 @@ \int_compare:nNnTF { \char_value_catcode:n {#1} / 2 } = 6 { - \exp_args:Nf \@@_set_rescan_single_aux:nnNN + \exp_args:Nof \@@_set_rescan_single_aux:nnnNN + \c_@@_rescan_marker_tl { \char_generate:nn {#1} { \char_value_catcode:n {#1} } } } { @@ -1722,23 +1745,32 @@ { \@@_set_rescan_multi:nNN } } } -\cs_new_protected:Npn \@@_set_rescan_single_aux:nnNN #1#2#3#4 +\cs_new_protected:Npn \@@_set_rescan_single_aux:nnnNN #1#2#3#4#5 { - \exp_args:Nno \use:nn - { \cs_set:Npn \@@_rescan:NNw ##1##2##3 #1 } - \c_@@_rescan_marker_tl + \tex_everyeof:D + { + #1 \use_none:n + #2 #1 { \exp:w \@@_set_rescan_single_aux:w } + \q_stop + } + \cs_set:Npn \@@_rescan:NNw ##1##2##3 #2 #1 ##4 ##5 \q_stop { \group_end: - ##1 ##2 { \use_none:n ##3 } + ##1 ##2 { ##4 ##3 } } \exp_after:wN \@@_rescan:NNw - \exp_after:wN #3 \exp_after:wN #4 - \tex_scantokens:D { #1 #2 #1 } + \exp_after:wN #5 + \tex_scantokens:D { #2 #3 #2 } } +\exp_args:Nno \use:nn + { \cs_new:Npn \@@_set_rescan_single_aux:w #1 } + \c_@@_rescan_marker_tl #2 + { \use_i:nn \exp_end: #1 } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Modifying token list variables} % @@ -2379,9 +2411,10 @@ % \begin{macro}{\tl_map_variable:nNn} % \begin{macro}{\tl_map_variable:NNn, \tl_map_variable:cNn} % \begin{macro}{\@@_map_variable:Nnn} -% \cs{tl_map_variable:nNn} \meta{token list} \meta{temp} \meta{action} -% assigns -% \meta{temp} to each element and executes \meta{action}. +% \cs{tl_map_variable:nNn} \meta{token list} \meta{tl~var} +% \meta{action} assigns \meta{tl~var} to each element and executes +% \meta{action}. The assignment to \meta{tl~var} is done after the +% quark test so that this variable does not get set to a quark. % \begin{macrocode} \cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 { @@ -2393,8 +2426,8 @@ { \exp_args:No \tl_map_variable:nNn } \cs_new_protected:Npn \@@_map_variable:Nnn #1#2#3 { + \quark_if_recursion_tail_break:nN {#3} \tl_map_break: \tl_set:Nn #1 {#3} - \quark_if_recursion_tail_break:NN #1 \tl_map_break: \use:n {#2} \@@_map_variable:Nnn #1 {#2} } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 55f271526f1..9b9946a4f8c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx index 4e278331559..fbaa4659352 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2019-08-14} +% \date{Released 2019-08-25} % % \maketitle % -- cgit v1.2.3