Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#6268 closed defect (fixed)

[with patch, positive review] Typesetting of sec(x), csc(x), cot(x) are broken

Reported by: gmhossain Owned by: burcin
Priority: major Milestone: sage-4.0.2
Component: symbolics Keywords:
Cc: ncalexan Merged in: 4.0.2.alpha0
Authors: John Palmieri Reviewers: Nick Alexander
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Typesettings of sec(x), csc(x), cot(x) are broken. It puts an extra "\mbox" around them. However, typesetting for sin(x), cos(x), tan(x) works as expected.

Attachments (2)

trac_6268.patch (2.0 KB) - added by jhpalmieri 10 years ago.
trac_6268-py_print_latex.patch (3.0 KB) - added by burcin 10 years ago.
new patch, apply only this one

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by mvngu

[mvngu@sage sage-4.0.1]$ sage
----------------------------------------------------------------------
| Sage Version 4.0.1, Release Date: 2009-06-06                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: # the following work as expected
sage: latex(sec)
\sec
sage: latex(csc)
\csc
sage: latex(cot)
\cot
sage: # but the following have extra "\mbox" around the trig function name
sage: latex(sec(x))
\mbox{\sec}\left(x\right)
sage: latex(csc(x))
\mbox{\csc}\left(x\right)
sage: latex(cot(x))
\mbox{\cot}\left(x\right)

comment:2 follow-up: Changed 10 years ago by jhpalmieri

  • Milestone set to sage-4.0.2
  • Summary changed from Typesetting of sec(x), csc(x), cot(x) are broken to [with patch, not ready for review] Typesetting of sec(x), csc(x), cot(x) are broken

Is this a bug in ginac/pynac? Look at this:

sage: SR
Symbolic Ring
sage: SR._latex_element_(sin(x))
'\\sin\\left(x\\right)'
sage: SR._latex_element_(sec(x))
'\\mbox{\\sec}\\left(x\\right)'

The method _latex_element_ is a one-liner:

        return GEx_to_str_latex(&x._gobj)

and I think GEx_to_str_latex is a ginac/pynac thing. At least, I found it in sage/libs/ginac/decl.pxi.

It's possible to work around it, I think, with a patch like the attached, but I'm not at all convinced that this is the right way to fix it. If you think it's okay, feel free to review it, but since I'm not sure, I've labeled it as "not read for review".

Changed 10 years ago by jhpalmieri

comment:3 in reply to: ↑ 2 Changed 10 years ago by gmhossain

The rebased patch for the ticket

http://trac.sagemath.org/sage_trac/ticket/5711

will resolve this issue as an un-intended consequence.

Changed 10 years ago by burcin

new patch, apply only this one

comment:4 Changed 10 years ago by burcin

  • Cc ncalexan added
  • Component changed from misc to symbolics
  • Owner changed from cwitty to burcin
  • Status changed from new to assigned
  • Summary changed from [with patch, not ready for review] Typesetting of sec(x), csc(x), cot(x) are broken to [with patch, needs review] Typesetting of sec(x), csc(x), cot(x) are broken

attachment:trac_6268-py_print_latex.patch fixes the reported problem. Apply only this patch.

comment:5 Changed 10 years ago by ncalexan

  • Authors set to Burcin Erocal
  • Merged in set to 4.0.2.alpha0
  • Resolution set to fixed
  • Reviewers set to Nick Alexander
  • Status changed from assigned to closed
  • Summary changed from [with patch, needs review] Typesetting of sec(x), csc(x), cot(x) are broken to [with patch, positive review] Typesetting of sec(x), csc(x), cot(x) are broken

comment:6 Changed 10 years ago by burcin

  • Authors changed from Burcin Erocal to Burcin Erocal, John Palmieri

comment:7 Changed 10 years ago by burcin

  • Authors changed from Burcin Erocal, John Palmieri to John Palmieri
Note: See TracTickets for help on using tickets.