ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 26 Dec 2019 08:54:13 -0600The function "view(" doesn't seem to work with jupyter notebookhttp://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 -0600http://ask.sagemath.org/question/49209/Can't get typeset equations. No MathJax?http://ask.sagemath.org/question/38441/cant-get-typeset-equations-no-mathjax/ I installed Sage yesterday on Ubuntu. I downloaded the latest version from the website. When I enter formulas I just get an ASCII text. I thought that Sage was supposed to use MathJax to produce nice-looking typset formulas, but I see nothing of the sort. I have spent a lot of time searching for a solution and found nothing. I recompiled Sage, but that made no difference. The Sage distribution seems to include MathJax,
% cd path/to/sage
% find . -name mathjax
./local/share/mathjax
./local/share/jupyter/nbextensions/mathjax
./local/lib/python2.7/site-packages/sagenb/data/mathjax
./build/pkgs/mathjax
I have looked through the documentation and through the UI and found nothing. Can someone please tell me what I need to do to make Sage look decent? I don't know if it matters, but I want to use Maxima. But the problem appears with the plain Sage backend too.
Cheers,
Daniel.DanielCSat, 29 Jul 2017 14:25:37 -0500http://ask.sagemath.org/question/38441/output not showing on notebookhttp://ask.sagemath.org/question/33985/output-not-showing-on-notebook/I right clicked on output text and selected mathjax for rendering...
..since then the output is not showing.
Can anybody help? I cannot click on thee output again to select default html with javascript option, as the output is not showing. I looked everywhere to see if this option can be changed, but couldn't find it. flypThu, 30 Jun 2016 18:48:23 -0500http://ask.sagemath.org/question/33985/when typeset is checked on the notebook app, output is not showinghttp://ask.sagemath.org/question/33984/when-typeset-is-checked-on-the-notebook-app-output-is-not-showing/I did something that caused the sage notebook not show output, when the typeset is checked.
I right clicked on the output (while it was showing originally) and opted for Mathjax display. Since then, the output is not showing. Now I cannot figure out how to change my setting back to normal. Please help.
Hope I don't need to re install the software again.flypThu, 30 Jun 2016 18:03:24 -0500http://ask.sagemath.org/question/33984/How can I obtain automatically latex output from Sage answers?http://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 -0500http://ask.sagemath.org/question/33336/How can I produce latex outputs from a sage answer?http://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 -0500http://ask.sagemath.org/question/33335/How to produce results in latex font, in opposite of the typewriter font?http://ask.sagemath.org/question/33334/how-to-produce-results-in-latex-font-in-opposite-of-the-typewriter-font/ 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:54:58 -0500http://ask.sagemath.org/question/33334/MathJax indentation errorhttp://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 -0600http://ask.sagemath.org/question/32115/Jupyter doesn't use the built-in MathJaxhttp://ask.sagemath.org/question/31542/jupyter-doesnt-use-the-built-in-mathjax/I have two copies of MathJax. One in /usr/lib/sagemath/local/share/mathjax, another in /usr/share/javascript/mathjax.
I open up the jupyter notebook: `sage -n jupyter`. I open a notebook and what I get is
> Math/LaTeX rendering will be disabled.
>
> If you have administrative access to
> the notebook server and a working
> internet connection, you can install a
> local copy of MathJax for offline use
> with the following command on the
> server at a Python or Jupyter prompt:
>
> >>> from Jupyter.external import mathjax; mathjax.install_mathjax()
But I don't want a third (sic!) copy of MathJax on my computer! How can I make Jupyter use the existing ones?
I'm using Linux Mint 17.2, used the sagemath-upstream-binary package from the PPA.marmistrzSun, 13 Dec 2015 02:18:10 -0600http://ask.sagemath.org/question/31542/MathJax stopped workinghttp://ask.sagemath.org/question/31404/mathjax-stopped-working/I created a couple of commands and realized they produce no output. If typesetting is turned to false, then the output is produced. When I go to the print tab, I get the following error:
File failed to load: localhost:8080/javascript/mathjax/jax/output/SVG/config.js
Why did it suddenly stop working?
I'm using Linux Mint 17.2, used the sagemath-upstream-binary package from the PPA. I'm using the Sage notebook. My commands are
x = var('x')
w = x^4 - (1+3*i)*x^3 - (2-4*i)*x^2 + (6-2*i)*x - 4 - 4*i
p = x^4 + (1-3*i)*x^3 - (4+3*i)*x^2 - (4-2*i)*x + 2*i
solve(w,x)
I tried using Jupyter but I get the following error while creating a notebook in Jupyter:
Failed to retrieve MathJax from '../nbextensions/mathjax/MathJax.js'
although I have MathJax installed locally in /usr/share/javascript/mathjax and in /usr/lib/sagemath/local/share/mathjaxmarmistrzTue, 08 Dec 2015 02:00:37 -0600http://ask.sagemath.org/question/31404/jupyter (ipython notebook) kernel math displayhttp://ask.sagemath.org/question/30163/jupyter-ipython-notebook-kernel-math-display/I'm trying to set up sage as a [jupyter](https://jupyter.org/) (ipython notebook 4.0+) kernel on my local machine.
To do this, I have installed sage in /usr/local/sage, and set up a kernel using the SageKernelSpec tool (following instructions [here](http://doc.sagemath.org/html/en/reference/repl/sage/repl/ipython_kernel/install.html)).
My sage kernel.json looks like this:
> {"display_name": "Sage 6.9", "argv": ["/usr/local/sage/sage", "-python", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"]}
The kernel starts from within jupyter, and I am able to run sage. However, math text is not rendered. As an example:
x, y = var('x y')
show(x/y)
> \newcommand{\Bold}[1]{\mathbf{#1}}\frac{x}{y}
The problem seems to be that the notebook is not recognising and formatting mathjax input properly. I have tried manually linking the sage mathjax library to ipython using:
use_local_mathjax()
But it still does not work.
I *can* get a properly functioning sage notebook by entering:
sage -n ipython
in terminal, but when starting the notebook from my standard jupyter environment (i.e. choosing the kernel from the dropdown list), the mathtype is not rendered.
I can't work out what's going on... any pointers appreciated.
Thanks!oscarbransonTue, 20 Oct 2015 20:25:38 -0500http://ask.sagemath.org/question/30163/Error in mathjax_sage.js. What's wrong with my configuration?http://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 -0600http://ask.sagemath.org/question/11020/typeset large matrixhttp://ask.sagemath.org/question/10653/typeset-large-matrix/I've got a matrix. It is only 5×5 elements, but the entries themselves are pretty large polynomials. I'd like to see them in a typeset fashion, with scrolling instead of line breaks since line breaks break the visual structure. However, the notebook won't display the whole output but truncate it instead. And the `full_output.txt` won't get typeset.
I've [read in the sage-support archive](http://osdir.com/ml/sage-support/2009-10/msg01882.html) that at least 2009 the only way to increase the truncation limit requires rebuilding sage. Not a thing to look forward to. But perhaps things have changed, and there is a way to raise the limit without recompiling these days. Or there is a way to typeset `full_output.txt`. Or there is some fancy external matrix viewer to browse large data in a simple way. Or something to call `latex` from the notebook and open the resulting PDF in the browser. Anything like this?MvGThu, 24 Oct 2013 05:37:58 -0500http://ask.sagemath.org/question/10653/LaTeX renderinghttp://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 -0500http://ask.sagemath.org/question/10275/MathJax menu does not appear on right click on sage formulahttp://ask.sagemath.org/question/10191/mathjax-menu-does-not-appear-on-right-click-on-sage-formula/Hello everybody!
At one of old (<5.9) version of sage I can click with right button of mouse on formula in sage notebook and I can see mathjax menu.
You can get such menu by right-click on formula at http://www.mathjax.org/ page.
In sage 5.9 notebook I can't get such menu. What do I wrong? Help please. Thanks.
-----------------
**Upd**
In online sage notebook (for example test.sagenb.org) such menu works fine, but test.sagenb.org uses sage 5.4
AndreWinTue, 04 Jun 2013 07:51:50 -0500http://ask.sagemath.org/question/10191/MathJax Font Sizes and Spacing/Positioning in Notebookhttp://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 -0500http://ask.sagemath.org/question/10009/