id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
7406,bug in conversion powers in to LaTeX,robert.marik,burcin,"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}
}}}",defect,closed,major,sage-4.3,symbolics,fixed,"latex, power, jsmath, pynac",,sage-4.3.rc0,Burcin Erocal,Karl-Dieter Crisman,N/A,,,,,