Ok, I've absorbed all of that. This morning it occured to me that it would be nice if one could define a class method called _html_. If present, it would try to render an htmlized (is that a word?) version of the class (just as __str__ renders a printable version or _latex_ renders a latex version). What do people think?
Victor On Jul 21, 2:27 pm, William Stein <wst...@gmail.com> wrote: > On Tue, Jul 21, 2009 at 10:34 AM, VictorMiller<victorsmil...@gmail.com> wrote: > > > William, Thanks. That works ok -- except, for example if I do > > > latex.eval('$N_0$',{}) > > > I get what I expect plus a line with two single quotes before what I > > wanted. This seems to happen with any latex string. Do you know > > what's happening? > > Try > > _ = latex.eval('$N_0$',{}) > > > > > > > Victor > > > On Jul 20, 6:58 pm, William Stein <wst...@gmail.com> wrote: > >> On Mon, Jul 20, 2009 at 3:30 PM, VictorMiller<victorsmil...@gmail.com> > >> wrote: > > >> > I have a program which calculates a table of values, and I'd like to > >> > display it nicely formatted. I've written a function to produce latex > >> > for it (using tabular), but I can't figure out how to get SAGE to > >> > display this in a notebook. I've tried the html command but that > >> > doesn't work. Here's a small example. I can put the following in a > >> > cell: > > >> > %latex > >> > \begin{tabular}{c|c} \hline A & B \\ \hline \hline 1 & 2 \\ \hline \end > >> > {tabular} > > >> > and it renders as I expect. however, if I put the above latex in a > >> > string and try html or view it just spits out the latex (minus the > >> > first two characters!). > > >> Try this: > > >> latex.eval(r""" > >> \begin{tabular}{c|c} \hline A & B \\ \hline \hline 1 & 2 \\ \hline \end > >> {tabular} > >> """,{}) > > >> In most cases, you can simulate any "%foo" environment in the notebook > >> by just typing foo.eval(<input string>, globals()). > > >> William > > >> > And incidentally, I can't figure out the following part of the latex > >> > documenation since something seems to be missing. Exactly what does > >> > the Latex function do? > > >> > class sage.misc.latex.Latex(debug=False, slide=False, density=150, > >> > pdflatex=None)¶ > > >> > Enter, e.g., > > >> > %latex > >> > The equation $y^2 = x^3 + x$ defines an elliptic curve. > >> > We have $2006 = \sage{factor(2006)}$. > > >> > in an input cell in the notebook to get a typeset version. Use > >> > %latex_debug to get debugging output. > > >> -- > >> William Stein > >> Associate Professor of Mathematics > >> University of Washingtonhttp://wstein.org > > -- > William Stein > Associate Professor of Mathematics > University of Washingtonhttp://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---