diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty index 850ff9f61a0..53429eff945 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -20,7 +20,7 @@ %% %% File: l3str-format.dtx Copyright (C) 2012-2013,2015,2016 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3str-format.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3str-format.dtx 6948 2017-02-18 14:50:25Z bruno $ {L3 Experimental string formatting} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -30,7 +30,7 @@ \cs_generate_variant:Nn \tl_to_str:n { f } \prg_new_conditional:Npnn \__str_format_if_digit:N #1 { TF } { - \if_int_compare:w \c_nine < 1 #1 \exp_stop_f: + \if_int_compare:w 9 < 1 #1 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:Npn \__str_format_put:nw #1 #2 \s__stop { #2 \s__stop #1 } @@ -129,9 +129,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero - { #3 - \__str_count:n { #2 #1 } - \c_one } - / \c_two + \int_max:nn { 0 } + { #3 - \__str_count:n { #2 #1 } - 1 } + / 2 } {#4} } @@ -139,9 +139,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero + \int_max:nn { 0 } { #3 - \__str_count:n { #2 #1 } } - / \c_two + / 2 } {#4} } @@ -249,7 +249,7 @@ \token_if_eq_charcode:NNTF #2 ? { \__str_format_put:nw { #1 > } } { \__str_format_put:nw { #1 #2 } } - \int_compare:nNnTF {#7} < \c_zero + \int_compare:nNnTF {#7} < 0 { \__str_format_put:nw { - } } { \str_case:nnF {#3} @@ -364,9 +364,9 @@ { \__str_format_put:fw { \int_eval:n { #3 - 1 } } \__str_format_put:nw { e } - \int_compare:nNnTF {#8} > \c_sixteen + \int_compare:nNnTF {#8} > \c__fp_prec_int { - \__str_format_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} } + \__str_format_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } \__str_format_put:fw { \use_none:n #4#5#6#7 } } { @@ -417,14 +417,20 @@ \cs_new:Npn \__str_format_fp_g_aux:wn #1; #2 { \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } - { \fp_to_scientific:n } + { \__str_format_to_scientific:n } { \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} - { \fp_to_scientific:n } + { \__str_format_to_scientific:n } { \fp_to_decimal:n } } { \__fp_set_sign_o:w 0 #1; @ \prg_do_nothing: } } +\cs_new:Npn \__str_format_to_scientific:n + { + \exp_after:wN \__str_format_fp_trim:w + \exp:w \exp_end_continue_f:w \fp_to_scientific:n + } +\cs_new:Npn \__str_format_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } \__msg_kernel_new:nnn { str } { invalid-format } { Invalid~format~'#1'. } \__msg_kernel_new:nnn { str } { invalid-align-format } |