On Jun 8, 7:37 pm, Dan Drake <dr...@kaist.edu> wrote:
> The latex() command does different things in the notebook and the
> command line.
>
> Command line:
>
>     sage: var('a, b, c')
>     (a, b, c)
>     sage: eqn = [a+b*c==1, b-a*c==0, a+b==5]
>     sage: s = solve(eqn, a,b ,c)
>     sage: latex(s[0])
>
>     \left[a  =  \frac{{(\left(25 I\right) \, \sqrt{79} + 25)}}{{(\left(6 
> I\right) \, \sqrt{79} - 34)}},
>     \\b  =  \frac{{(\left(5 I\right) \, \sqrt{79} + 5)}}{{(I \, \sqrt{79} + 
> 11)}},
>     \\c  =  \left(\frac{1}{10} I\right) \, \sqrt{79} + \frac{1}{10}\right]
>
> Notebook: if you execute this cell:
>
>     var('a, b, c')
>     eqn = [a+b*c==1, b-a*c==0, a+b==5]
>     s = solve(eqn, a,b ,c)
>     latex(s[0])
>
> you get
>
>     \begin{array}{l}[a  =  \frac{{(\left(25 I\right) \, \sqrt{79} +
>     25)}}{{(\left(6 I\right) \, \sqrt{79} - 34)}},\\
>     b  =  \frac{{(\left(5 I\right) \, \sqrt{79} + 5)}}{{(I \, \sqrt{79}
>     +
>     11)}},\\
>     c  =  \left(\frac{1}{10} I\right) \, \sqrt{79} +
>     \frac{1}{10}]\end{array}
>
> The source code to latex() doesn't seem like it makes a distinction
> between the notebook and command line. How does it figure out the
> difference, and why does it give me different answers?

The difference is in list_function in sage.misc.latex; this is the
function that tells Sage how to construct the latex string for a list,
and it does different things depending on whether in the notebook or
not (it says "if EMBEDDED_MODE:" ...).

The latex code there is actually sort of broken, and I didn't see a
good reason for the difference in behavior, besides which, it produces
some really ugly output: try checking the "Typeset" box in the
notebook and evaluating a cell containing 'range(50)'.  Once #6089 is
merged, the behaviors will be the same.

  John

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to