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 Washington
http://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to