#7051: latex issues
------------------------+---------------------------------------------------
 Reporter:  jhpalmieri  |       Owner:  jhpalmieri
     Type:  defect      |      Status:  new       
 Priority:  minor       |   Milestone:  sage-4.1.3
Component:  misc        |    Keywords:            
 Reviewer:              |      Author:            
   Merged:              |  
------------------------+---------------------------------------------------
 Here are several LaTeX issues:

  - because of how Python works (I think), if you set {{{T =
 type(identity_matrix(3))}}}, then T has all of the methods of an identity
 matrix.  In particular, if you run {{{latex(T)}}}, the code calls
 {{{hasattr(T, '_latex_')}}}, and this returns True because
 {{{hasattr(identity_matrix(3), '_latex_')}}} is True.  But then
 {{{T._latex_()}}} produces a {{{TypeError}}}.  This is the cause of the
 error reported [http://groups.google.com/group/sage-
 support/browse_frm/thread/498eb1dae179fc3f here].

 Solution: catch {{{TypeError}}}s when calling {{{T._latex_()}}} in this
 sort of situation.

  - In the notebook, try
 {{{
 %latex
 $\sage{type(35)}$
 }}}
 In this case, Sage typesets the string {{{<type
 'sage.rings.integer.Integer'>}}}, but the < and > signs get converted into
 an upside-down exclamation point and question mark.

 Solution: typeset strings differently, using {{{\textttt}}} instead of
 {{{\text}}}.

  - Click the "Typeset" button and try
 {{{
 type(35)
 }}}
 In this case, jsMath kicks in and tries to typeset {{{\text{<type
 'sage.rings.integer.Integer'>}}}}, but the symbols < and > confuse jsMath
 -- it thinks they're part of an html command.  As a result, there is *no*
 output at all.

 Solution: for typesetting strings in jsMath, replace {{{\texttt}}} with
 {{{\hbox}}}.

  - This comes from a Sage doctest:
 {{{
 sage: R.<x,y>=QQbar[]
 sage: latex(-x^2-y+1)
 -x^{2} - y + \text{1}
 }}}
 The {{{\text{1}}}} should not be there.

 Solution: The {{{\text{1}}}}  appears because the element 1 in R has no
 {{{_latex_}}} method, so it gets converted to a string, when then gets
 typeset by enclosing it in {{{\text}}}.  So test strings: if they consist
 only of digits, just return the string.  If it contains anything else,
 enclose in {{{\textttt}}}, as mentioned above.

 A patch will follow soon.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7051>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to