1 | initial version |
That was really dumb.
def numprint(x):
x = round(x, ndigits=3)
x = latex(x)
x = str(x)
x = x.replace('.', ',\!').replace('\\times','\, \ldotp')
x = x.rstrip('0').rstrip(',\!') if ',\!' in x else x
x = sage.misc.latex.LatexExpr(x)
return x
Maybe this solution is dumb too, but it works :D
2 | No.2 Revision |
That was really dumb.
\begin{sagesilent}
def numprint(x):
x = round(x, ndigits=3)
x = latex(x)
x = str(x)
x = x.replace('.', ',\!').replace('\\times','\, \ldotp')
x = x.rstrip('0').rstrip(',\!') if ',\!' in x else x
x = sage.misc.latex.LatexExpr(x)
return x
\end{sagesilent}
\newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}
Maybe this solution is dumb too, but it works :D