latex rendering problems

31 views
Skip to first unread message

Andy Howell

unread,
Nov 22, 2017, 11:10:43 AM11/22/17
to sage-s...@googlegroups.com
I have two problems rendering latex. The first is in a plot title. The
fraction should be centered.

If I try the same latex:

\sum_{n=1}^{\infty}\frac{12}{(-5)^n}

at http://www.codecogs.com/latex/eqneditor.php

it renders as I expect.

The second problem is rendering latex for a table. I thought I could do
something like this:

t=text("$%s$" %latex(table(ls,header_row=('n','partial sum'))) ,(2,-1),

I have tried with and without the enclosing $, with it \$, \\$. It
always shows the unrendered latex.

I've tried this in 8.0 and 8.1rc2. Both in the notebook, and from the
command line. The code for the plot is is bellow.


def an(n):
return 12/(-5)^n

def sn(n):
return sum([an(n) for n in range(1,n+1)])

ls=[(n,RR(sn(n))) for n in range(1,11)]
la=[(n,RR(an(n))) for n in range(1,11)]
t=text("$%s$" %latex(table(ls,header_row=('n','partial sum'))) ,(2,-1),
color='black')
s=list_plot(ls, title="8.2-3 $\\sum_{n=1}^{\\infty}\\frac{12}{(-5)^n}$",
title_pos=(0.5,1.2))
a=list_plot(la)
show(t+s+a)

Thanks,

Andy
latex-render-problem.png
CodeCogsEqn.gif

mforets

unread,
Nov 22, 2017, 6:35:44 PM11/22/17
to sage-support
For the second problem, it renders with:

 t=text("%s" %LatexExpr(table(ls,header_row=('n','partial sum'))) ,(2,-1),color='black')
Reply all
Reply to author
Forward
0 new messages