Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#1897 closed defect (fixed)

[with patch, positive review] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix)

Reported by: was Owned by: mhansen
Priority: major Milestone: sage-3.3
Component: notebook Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

12:46 < ianxek> hi there
12:47 < ianxek> A Latex question in sage : if I define a variable say x=3 and later on use the
                %latex environment and use $\sage{x}$ then it says x is unknown
12:48 < ianxek> How do I tell sage to access the previously defined x ?
13:03 < sage> This is a bug in Sage!
13:03 < sage> However, here is a workaround until it gets fixed.
13:03 < sage> ianxek.
13:03 < sage> latex.eval('$2+\sage{a}$', locals=globals())
13:03 < sage> I.e., instead of typing %latex in the cell, do 
13:04 < sage> latex.eval("A latex string", locals=globals())
13:04 < sage> And you'll see the variables properly.
13:04 < sage> Thanks for asking this question.

I think the problem involves system.eval not getting passed the globals() dictionary correctly...

Attachments (1)

trac_1897.patch (1.4 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 boothby to mhansen
  • Status changed from new to assigned
  • Summary changed from %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix) to [with patch, needs review] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix)

The problem was caused by syseval in sage.server.support needing the second positional argument to be an argument for global variables.

comment:2 Changed 12 years ago by TimothyClemans

  • Summary changed from [with patch, needs review] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix) to [with patch, needs work] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix)

With %latex in notebook I'm getting

An error occured.
Error latexing slide.

comment:3 Changed 12 years ago by jason

  • Summary changed from [with patch, needs work] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix) to [with patch, positive work] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix)

This fixes the problem for me. TimothyClemans?, you need a bunch of things for this to work, like dvipng, etc. Can you latex any slides at all?

comment:4 Changed 12 years ago by jason

  • Summary changed from [with patch, positive work] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix) to [with patch, positive review] %latex -- bug in passing in predefined sage variables (serious but probably very easy to fix)

comment:5 Changed 12 years ago by mabshoff

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

Merged in Sage 3.3.alpha1

Cheers,

Michael

comment:6 Changed 12 years ago by mabshoff

  • Milestone changed from sage-3.4.1 to sage-3.3
Note: See TracTickets for help on using tickets.