#17559: load_session loses variable's latex_name
------------------------+----------------------------
   Reporter:  wonder    |            Owner:
       Type:  defect    |           Status:  new
   Priority:  major     |        Milestone:  sage-6.5
  Component:  pickling  |         Keywords:
  Merged in:            |          Authors:
  Reviewers:            |  Report Upstream:  N/A
Work issues:            |           Branch:
     Commit:            |     Dependencies:
   Stopgaps:            |
------------------------+----------------------------
 Saving and loading variables apparently doesn't reload the `latex_name`
 attribute:

 {{{
 ┌────────────────────────────────────────────────────────────────────┐
 │ Sage Version 6.4.1, Release Date: 2014-11-23                       │
 │ Type "notebook()" for the browser-based notebook interface.        │
 │ Type "help()" for help.                                            │
 └────────────────────────────────────────────────────────────────────┘
 sage: xhat = SR.symbol( 'xhat', latex_name='\hat{x}' )
 sage: latex(xhat)
 \hat{x}
 sage: save_session( 'xhat' )
 sage: l = load( 'xhat.sobj' )
 sage: latex( l['xhat'] )
 \hat{x}
 sage:
 Exiting Sage (CPU time 0m0.20s, Wall time 2m49.25s).
 }}}

 {{{
 ┌────────────────────────────────────────────────────────────────────┐
 │ Sage Version 6.4.1, Release Date: 2014-11-23                       │
 │ Type "notebook()" for the browser-based notebook interface.        │
 │ Type "help()" for help.                                            │
 └────────────────────────────────────────────────────────────────────┘
 sage: l = load( 'xhat.sobj' )
 sage: latex( l['xhat'] )
 \mathit{xhat}
 }}}

 It looks as if it tries to keep these objects unique, and `load()` will
 leave an existing variable's `latex_name` in place, but won't set it when
 creating a variable.

 I can see arguments for and against considering `SR.symbol('x',
 latex_name='y')` a different variable from `SR.symbol('x')`.  It seems
 reasonable to consider them the same, in which case the latex name should
 be discarded if there's already a variable of the same name.  But it
 should use the saved latex name when loading a variable that isn't already
 defined.

 Seems possibly related: #5466

--
Ticket URL: <http://trac.sagemath.org/ticket/17559>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to