On 27/08/2015 12:50 a.m., Joseph Wright wrote:
> On 26/08/2015 00:44, aparsloe wrote:
>> (2) Using \fp_to_scientific:n on the result of an l3fp calculation
>> produces, say, 6.023e23. I want to write this as 6.023 \times 10^{23},
>> but the "e" of 6.023e23 doesn't have its "usual" catcode so
>> \tl_replace_once:Nnn doesn't find the "e". (I presume "e" has catcode
>> "other" -- I haven't checked.) Hence I rescan 6.023e23 with an empty
>> setup and then use \tl_replace_once:Nnn (which now does find the "e").
> Your question has prompted us to take another look at
> \fp_to_scientific:n/\fp_to_tl:n. The catcode of "e" is clearly not
> expected here: I'm going to adjust to produce a 'letter'. We are
> wondering about the wider use case for \fp_to_scientific:n: as it stands
> the code doesn't *always* produce a number of the for
>
>    [-]<digits>.<digits>e[-]<digits>
>
> so it can't be parsed without some testing. That's little different to
> \fp_to_tl:n, which in many ways might be more generally useful. Can you
> fill us in on your use?
>
> Joseph
>
> P.S. Something seems to be up with your system/e-mail date settings: all
> of your mail is from the future!
>
I had noticed that for numbers in the range 0 < number < 10 that there 
was no "e" and one had to test for this case.

As indicated in an earlier (even if from the future) email I've written 
a package that evaluates latex mathematical expressions by converting 
them to l3fp expressions, for use with the preview facility in LyX. The 
expectation is that the output of calculations will be typeset. Hence, 
for instance, to calculate Boltzmann's constant k from the gas constant 
R and Avogadro's number N, form the quotient R/N. Since these numbers 
are presented in tables in scientific notation, in text one would write 
them in that form and expect their quotient, when evaluated, to be 
similarly presented: 1.38\times10^{16} (rather than the 1.38e16 output 
by l3fp). With my package one might write: 
"$k=R/N=8.314\times10^{7}/6.023\times10^{23}$ which evaluates to 
$\clyx(8.314\times10^{7}/6.023\times10^{23})[19e]$". One writes the 
numerical fraction only once, copy-&-pasting it into the \clyx command 
which converts to fp form (in this simple case by substituting * for 
\times) and evaluates the expression. In LyX the math stuff is entered 
in so-called math insets and the calculation is done "before one's eyes" 
so that one can see the result while continuing writing further text.

Andrew
[The system date on my computer is correct. I can't see a setting for 
time in Thunderbird. But I do live reasonably close to the International 
Date Line.]


LyX Document


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus