Hi,

On 28 June 2010 16:43, Aaron S. Meurer <[email protected]> wrote:

> Actually, looking closer at the question, I think he wants to get
> $\frac{2^2}{3}$.  This is possible, but not easy.  You basically have to
> manually use Mul, Pow, and Add and use the evaluate=False flag, i.e.:
>
> In [2]: Mul(Pow(2, 2, evaluate=False), Pow(3, -1, evaluate=False),
> evaluate=False)
> Out[2]:
>  2
> 2
> ──
> 3
>
> I have created issue 1966 to make an easier way to do this by adding an
> evaluate option to sympify.  See
> http://code.google.com/p/sympy/issues/detail?id=1966.  Unfortunately, it
> looks like it still wouldn't work, because of another bug:
>
> In [3]: latex(Mul(Pow(2, 2, evaluate=False), Pow(3, -1, evaluate=False),
> evaluate=False))
> Out[3]: \frac{4}{3}
>
> See issue 1967 at http://code.google.com/p/sympy/issues/detail?id=1967.
>
> And to answer the originally phrased question, I do not know about any
> other Python packages that do this, but others may.
>
>
Also don't forget about 'hold' branch in my github repository. There is no
LaTeX support yet in it, but this will be trivial to add.


> Aaron Meurer
> On Jun 27, 2010, at 2:15 PM, Mateusz Paprocki wrote:
>
> Hi,
>
> On 27 June 2010 15:50, ilovesss2004 <[email protected]> wrote:
>
>> Hi,
>> The latex print function in sympy only can make latex code for math
>> expression which includes at least a variable. If we input an
>> expression without any variable like latex('2**2/3'), we will get
>> '$1$' instead of '$\\frac{1}{3} 2^{2}$'.
>>
>>
> just enter
>
> >>> latex(2**S(2)/3)
> '$\\frac{4}{3}$'
>
> 2/3 usually means floor division (you won't get a rational number this
> way).
>
> Is there a python package I can use to output latex code for math
>> expression without variables?
>>
>> Thanks a lot.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected] <sympy%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>>
> Mateusz
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
>
>
Mateusz

>  --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <sympy%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to