#12178: Error in typeset of polynomials
----------------------+-----------------------------------------------------
Reporter: ppurka | Owner: jason
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.8
Component: misc | Keywords: latex typeset
Work_issues: | Upstream: N/A
Reviewer: | Author: Punarbasu Purkayastha
Merged: | Dependencies:
----------------------+-----------------------------------------------------
Comment(by ppurka):
Replying to [comment:5 novoselt]:
> 1. Is this indeed the desired behaviour?
I believe it should be the desired behavior. Numbers by themselves are not
sandwiched between a `\verb| |` construct. So, I don't understand why
numbers ending with ? should be displayed as verbatim. With this patch,
the only case where ? might be displayed non-verbatim is when one of the
following occurs by themselves: `?`, `-?` or `+?`. All three of these are
grammatically incorrect and I can't imagine a situation where they can
arise by themselves.
> 2. If yes, the comment before that changed line should be expanded to
reflect it.
I will do that. Sorry for not noticing it.
> 3. I still don't quite understand how the above output could appear,
even if these numbers were wrapped into verb, it should have been done
correctly. Is there another bug?..
It took a while, but I have finally tracked it down to a line in
`sage/rings/polynomial/polynomial_element.pyx`, inside the `_latex_()`
function of the class `Polynomial`:
{{{
s = s.replace("|","")
}}}
I don't know why this replacement has to be performed, but this is the
reason why the `|` from `\verb` is being stripped off. Example print
statements are in the following output (I will attach the patch containing
the print statements shortly, so that you can reproduce this):
{{{
sage: sage.misc.latex.EMBEDDED_MODE=True
sage: x = AA['x'].0; y = factor(x^2 + x + 1); view(y)
DEBUG: Factorization._latex_, after for: self.__x[i][0] = x^2 + x +
1.000000000000000?
DEBUG: str_function, before return: x = \verb|1.000000000000000?| <type
'str'>
DEBUG: Polynomial._latex_, before s.replace(|): s = x^{2} + x +
\verb|1.000000000000000?|
DEBUG: Factorization._latex_, before if not atomic: t = x^{2} + x +
\verb1.000000000000000?
DEBUG: Factorization._latex_, after for: self.__x[i][0] = x^2 + x +
1.000000000000000?
DEBUG: str_function, before return: x = \verb|1.000000000000000?| <type
'str'>
DEBUG: Polynomial._latex_, before s.replace(|): s = x^{2} + x +
\verb|1.000000000000000?|
DEBUG: Factorization._latex_, before if not atomic: t = x^{2} + x +
\verb1.000000000000000?
<html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}(x^{2} + x +
\verb1.000000000000000?)</span></html>
}}}
PS: There is a separate issue that can be seen in the above DEBUG output,
and that is that the functions are all being called twice.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12178#comment:6>
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.