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.Thu, 20 Feb 2020 06:40:07 -0600Can I make MathJax output centered in the notebook?https://ask.sagemath.org/question/50002/can-i-make-mathjax-output-centered-in-the-notebook/ My problem is the same one described here:
[Equations in notebook jump from centered to L aligned upon rendering](https://github.com/ipython/ipython/issues/7827)
and
[Centered equations become left aligned if displayed through the markdown display hook](https://github.com/ipython/ipython/issues/11159)
When I use @interact on something that outputs latex in the notebook, the constant jumping to the left is very annoying and distracting.
E.g.:
@interact
def myfunc(n = slider(1,10)):
P = matrix([[1,2,n], [2,2,3]])
show(P)
Is there any way I can control the MathJax rendering in the notebook? Can I perhaps set it to render in the center so I don't have to deal with the jumping?
ThankseodThu, 20 Feb 2020 06:40:07 -0600https://ask.sagemath.org/question/50002/Why doesn't show() render latex properly?https://ask.sagemath.org/question/49980/why-doesnt-show-render-latex-properly/The following code:
import numpy as np
P = np.matrix('0 0 20 20; 0 20 20 0')
show(P)
Gives me the output
[[𝟶𝟶𝟸𝟶𝟸𝟶]
[𝟶𝟸𝟶𝟸𝟶𝟶]]
In old sage, I guess around 6.0 or something, the show() command would render a proper latex matrix. I.e like you would see in a mathematics textbook.
Is there any way I can get this functionality back?
Thanks.
Edit: I'm using Sage 9.0 v 0.6.0 on Windows.eodWed, 19 Feb 2020 06:25:25 -0600https://ask.sagemath.org/question/49980/The function "view(" doesn't seem to work with jupyter notebookhttps://ask.sagemath.org/question/49209/the-function-view-doesnt-seem-to-work-with-jupyter-notebook/I'm sorry if the question was already answered somewhere, but I did not find out an answer by myself:
In the "old" sagemath notebooks, there was a function "view" to display latex that MathJax cannot display. For instance the sage documentation proposes the following:
from sage.graphs.graph_latex import setup_latex_preamble
setup_latex_preamble()
latex.engine('pdflatex')
latex.add_to_mathjax_avoid_list('tikzpicture')
view(graphs.CompleteGraph(4))
* In the "old" sage notebook, this produces a png version of a graph (compiled from latex), which is inserted into the output of the cell
* In the Jupyter netbook, by contrast, it opens a pdf version of the graph into an external window.
Is there some way to obtain, in the Jupyter notebook, the same behaviour as in the "old netbook" ?
ThanksSebastienThu, 26 Dec 2019 08:54:13 -0600https://ask.sagemath.org/question/49209/How can I obtain automatically latex output from Sage answers?https://ask.sagemath.org/question/33336/how-can-i-obtain-automatically-latex-output-from-sage-answers/ I've tried typeset_mode(true), but I'm getting things like \texttt{x**2} in opposite of $x^2$ compiled by latex.ErmsFri, 06 May 2016 17:09:41 -0500https://ask.sagemath.org/question/33336/How can I produce latex outputs from a sage answer?https://ask.sagemath.org/question/33335/how-can-i-produce-latex-outputs-from-a-sage-answer/ I've tried typeset_mode(true), but I'm getting things like \texttt{x**2} in opposite of x^2 compiled by latex.ErmsFri, 06 May 2016 16:56:55 -0500https://ask.sagemath.org/question/33335/MathJax indentation errorhttps://ask.sagemath.org/question/32115/mathjax-indentation-error/I am trying to display latex using python. However, whenever I add a dollar sign and \ I get a indentation error in my my q expression in my sage html interactive. What is the problem?
Here is my code:
x, y = var('x y')
html("<h1>Double Integrator</h1>")
@interact
def interplay(function=input_box(x*y),lower_x_bound=input_box(0),upper_x_bound=input_box(x),lower_y_bound=input_box(0),upper_y_bound=input_box(1),dydx=checkbox(default=False)):
try:
if dydx is False:
result = integral(integral(function, x, lower_x_bound, upper_x_bound),y, lower_y_bound, upper_y_bound)
print('hello');
pretty_print(html("hello"))
q = r"$\int {0}^{1}\int_{2}^{3} {4} \,dx\,dy = {5}$".format(lower_y_bound, upper_y_bound,lower_x_bound, upper_x_bound,function, result)
else:
result = integral(integral(function, x, lower_x_bound, upper_x_bound),y, lower_y_bound, upper_y_bound)
q = r"$ int {0}^{1} int_{2}^{3} {4} ,dx,dy = {5} $".format(lower_y_bound, upper_y_bound,lower_x_bound, upper_x_bound,function, result)
pretty_print(html("%s" % q))
except Exception as e :
print("Please enter better inputs")
print(e)
Here is my error
* BackslashOperator() * int {Integer(0)}**{Integer(1)} * BackslashOperator() * int_{Integer(2)}**{Integer(3)} {Integer(4)} * BackslashOperator() * ,dx * BackslashOperator() * ,dy = {Integer(5)}
IndentationError: unexpected indentcollabmathFri, 08 Jan 2016 23:48:35 -0600https://ask.sagemath.org/question/32115/Error in mathjax_sage.js. What's wrong with my configuration?https://ask.sagemath.org/question/11020/error-in-mathjax_sagejs-whats-wrong-with-my-configuration/I have installed Sage 6.1 on a brand new laptop running Ubuntu 12.04 LTS. When I fired up Sage and tried opening a worksheet in the notebook (Chrome/Firefox), the inline latex equations did not compile (they just appear as $...$) and the display equations appeared correctly, but in the color green. In the JS console I get the error:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:8080/javascript/dynamic/mathjax_sage.js
And here's the stack trace in Terminal:
Executing twistd --pidfile="sage_notebook.sagenb/sagenb.pid" -ny "sage_notebook.sagenb/twistedconf.tac"
/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
2014-02-10 19:07:46-0500 [-] Log opened.
2014-02-10 19:07:46-0500 [-] twistd 13.1.0 (/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/bin/python 2.7.5) starting up.
2014-02-10 19:07:46-0500 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2014-02-10 19:07:46-0500 [-] QuietSite starting on 8080
2014-02-10 19:07:46-0500 [-] Starting factory <__builtin__.QuietSite instance at 0x5ba97a0>
2014-02-10 19:07:50-0500 [-] WSGI application error
Traceback (most recent call last):
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/python/threadpool.py", line 212, in _worker
o = self.q.get()
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 83, in callWithContext
self.contexts.pop()
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/web/wsgi.py", line 340, in run
self.started = True
--- <exception caught here> ---
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/web/wsgi.py", line 315, in run
appIterator = self.application(self.environ, self.startResponse)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/sagenb-0.10.7.2-py2.7.egg/sagenb/flask_version/base.py", line 144, in mathjax_js
data = render_template('js/mathjax_sage.js', theme_mathjax_macros=mathjax_macros)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/templating.py", line 128, in render_template
context, ctx.app)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/templating.py", line 110, in _render
rv = template.render(context)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Jinja2-2.5.5-py2.7.egg/jinja2/environment.py", line 891, in render
return self.environment.handle_exception(exc_info, True)
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/sagenb-0.10.7.2-py2.7.egg/sagenb/data/sage/js/mathjax_sage.js", line 30, in top-level template code
{{ theme_mathjax_macros|join(',\n') }}
File "/home/corleymj/Programs/sage-6.1-x86_64-Linux/local/lib/python2.7/site-packages/Jinja2-2.5.5-py2.7.egg/jinja2/filters.py", line 241, in do_join
return unicode(d).join(imap(unicode, value))
exceptions.TypeError: 'function' object is not iterable
Anyone have any clue as to what could be wrong with my configuration? Perhaps some basic package I have yet to install? Thank you for any help!
corleymjMon, 10 Feb 2014 12:19:40 -0600https://ask.sagemath.org/question/11020/LaTeX renderinghttps://ask.sagemath.org/question/10275/latex-rendering/Hello people,
I may be doing something stupid, but I can't get any LaTeX markup in the notebook to be rendered by MathJax anymore... (while it works perfectly fine on other sites, like this one, with the same browsers).
I have the problem with Firefox 21 and Chromium 25, and there seems to be a complaint about a missing file:
localhost:8080/javascript/mathjax/dynamic/mathjax_sage.js
so I thought the problem was with my installation (5.9), but I tried both on 5.8 and a freshly installed 5.10 and it doesn't change a thing. I also tried deleting the .sage repertory of my user to see in case a config file was broken, but I didn't notice a difference.
Any clue ?spongegabTue, 25 Jun 2013 01:37:53 -0500https://ask.sagemath.org/question/10275/MathJax Font Sizes and Spacing/Positioning in Notebookhttps://ask.sagemath.org/question/10009/mathjax-font-sizes-and-spacingpositioning-in-notebook/I'd like to control the Latex fontsize in the notebook. In the first cell, I placed:
%html
<style>.MathJax {font-size: 200%;}</style>
... and in later cells' **view()** outputs the individual characters/symbols increase in size but the positioning/spacing gets all spread out and ugly.
What's the right/easy way to increase the latex fontsize in Sage's notebook and still have it look good?
rickhg12hsWed, 10 Apr 2013 18:41:01 -0500https://ask.sagemath.org/question/10009/