[pstricks] Suggestions for \psPrintValue
Buddy Ledger
buddyledger at gmail.com
Tue Apr 28 20:56:26 CEST 2009
>>/ Using your code as a guide I wrote the macro below. It uses the fp package
/>>/ for the heavy lifting. I am having trouble with spaces in the output,
/>>/ I've tryed using \ignorespaces with no luck. If you have any ideas
/>>/ about how to fix it, I'd appreciate it.
/>>/
/>>/ I wrote this to convert #.####### or ///#.#####E#// /-> #.##E# or
/>>/ #.##x10^# or #.##
/>
>you should also have a look at the numprint package.
>try "texdoc numprint"
>
>Herbert
Thanks for the suggestion. Unfortunately I don't believe that the numprint package
supports the type of conversions I'm looking for. The docs indicate numprint behaves like:
Input Format #.##### --> Output Format #.#### (cannot achieve #.###E#)
Input Format #.###E# --> Output Format #.##E# (cannot achieve #.####)
numprint works with the input as a string and the conversions I want require a bit of math. The
amount of math required is far less than I've used since a combination of string/math operations would
likely be most efficient......but I was in a hurry :).
The function I wrote (at least partially anyway, thanks Micheal) will do:
Input Format #.##### --> Output Format #.#### or #.###E#
Input Format #.###E# --> Output Format #.#### or #.###E#
However, the function is limited by the fp fixed point math limitations. A simpler implimentation
would use intger math to move the decimal place in the input (xstring package possible) to the correct location and a math function to
do rounding (fp package or a "simple" recursive loop). I did't know how to parse a string until looking at the inards of the numprint package (thanks for
the push in the right direction) so I didn't do it that way.
Buddy
More information about the PSTricks
mailing list