Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10466 > unrolled thread

Re: ToString Awkwardness

Started byChristoph Lhotka <christoph.lhotka@fundp.ac.be>
First post2012-06-14 09:28 +0000
Last post2012-06-14 09:28 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: ToString Awkwardness Christoph Lhotka <christoph.lhotka@fundp.ac.be> - 2012-06-14 09:28 +0000

#10466 — Re: ToString Awkwardness

FromChristoph Lhotka <christoph.lhotka@fundp.ac.be>
Date2012-06-14 09:28 +0000
SubjectRe: ToString Awkwardness
Message-ID<jrcar7$dnj$1@smc.vnet.net>
Hi,

  you have some control on it using the FormatType option:

   
"f(x)="<>ToString[8.71*^-15,FormatType->#]&/@{TraditionalForm,CForm,InputForm,StandardForm}

   {f(x)=8.71*10^-15,f(x)=8.71e-15,f(x)=8.71*^-15,f(x)=8.71`*^-15}

Hope that helps,

  Christoph

PS: the "funny" form is the one which would render correctly on a console


On 06/13/2012 10:55 AM, Kevin J. McCann wrote:
> I have several plots with annotation that includes parameter values. I
> am using ToString inside a Text command to do this, and all is well
> unless the values are small so that the results are in scientific
> notation. When this happens, I get something like this:
>
> "f(x) = "<>  ToString[8.71 10^-15]
>
> f(x) =        -15
>          8.71 10
>
> Which is a bit awkward looking in the plot. Upon further investigation,
> I looked at the FullForm of the above and got:
>
> "f(x) =        -15\n8.71 10"
>
> So, I see why the output "looks funny". The exponent is treated
> separately from the 10. Any suggestions for nicer looking output?
>
> Thanks,
>
> Kevin
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web