ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 09 Feb 2020 04:13:29 +0100Render Latex in IPython notebook and display on output linehttps://ask.sagemath.org/question/31607/render-latex-in-ipython-notebook-and-display-on-output-line/So let's say I generate a Latex expression like so
def polar_gradient(f):
return (derivative(f, x), derivative(f, r), derivative(f,theta))
x, r, theta = var('x', 'r', 'theta')
f = r * sin(theta)
grad = polar_gradient(f)
expr=latex(grad)
Is there a way I can render expr and display it on the output line in an Ipython notebook?
Wed, 16 Dec 2015 19:11:42 +0100https://ask.sagemath.org/question/31607/render-latex-in-ipython-notebook-and-display-on-output-line/Answer by eric_g for <p>So let's say I generate a Latex expression like so</p>
<pre><code>def polar_gradient(f):
return (derivative(f, x), derivative(f, r), derivative(f,theta))
x, r, theta = var('x', 'r', 'theta')
f = r * sin(theta)
grad = polar_gradient(f)
expr=latex(grad)
</code></pre>
<p>Is there a way I can render expr and display it on the output line in an Ipython notebook?</p>
https://ask.sagemath.org/question/31607/render-latex-in-ipython-notebook-and-display-on-output-line/?answer=31613#post-id-31613In the Ipython notebook (now called Jupyter notebook), simply type
%display latex
grad
Note the % in front of display. After this command, all outputs will be displayed using LaTeX (MathJax rendering) (there is no need to type %display latex in subsequent cells).
Note also that you don't need to write expr=latex(grad). Wed, 16 Dec 2015 23:17:05 +0100https://ask.sagemath.org/question/31607/render-latex-in-ipython-notebook-and-display-on-output-line/?answer=31613#post-id-31613Comment by MaxGhenis for <p>In the Ipython notebook (now called Jupyter notebook), simply type</p>
<pre><code>%display latex
grad
</code></pre>
<p>Note the % in front of display. After this command, all outputs will be displayed using LaTeX (MathJax rendering) (there is no need to type %display latex in subsequent cells).
Note also that you don't need to write expr=latex(grad). </p>
https://ask.sagemath.org/question/31607/render-latex-in-ipython-notebook-and-display-on-output-line/?comment=49858#post-id-49858Seems like `%display` was deprecated? `UsageError: Line magic function `%display` not found.`Sun, 09 Feb 2020 04:13:29 +0100https://ask.sagemath.org/question/31607/render-latex-in-ipython-notebook-and-display-on-output-line/?comment=49858#post-id-49858