#7406: bug in conversion powers in to LaTeX
----------------------------+-----------------------------------------------
Reporter: robert.marik | Owner: burcin
Type: defect | Status: new
Priority: major | Milestone: sage-4.3
Component: symbolics | Keywords: latex, power, jsmath
Work_issues: | Author:
Reviewer: | Merged:
----------------------------+-----------------------------------------------
Description changed by robert.marik:
Old description:
> The LaTeX representation of (x^pi)^e is not valid TeX string and is not
> rendered by jsmath
> {{{
> sage: latex((x^pi)^e)
> {(x)}^{\pi}^{e}
> }}}
>
> Burcin [http://groups.google.cz/group/sage-
> devel/browse_thread/thread/c49c684f1c89d0c4 suggested] how to fix this
> and get output like
> {{{
> {{(x)}^{\pi}}^{e}
> }}}
>
> {{{
> The code for printing
> symbolic expressions is in pynac (C++). The fix can be as simple as
> printing an extra set of braces around power objects.
>
> If anybody wants to try fixing this, the relevant function is
> power::do_print_latex() in power.cpp. To get to the file (using the
> instructions I wrote in another message just now), go to your SAGE_ROOT
> and do:
>
> ./sage -f -s spkg/standard/pynac-0.1.9.p0.spkg
>
> cd spkg/build/pynac-0.1.9/src/ginac
>
> Edit power.cpp. To compile and make your changes effective, go to your
> SAGE_ROOT again, and do
>
> ./sage -sh
> cd spkg/build/pynac-0.1.9/src
> make install
> }}}
>
> However a better fix would be to get
> {{{
> {x}^{a}
> }}}
> if the base is an atom (or not power) and
> {{{
> \left({x^a}\right}^{b}
> }}}
> if the base is a power. This allows to distinguish easily between
> {{{
> x^(a^b)
> }}}
> and
> {{{
> (x^a)^b
> }}}
>
> A workaround is to remove powers of powers by simplification. For example
> radcan function from Maxima perfoms such simplifications
> {{{
> sage: latex(maxima((x^pi)^e).radcan().sage())
> x^{\pi e}
> }}}
New description:
The LaTeX representation of (x^pi)^e is not valid TeX string and is not
rendered by jsmath
{{{
sage: latex((x^pi)^e)
{(x)}^{\pi}^{e}
}}}
Burcin [http://groups.google.cz/group/sage-
devel/browse_thread/thread/c49c684f1c89d0c4 suggested] how to fix this and
get output like
{{{
{{(x)}^{\pi}}^{e}
}}}
{{{
The code for printing
symbolic expressions is in pynac (C++). The fix can be as simple as
printing an extra set of braces around power objects.
If anybody wants to try fixing this, the relevant function is
power::do_print_latex() in power.cpp. To get to the file (using the
instructions I wrote in another message just now), go to your SAGE_ROOT
and do:
./sage -f -s spkg/standard/pynac-0.1.9.p0.spkg
cd spkg/build/pynac-0.1.9/src/ginac
Edit power.cpp. To compile and make your changes effective, go to your
SAGE_ROOT again, and do
./sage -sh
cd spkg/build/pynac-0.1.9/src
make install
}}}
However a better fix would be to get
{{{
{x}^{a}
}}}
if the base is an atom (or not power) and
{{{
\left({x^a}\right)^{b}
}}}
if the base is a power. This allows to distinguish easily between
{{{
x^(a^b)
}}}
and
{{{
(x^a)^b
}}}
A workaround is to remove powers of powers by simplification. For example
radcan function from Maxima perfoms such simplifications
{{{
sage: latex(maxima((x^pi)^e).radcan().sage())
x^{\pi e}
}}}
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7406#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" 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/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---