Ask Your Question

# This HTML formats correctly in Sage, but not so in Sage Cloud

Hello,

I am trying to use this code in sage math cloud, but down where it says html(...), the lines f(x) = ... and p(x) = ... are on the same line, and I would like them on different lines.

var('x')
x0  = 0
f   = cos(x)
p   = plot(f,-10pi,10pi, thickness=2)
dot = point((x0,f(x=x0)),pointsize=80,rgbcolor=(1,0,0))
@interact
def _(order=(1..200)):
ft = f.taylor(x,x0,order)
pt = plot(ft,-10pi,10pi, color='green', thickness=2)
html('$f(x)\;=\;%s$'%latex(f))
html('$p(x)\;=\;%s$'%latex(ft))
show(dot + p + pt, ymin = -5, ymax = 5)


Ideas?

edit retag close merge delete

## Comments

Quick hack: put print ' ' after each of your html lines.

( 2014-12-03 01:58:26 +0100 )edit

## 1 Answer

Sort by » oldest newest most voted

You can add the <p> or <br> tags to the html command to get the spacing you want.

var('x')
x0  = 0
f   = cos(x)
p   = plot(f,-10*pi,10*pi, thickness=2)
dot = point((x0,f(x=x0)),pointsize=80,rgbcolor=(1,0,0))
@interact
def _(order=(1..200)):
ft = f.taylor(x,x0,order)
pt = plot(ft,-10*pi,10*pi, color='green', thickness=2)
html('$f(x)\;=\;%s$ <br>'%latex(f))
html('<p>$p(x)\;=\;%s$</p>'%latex(ft))
show(dot + p + pt, ymin = -5, ymax = 5)

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2014-12-03 01:43:46 +0100

Seen: 212 times

Last updated: Dec 03 '14