Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4499 closed defect (fixed)

[with patch, positive review] Fix latex for sech and csch

Reported by: mhansen Owned by: mhansen
Priority: minor Milestone: sage-3.2
Component: misc Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Currently, we have

sage: latex(sech)
\sech
sage: latex(csch)
\csch

Apparently \sech and \csch are not recognized in LaTeX. These should be

sage: latex(sech)
\text{sech}
sage: latex(csch)
\text{csch}

Attachments (1)

trac_4499.patch (1.8 KB) - added by mhansen 12 years ago.

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by mhansen

comment:1 Changed 12 years ago by mhansen

  • Owner changed from cwitty to mhansen
  • Status changed from new to assigned
  • Summary changed from Fix latex for sech and csch to [with patch, needs review] Fix latex for sech and csch

comment:2 Changed 12 years ago by mvngu

I'm using sage-3.1.4 here, so I can't say anything about applying this patch against the latest alpha release of sage-3.2. Perhaps other folks can review the patch using the latest alpha release. Before applying the patch trac_4499.patch against sage-3.1.4, we'd get these:

sage: # sech and arcsech
sage: sech._latex_()
'\\sech'
sage: asech._latex_()
'\\sech^{-1}'
sage: arcsech._latex_()
'\\sech^{-1}'
sage: latex(sech)
\sech
sage: latex(asech)
\sech^{-1}
sage: latex(arcsech)
\sech^{-1}
sage:
sage: # csch and arccsch
sage: csch._latex_()
'\\csch'
sage: acsch._latex_()
'\\csch^{-1}'
sage: arccsch._latex_()
'\\csch^{-1}'
sage: latex(csch)
\csch
sage: latex(acsch)
\csch^{-1}
sage: latex(arccsch)
\csch^{-1}

As far as I know, the returned LaTeX strings would cause tex-live to go berserk and complain about "Undefined control sequence" even if we compile with or without the macro \usepackage{amsmath,amssymb,amsthm} in the preamble of a .tex file.

After applying the patch against sage-3.1.4, we get these:

sage: # sech and arcsech
sage: sech._latex_()
'\\text{sech}'
sage: asech._latex_()
'\\text{sech}^{-1}'
sage: arcsech._latex_()
'\\text{sech}^{-1}'
sage: latex(sech)
\text{sech}
sage: latex(asech)
\text{sech}^{-1}
sage: latex(arcsech)
\text{sech}^{-1}
sage: 
sage: # csch and arccsch
sage: csch._latex_()
'\\text{csch}'
sage: acsch._latex_()
'\\text{csch}^{-1}'
sage: arccsch._latex_()
'\\text{csch}^{-1}'
sage: 
sage: latex(csch)
\text{csch}
sage: latex(acsch)
\text{csch}^{-1}
sage: latex(arccsch)
\text{csch}^{-1}

The returned LaTeX strings now look reasonable to me and work as expected when embedded within math mode and using the macro \usepackage{amsmath}.

comment:3 Changed 12 years ago by was

  • Summary changed from [with patch, needs review] Fix latex for sech and csch to [with patch, positive review] Fix latex for sech and csch

Looks good to me too.

comment:4 Changed 12 years ago by aginiewicz

From pure LaTeX typesetting point of view I would except operators to be consistent with standard operators, that's something like \mathop {\operator@font csch}\nolimits instead of \text{csch} , when paper/book is in last stages it might be useful to alter behaviour of \operator@font for example (that's used in all \sin, \cos, etc...) and then \text might be standing out, anyway the \text workaround seems to work if no style changes are applied

comment:5 Changed 12 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from assigned to closed

Merged in Sage 3.1.rc1

comment:6 Changed 12 years ago by mabshoff

This should be 3.2.rc1

Note: See TracTickets for help on using tickets.