ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 17 Feb 2019 10:00:45 -0600Pretty print output in Jupyter notebookhttps://ask.sagemath.org/question/45481/pretty-print-output-in-jupyter-notebook/ <p>In order to provide meaningful results to my students in a Jupyter notebook, I would like to pretty print some output, including text, LaTeX and things computed by Sage. I have found that I could combine either <code>show</code> (or <code>pretty_print</code>) and <code>html</code>, or <code>show</code> and <code>LatexExpr</code>. For example,
either</p>
<pre><code>limit = r"\displaystyle\lim_{x\to0}\frac{\sin x}{x}="
value = lim(sin(x)/x, x=0)
show(html("Solucion: "+"${}={}$".format(limit,value)))
</code></pre>
<p>or, instead,</p>
<pre><code>limit = r"\displaystyle\lim_{x\to0}\frac{\sin x}{x}="
value = lim(sin(x)/x, x=0)
show("Solucion: ", LatexExpr(limit), value)
</code></pre>
<p>I would ask the following questions:</p>
<ol>
<li>Is there any reason to prefer one approach to the other?</li>
<li>If I replace <code>"Solucion"</code> by <code>"Solución"</code> (please note the accented <code>ó</code>), which is the correct way to write this Spanish word, in both approaches I get meaningless letters instead of the expected output. If I use <code>u"Solución"</code>, then Sage raises the error <code>'ascii' codec can't encode character u'\xf3' in position 6: ordinal not in range(128)</code>. Is there a way to use non-English characters?</li>
</ol>
I am using SageMath 8.5 on a MacBook Pro with macOS High Sierra. JuanjoSun, 17 Feb 2019 10:00:45 -0600https://ask.sagemath.org/question/45481/How do I display the full output that includes graphics?https://ask.sagemath.org/question/8034/how-do-i-display-the-full-output-that-includes-graphics/<h1>Background</h1>
I am working in the notebook GUI.
I have code that produces graphics (`.png` files) to display arrays with colors satisfying certain combinatorial criteria. When the output gets too long, `Sage` returns the message
WARNING: Output truncated!
full_output.txt
The `.txt` file contains some `html` code, but doesn't display in a web browser.
<h1>Question</h1>
How do I see my graphical arrays?
Sammy BlackWed, 30 Mar 2011 13:59:24 -0500https://ask.sagemath.org/question/8034/