On Tue, 23 Mar 2010 at 07:25AM -0700, iDan wrote:
> Hi,
> In french, we use comma as decimal separator.  How can I convert the
> result of the instruction \sage{} (from sagetex package) ?

Hrm, unfortunately, I don't think this is possible right now.

You can have Sage insert a comma in this way:

sage: x = 1.234 
sage: x.str().replace('.', ',')
'1,23400000000000'

so in your TeX file, you could do

$\sage{(sqrt(3)).str().replace('.', ',')}$

which is not very pleasant.

You could define a small function which makes this nicer:

\begin{sagesilent}
  def numprint(x):
    return x.str().replace('.', ',')
\end{sagesilent}

and then use \sage{numprint(x)}, which is a bit nicer.

Python has a bit of support for locale-dependent printing, which I
should go investigate.

I think the real long-term solution is to change the str() method to
allow commas as the decimal separator and create a configuration option
so that a user can say "use commas always".

Dan

-- 
---  Dan Drake
-----  http://mathsci.kaist.ac.kr/~drake
-------

Attachment: signature.asc
Description: Digital signature

Reply via email to