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/Redirecting the output of show() to a file?https://ask.sagemath.org/question/34675/redirecting-the-output-of-show-to-a-file/Consider the tree
t = Permutation([1, 3, 2, 6, 8, 9, 5, 7, 4]).increasing_tree().as_ordered_tree()
show(t)
The output is a TeX-tikzpicture. I want to post-process this
picture at the TeX level (for a motivation see my last question).
To do so I have to manually copy and paste the output in some
editor. It would be much easier if I could redirect the output
into a text file and proceed from this file.
Is it possible to do so?Peter LuschnyThu, 01 Sep 2016 03:47:53 -0500https://ask.sagemath.org/question/34675/Missing close bracehttps://ask.sagemath.org/question/25130/missing-close-brace/hi!
Im getting "Missing close brace" when I try to prettyprint an expression on sage cloud.
the expression Im trying to prettyprint using show() is the result of using solve() on an equation system and saving it in the variable "a", I can see the contents of "a" but I can't prettyprint it.
![image description](http://s21.postimg.org/t1hmpsdj9/AAAAAAA.jpg)
thanks!
EDIT:
show (a[0]) works great for showing the first element, but I still cant get the whole thing to show.
here is the code that produces the error
- f=4*(x^3-x/4)^3+4*x-4*(x^3-x/4)
- solve (f==0,x)
- show (solve (f==0,x))
here is a pic
![image description](http://s13.postimg.org/nsvspkjd1/AAAAAAA.jpg)martovThu, 04 Dec 2014 15:56:05 -0600https://ask.sagemath.org/question/25130/