print LaTeX in notebook from script
I've read through
www.sagemath.org/doc/tutorial/latex.html
but still can't seem to find the equivalent to using "view" or "pretty-print" to display equations at LaTeX in a notebook cell when running a Python script from the notebook. (I do have "Typeset" checked at the start of the notebook.) For example, suppose my file foo.py has a function:
def show_all(self):
y = var('y')
x = 2.0*y**2
view(x)
pretty_print(x)
show(x)
JSMath()(x)
JSMath().eval(x)
print JSMath()(x)
print JSMath().eval(x)
html(JSMath()(x))
html(JSMath().eval(x))
print html(JSMath()(x))
print html(JSMath().eval(x))
Running this function from a notebook cell returns lines of the form either
\newcommand{\Bold}[1]{\mathbf{#1}}2.0 \, y^{2}
or
\newcommand{\Bold}[1]{\mathbf{#1}}2.0 \, y^{2}
</font></html>
But I just want a nice LaTeX display of 2y**2 equivalent to typing (from a notebook cell)
view(2.0*y**2)
which returns
2.00000000000000y2 (prettier than this of course)
So I'm still missing the right combination of LaTeX library functions. As a follow-up question, is dealing with LaTeX macros the only way to get the "2.00000000000" in the above to display as 2.0, 2.00, etc.?