Sage: Ticket #9774: Use MathJax instead of jsMath
https://trac.sagemath.org/ticket/9774
<p>
<a class="ext-link" href="http://www.mathjax.org/"><span class="icon"></span>MathJax</a> is the successor to <a class="ext-link" href="http://www.math.union.edu/~dpvc/jsMath/"><span class="icon"></span>jsMath</a>.
</p>
<p>
<strong>apply</strong>:
</p>
<ul><li><a class="attachment" href="https://trac.sagemath.org/attachment/ticket/9774/trac_9774-scripts-mathjax.patch" title="Attachment 'trac_9774-scripts-mathjax.patch' in Ticket #9774">trac_9774-scripts-mathjax.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/9774/trac_9774-scripts-mathjax.patch" title="Download"></a> to the scripts repository
</li><li><a class="attachment" href="https://trac.sagemath.org/attachment/ticket/9774/trac_9774-mathjax-try7.patch" title="Attachment 'trac_9774-mathjax-try7.patch' in Ticket #9774">trac_9774-mathjax-try7.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/9774/trac_9774-mathjax-try7.patch" title="Download"></a> to the sage library repository
</li></ul><p>
Also install the new notebook from <a class="closed ticket" href="https://trac.sagemath.org/ticket/13121" title="enhancement: Upgrade sagenb to 0.10.x (closed: fixed)">#13121</a>
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/9774
Trac 1.1.6rbeezerSun, 22 Aug 2010 08:18:39 GMTcc set
https://trac.sagemath.org/ticket/9774#comment:1
https://trac.sagemath.org/ticket/9774#comment:1
<ul>
<li><strong>cc</strong>
<em>rbeezer</em> added
</li>
</ul>
TicketrbeezerTue, 24 Aug 2010 18:52:40 GMTcc changed
https://trac.sagemath.org/ticket/9774#comment:2
https://trac.sagemath.org/ticket/9774#comment:2
<ul>
<li><strong>cc</strong>
<em>robert.marik</em> added
</li>
</ul>
<p>
I've been experimenting a bit with <code>MathJax</code>, outside of the notebook. Mostly thinking about how it will handle tex4ht output in jsMath mode, but here are some some observations that might be useful:
</p>
<ol><li> Easier in most ways to structure a page to use <code>MathJax</code>. Just insert something like
</li></ol><pre class="wiki"><script type="text/javascript" src="path-to-MathJax/MathJax.js"></script>
</pre><p>
No need for a "process()" call at the end, etc.
</p>
<ol start="2"><li> Default is to not recognize single dollar-signs as delimiters. Alternative is <code>\(..\)</code>. This would be a good thing, since if a user adds text (via TinyMCE) right now jsMath tries to parse the following as math. <code>$$..$$</code> and <code>\[..\]</code> both work for display math. We would break lots of old worksheets if we stopped recognizing <code>$..$</code>.
</li></ol><ol start="3"><li> There is a jsMath compatibility mode. I believe I've found one bug in this already (reported upstream). I'd imagine this is not a development priority, but who knows?
</li></ol><ol start="4"><li> Modes and configuration is controlled globally by <code>config/MathJax.js</code> which is just one huge well-commented Javascript object. It can be overridden in a web page by adding a new version into the script block mentioned above. Maybe we want to make this easy for users to access, or maybe it is easy already, or maybe we don't want to bother.
</li></ol><ol start="5"><li> This looks to me like the best introduction to the types of decisions we will want to make about what to cut over to:
</li></ol><p>
<a class="ext-link" href="http://www.mathjax.org/resources/docs/?configuration.html"><span class="icon"></span>http://www.mathjax.org/resources/docs/?configuration.html</a>
</p>
<ol start="6"><li> <code>MathJax</code> is HUGE. Fonts for lots of Unicode points, I guess. SVN checkout is 53 MB, after unzipping fonts.zip it all occupies 171 MB.
</li></ol><ol start="7"><li> I just noticed this morning that <code>html.table()</code> uses <code>class="math"</code> which is a jsMath way to tag span's or div's for processing. I haven't found how to do something similiar in <code>MathJax</code>, though this will work in jsMath compatibility mode. A very small test would indicate that the two modes can be used at the same time.
</li></ol><ol start="8"><li> Consonant with (2) and (7), I'd love to see the notebook formatting move to something closer to rigorous XML (ie XHTML, I guess). Certain types of processing would be easier if we did, but that is not really what this ticket is all about.
</li></ol>
Ticketrobert.marikTue, 24 Aug 2010 19:57:06 GMT
https://trac.sagemath.org/ticket/9774#comment:3
https://trac.sagemath.org/ticket/9774#comment:3
<p>
Thanks for comment, I feel that <a class="missing wiki">MathJax?</a> is much slower on cheap/older computer. This could be an important issue for using Sage in highschools and universities. Is it possible to keep both <a class="missing wiki">MathJax?</a> and jsMath and let the notebook admin to choose, which one will be used?
</p>
TicketjasonWed, 25 Aug 2010 22:34:11 GMT
https://trac.sagemath.org/ticket/9774#comment:4
https://trac.sagemath.org/ticket/9774#comment:4
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:2" title="Comment 2">rbeezer</a>:
</p>
<blockquote class="citation">
<ol start="6"><li> <code>MathJax</code> is HUGE. Fonts for lots of Unicode points, I guess. SVN checkout is 53 MB, after unzipping fonts.zip it all occupies 171 MB.
</li></ol></blockquote>
<p>
I think <a class="missing wiki">MathJax?</a> includes the equivalent of our jsmath-image-fonts spkg. If we added <a class="missing wiki">MathJax?</a> to Sage, it might be good to strip out the image fonts and distribute them separately as a mathjax-image-fonts spkg (mathjax faq tells how to do this, I believe). Somewhere I have a half-finished prototype of this solution.
</p>
TicketjhpalmieriThu, 26 Aug 2010 00:18:26 GMTcc changed
https://trac.sagemath.org/ticket/9774#comment:5
https://trac.sagemath.org/ticket/9774#comment:5
<ul>
<li><strong>cc</strong>
<em>jhpalmieri</em> added
</li>
</ul>
TicketjasonFri, 15 Oct 2010 01:23:29 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:6
https://trac.sagemath.org/ticket/9774#comment:6
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=6">diff</a>)
</li>
</ul>
TicketjasonFri, 15 Oct 2010 01:50:08 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:7
https://trac.sagemath.org/ticket/9774#comment:7
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=7">diff</a>)
</li>
</ul>
TicketjasonFri, 15 Oct 2010 01:50:18 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:8
https://trac.sagemath.org/ticket/9774#comment:8
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_work</em>
</li>
</ul>
TicketjasonFri, 15 Oct 2010 01:50:37 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:9
https://trac.sagemath.org/ticket/9774#comment:9
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=9">diff</a>)
</li>
</ul>
TicketrminerThu, 21 Oct 2010 20:21:34 GMT
https://trac.sagemath.org/ticket/9774#comment:10
https://trac.sagemath.org/ticket/9774#comment:10
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:4" title="Comment 4">jason</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:2" title="Comment 2">rbeezer</a>:
</p>
<blockquote class="citation">
<ol start="6"><li> <code>MathJax</code> is HUGE. Fonts for lots of Unicode points, I guess. SVN checkout is 53 MB, after unzipping fonts.zip it all occupies 171 MB.
</li></ol></blockquote>
<p>
I think <a class="missing wiki">MathJax?</a> includes the equivalent of our jsmath-image-fonts spkg. If we added <a class="missing wiki">MathJax?</a> to Sage, it might be good to strip out the image fonts and distribute them separately as a mathjax-image-fonts spkg (mathjax faq tells how to do this, I believe). Somewhere I have a half-finished prototype of this solution.
</p>
</blockquote>
<p>
Just in case you haven't thought of this, what Gollum (the <a class="wiki" href="https://trac.sagemath.org/wiki/GitHub">GitHub</a> forum) folks did was host the <a class="missing wiki">MathJax?</a> fonts on Amazon S3, and then not include them in their distribution. I don't know if that would work for you, but I wanted to point it out.
</p>
TicketjasonThu, 21 Oct 2010 20:44:55 GMT
https://trac.sagemath.org/ticket/9774#comment:11
https://trac.sagemath.org/ticket/9774#comment:11
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:10" title="Comment 10">rminer</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:4" title="Comment 4">jason</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:2" title="Comment 2">rbeezer</a>:
</p>
<blockquote class="citation">
<ol start="6"><li> <code>MathJax</code> is HUGE. Fonts for lots of Unicode points, I guess. SVN checkout is 53 MB, after unzipping fonts.zip it all occupies 171 MB.
</li></ol></blockquote>
<p>
I think <a class="missing wiki">MathJax?</a> includes the equivalent of our jsmath-image-fonts spkg. If we added <a class="missing wiki">MathJax?</a> to Sage, it might be good to strip out the image fonts and distribute them separately as a mathjax-image-fonts spkg (mathjax faq tells how to do this, I believe). Somewhere I have a half-finished prototype of this solution.
</p>
</blockquote>
<p>
Just in case you haven't thought of this, what Gollum (the <a class="wiki" href="https://trac.sagemath.org/wiki/GitHub">GitHub</a> forum) folks did was host the <a class="missing wiki">MathJax?</a> fonts on Amazon S3, and then not include them in their distribution. I don't know if that would work for you, but I wanted to point it out.
</p>
</blockquote>
<p>
That's a very interesting solution. I suppose we could host them on the main sage webserver, for example. Or maybe Google Code or something like that so we had redundant sources.
</p>
TicketjhpalmieriWed, 10 Nov 2010 22:11:11 GMT
https://trac.sagemath.org/ticket/9774#comment:12
https://trac.sagemath.org/ticket/9774#comment:12
<p>
I just found the web page <a class="ext-link" href="http://bitbucket.org/kevindunn/sphinx-extension-mathjax/wiki/Home"><span class="icon"></span>http://bitbucket.org/kevindunn/sphinx-extension-mathjax/wiki/Home</a>, which allows the use of Sphinx with MathJax. Assuming it works, we could upgrade all of Sage (not just the notebook but also the docs), to use MathJax instead of jsMath.
</p>
TicketdrkirkbyWed, 02 Mar 2011 20:26:53 GMT
https://trac.sagemath.org/ticket/9774#comment:13
https://trac.sagemath.org/ticket/9774#comment:13
<p>
<a class="ext-link" href="http://www.mathjax.org/"><span class="icon"></span>MathJax</a> is very impressive looking. I like the idea the user does not have to have any fonts installed on his computer, which is a major advantage over <a class="ext-link" href="http://www.math.union.edu/~dpvc/jsMath/"><span class="icon"></span>jsMath</a>
</p>
<p>
Dave
</p>
TicketrbeezerTue, 22 Mar 2011 22:49:12 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>mathjax-double-integral-20110322.png</em>
</li>
</ul>
<p>
Screenshot of double integral
</p>
TicketrbeezerTue, 22 Mar 2011 22:49:31 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>mathjax-matrix-20110322.png</em>
</li>
</ul>
<p>
Screenshot of matrix
</p>
TicketrbeezerTue, 22 Mar 2011 22:53:38 GMTcc changed
https://trac.sagemath.org/ticket/9774#comment:14
https://trac.sagemath.org/ticket/9774#comment:14
<ul>
<li><strong>cc</strong>
<em>rkirov</em> added
</li>
</ul>
<p>
Steps that will install <code>MathJax</code> with the new Flask notebook.
</p>
<ol><li>Install the Flask version of the notebook.
<pre class="wiki">http://code.google.com/r/rkirov-flask/
</pre></li></ol><ol start="2"><li>Download v1.1 of <code>MathJax</code> as zip file (from bottom of page).
<pre class="wiki">http://www.mathjax.org/download/
</pre></li></ol><ol start="3"><li> Unzip the <a class="missing wiki">MathJax?</a> distribution into<br />
$SAGE_ROOT/devel/sagenb/sagenb/data<br />
and<br />
rename the new directory: <code>mathjax-MathJax-5a7e4d7</code> (or whatever)<br />
to be just the directory: <code>MathJax</code>
</li></ol><ol start="4"><li> jsmath compatibility. Edit
<pre class="wiki">$SAGE_ROOT/devel/sagenb/sagenb/data/MathJax/config/default.js
</pre>by adding "<code>jsMath2jax.js</code>" as the first entry of the "extensions" list, so it becomes
<pre class="wiki">extensions: ["jsMath2jax.js", "tex2jax.js"]
</pre></li></ol><ol start="5"><li>Edit
<pre class="wiki">$SAGE_ROOT/devel/sagenb/sagenb/data/sage/html/notebook/base.html
</pre>and change
<pre class="wiki"><script type="text/javascript" src="/javascript/sage/jsmath.js"></script>
</pre>to
<pre class="wiki"><script type="text/javascript" src="/static/MathJax/MathJax.js?config=default"></script>
</pre></li></ol><p>
This will install <code>MathJax</code> and the notebook will use it. But the setup is buggy, so needs work. I'm sure there is some configuration on the Sage side and/or the <code>MathJax</code> side that will need changes.
</p>
<ul><li>A mix of black and green symbols.
</li></ul><ul><li>Only renders on a reload - adding new TeX via TinyMCE returns with an error about not finding fonts.
</li></ul><ul><li>Some stray tags are being rendered, or something.
</li></ul><p>
Screenshots attached:
</p>
<p>
Double Integral:<br />
<a class="ext-link" href="http://wiki.math.toronto.edu/TorontoMathWiki/index.php/JsMath/MathJax_%28TeX_for_Web%29"><span class="icon"></span>http://wiki.math.toronto.edu/TorontoMathWiki/index.php/JsMath/MathJax_%28TeX_for_Web%29</a>
</p>
<pre class="wiki">$$ (2\pi h)^{-d}\iint_{\{H(x,\xi) <\tau\}} dx d\xi $$
</pre><p>
Matrix:
</p>
<pre class="wiki">$\begin{bmatrix}
x^2 & y^2\\
x^3 & \cos(z)
\end{bmatrix}$
</pre>
TicketkcrismanThu, 24 Mar 2011 01:49:34 GMTcc changed
https://trac.sagemath.org/ticket/9774#comment:15
https://trac.sagemath.org/ticket/9774#comment:15
<ul>
<li><strong>cc</strong>
<em>kcrisman</em> added
</li>
</ul>
TicketjhpalmieriTue, 14 Jun 2011 22:04:56 GMT
https://trac.sagemath.org/ticket/9774#comment:16
https://trac.sagemath.org/ticket/9774#comment:16
<p>
I'm attaching a draft of a patch for the Sage library. The integration with Sphinx is completely untested, and is probably broken. See the top of the patch file for a list of things to do.
</p>
TicketrbeezerThu, 16 Jun 2011 03:25:09 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-flask-notebook.patch</em>
</li>
</ul>
TicketrbeezerThu, 16 Jun 2011 03:35:12 GMT
https://trac.sagemath.org/ticket/9774#comment:17
https://trac.sagemath.org/ticket/9774#comment:17
<p>
Added patch to Flask notebook code to support <code>MathJax</code>, built with Davide Cervone's help.
</p>
<ol><li> This is a hand-edited patch to recover from an hg mess-up. I think it is OK, but be wary.
</li><li> Fonts are coming from <code>MathJax</code> CDN. Comment in code indicates change for local <code>MathJax</code> installation.
</li><li> <code><script></code> tags added by Palmieri's Sage library patch need to be handled with care on notebook side, so notebook does not evaluate them. Right now when "Typeset" box is checked, evaluated cells raise a Javascript error in <code>evaluate_script_tags</code> (or a function with a similar name).
</li></ol>
TicketjasonThu, 16 Jun 2011 04:15:42 GMT
https://trac.sagemath.org/ticket/9774#comment:18
https://trac.sagemath.org/ticket/9774#comment:18
<p>
John's patch doesn't apply cleanly to stock 4.7; does it apply to the most recent alpha of 4.7.1?
</p>
<pre class="wiki">applying mathjax.patch
patching file sage/misc/latex.py
Hunk #15 succeeded at 1750 with fuzz 2 (offset 2 lines).
Hunk #23 FAILED at 2382
1 out of 25 hunks FAILED -- saving rejects to file sage/misc/latex.py.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh mathjax.patch
</pre>
TicketrbeezerThu, 16 Jun 2011 05:18:07 GMT
https://trac.sagemath.org/ticket/9774#comment:19
https://trac.sagemath.org/ticket/9774#comment:19
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:18" title="Comment 18">jason</a>:
</p>
<blockquote class="citation">
<p>
John's patch doesn't apply cleanly to stock 4.7; does it apply to the most recent alpha of 4.7.1?
</p>
</blockquote>
<p>
Yes.
</p>
<pre class="wiki">rob@tiger:/sage/dev/devel/sage$ ../../sage -version
| Sage Version 4.7.1.alpha2, Release Date: 2011-06-07 |
* Warning: this is a prerelease version, and it may be unstable. *
rob@tiger:/sage/dev/devel/sage$ hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/9774/mathjax.patch
adding mathjax.patch to series file
applying mathjax.patch
now at: mathjax.patch
</pre>
TicketjasonThu, 16 Jun 2011 05:29:12 GMT
https://trac.sagemath.org/ticket/9774#comment:20
https://trac.sagemath.org/ticket/9774#comment:20
<p>
Don't we need the actual <a class="missing wiki">MathJax?</a> spkg or files somewhere? Rob: do you have instructions for putting these in the directory, or do we use my half-finished patch mentioned in the description, or something else?
</p>
TicketrbeezerThu, 16 Jun 2011 05:30:09 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-flask-notebook-file-add.patch</em>
</li>
</ul>
TicketrbeezerThu, 16 Jun 2011 05:33:20 GMT
https://trac.sagemath.org/ticket/9774#comment:21
https://trac.sagemath.org/ticket/9774#comment:21
<p>
Attached a patch to add <code>sagenb/notebook/mathjax.py</code>
</p>
<p>
New file is similar to, but not identical to, <code>sagenb/notebook/jsmath.py</code>
</p>
<p>
We did not delete the latter, but I think it can safely go away.
</p>
TicketrbeezerThu, 16 Jun 2011 05:35:52 GMT
https://trac.sagemath.org/ticket/9774#comment:22
https://trac.sagemath.org/ticket/9774#comment:22
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:20" title="Comment 20">jason</a>:
</p>
<blockquote class="citation">
<p>
Don't we need the actual <a class="missing wiki">MathJax?</a> spkg or files somewhere? Rob: do you have instructions for putting these in the directory, or do we use my half-finished patch mentioned in the description, or something else?
</p>
</blockquote>
<p>
We need an spkg to be Internet-independent.
</p>
<p>
We did not experiment with your old one. I think it would be best to make a new one. This requires a small edit (once you are sure all works with CDN version).
</p>
<p>
Font suggestions coming up.
</p>
TicketrbeezerThu, 16 Jun 2011 05:45:04 GMT
https://trac.sagemath.org/ticket/9774#comment:23
https://trac.sagemath.org/ticket/9774#comment:23
<p>
Davide Cervone says for an spkg we need only keep font subdirectories called
</p>
<pre class="wiki">otf, eot, svg
</pre><p>
In particular <code>png</code> subdirectories are huge-est and can go away.
</p>
<p>
Rob
</p>
TicketjasonThu, 16 Jun 2011 05:50:21 GMT
https://trac.sagemath.org/ticket/9774#comment:24
https://trac.sagemath.org/ticket/9774#comment:24
<p>
ah; I bet it's because the svg fonts replace the png fonts for all browsers we care about, or something. Okay, Davide is the final authority on what browsers support what...
</p>
TicketjasonThu, 16 Jun 2011 06:01:09 GMT
https://trac.sagemath.org/ticket/9774#comment:25
https://trac.sagemath.org/ticket/9774#comment:25
<p>
I get an error from the line: <code>response = make_response(render_template('js/mathjax.js', theme_mathjax_macros=mathjax_macros))</code> in flask_version/base.py. I see a jsmath.js template in <code>sagenb/data/sage/js/jsmath.js</code> template. Is this another file that didn't get added to the patch?
</p>
TicketrbeezerThu, 16 Jun 2011 06:33:03 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-flask-notebook-file-add-two.patch</em>
</li>
</ul>
TicketrbeezerThu, 16 Jun 2011 06:35:33 GMT
https://trac.sagemath.org/ticket/9774#comment:26
https://trac.sagemath.org/ticket/9774#comment:26
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:25" title="Comment 25">jason</a>:
</p>
<blockquote class="citation">
<p>
Is this another file that didn't get added to the patch?
</p>
</blockquote>
<p>
Yes, same situation - "old" file could be removed.
</p>
<p>
"file-add-two" should create the missing file. Sorry about all the problems - my <code>hg status</code> is useless with the hg mess-up.
</p>
<p>
This file will require an edit when we move from CDN to spkg.
</p>
<p>
Thank-you!!!!!!!!!!!!!!
</p>
TicketjasonThu, 16 Jun 2011 09:07:31 GMT
https://trac.sagemath.org/ticket/9774#comment:27
https://trac.sagemath.org/ticket/9774#comment:27
<p>
I have a working version, but there still seems to be something slightly different about Typeset mode compared to before. I'm posting my patch, but there is still *lots* of debugging stuff in the patch that should be taken out before a final version is posted.
</p>
TicketjasonThu, 16 Jun 2011 09:08:09 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-flask-eval-script.patch</em>
</li>
</ul>
<p>
apply to sagenb repository; apply on top of previous patches
</p>
TicketrbeezerFri, 17 Jun 2011 17:37:44 GMT
https://trac.sagemath.org/ticket/9774#comment:28
https://trac.sagemath.org/ticket/9774#comment:28
<p>
The problem with the Sage notebook code intercepting (and evaluating) the contents of <code><script>,</script></code> tags can probably be rectified in one, or both, of the functions of the Flask notebook:
</p>
<pre class="wiki">In sagenb/data/sage/js/notebook_lib.js:
eval_script_tags
separate_script_tags
</pre>
TicketjasonFri, 17 Jun 2011 19:38:39 GMT
https://trac.sagemath.org/ticket/9774#comment:29
https://trac.sagemath.org/ticket/9774#comment:29
<p>
rbeezer: yes, that's what my patch does. The current remaining problem is something different.
</p>
TicketjhpalmieriMon, 20 Jun 2011 18:55:07 GMT
https://trac.sagemath.org/ticket/9774#comment:30
https://trac.sagemath.org/ticket/9774#comment:30
<p>
In the current version of <a class="attachment" href="https://trac.sagemath.org/attachment/ticket/9774/mathjax.patch" title="Attachment 'mathjax.patch' in Ticket #9774">mathjax.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/9774/mathjax.patch" title="Download"></a>, look at the top of the file for some unfinished business. For example, the pathname at the end of doc/common/themes/sage/static/mathjax_sage.js_t might be wrong, which might break <a class="missing wiki">MathJax?</a> in the Sphinx documentation.
</p>
TicketrbeezerMon, 20 Jun 2011 19:23:20 GMT
https://trac.sagemath.org/ticket/9774#comment:31
https://trac.sagemath.org/ticket/9774#comment:31
<p>
In the current state, the --mathjax switch seems to work with a build of the html version of the reference manual.
</p>
<p>
Mathematics in the documentation is being wrapped with <code>\(, \)</code> pairs, which are the default <a class="missing wiki">MathJax?</a> delimiters for inline mathematics. However these snippets are not being rendered when viewed in a browser.
</p>
<p>
In the page source of a page of the html documentation, I see a script in a file named <code>mathjax_sage.js</code> which we are not generating. We do have <code>jsmath_sage.js</code> lying about in the doc directories, which have the full jsmath configuration information. So this likely needs repair before an HTML documentation page with <a class="missing wiki">MathJax?</a> support is built properly.
</p>
TicketrbeezerMon, 20 Jun 2011 21:29:18 GMT
https://trac.sagemath.org/ticket/9774#comment:32
https://trac.sagemath.org/ticket/9774#comment:32
<p>
OK, I can force <code>mathjax_sage.js</code> to be created by totally trashing some of the documentation output with
</p>
<pre class="wiki">devel/sage/doc/output/html$ rm -rf en
</pre><p>
before rebuilding the HTML reference documentation. It comes from a template file <code>mathjax_sage.js_t</code> that one of the patches creates properly.
</p>
<p>
Mathematics still does not render, but I think the <a class="missing wiki">MathJax?</a> configuration is looking locally. Time for a local <a class="missing wiki">MathJax?</a> install, I think.
</p>
TicketrbeezerMon, 20 Jun 2011 23:50:31 GMT
https://trac.sagemath.org/ticket/9774#comment:33
https://trac.sagemath.org/ticket/9774#comment:33
<p>
In a page of the documentation, I inserted manually
</p>
<pre class="wiki"><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
</pre><p>
and the mathematics rendered properly with MathJax.
</p>
<p>
Then I installed the mathjax 1.1a distribution alongside jsmath in the Flask notebook tree and used
</p>
<pre class="wiki"><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
</pre><p>
which also caused the math to render properly. (/sage/notebook is my <code>SAGE_ROOT</code>)
</p>
<p>
In both cases the fonts did not look too great to my eye.
</p>
<p>
Questions:
</p>
<p>
(a) How do we get these scripts commands to be placed properly in each page of the docs, with a proper relative path?
</p>
<p>
(b) Is there really a clean separation between Sage and the notebook if --mathjax mode for documentation requires the MathJax code from the notebook?
</p>
TicketrbeezerTue, 21 Jun 2011 00:04:09 GMT
https://trac.sagemath.org/ticket/9774#comment:34
https://trac.sagemath.org/ticket/9774#comment:34
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:33" title="Comment 33">rbeezer</a>:
</p>
<blockquote class="citation">
<p>
Then I installed the mathjax 1.1a distribution alongside jsmath in the Flask notebook tree and
</p>
</blockquote>
<blockquote class="citation">
<p>
which also caused the math to render properly. (/sage/notebook is my <code>SAGE_ROOT</code>)
</p>
</blockquote>
<p>
Oops, the incantation for a local install of MathJax should have been
</p>
<pre class="wiki"><script type="text/javascript" src="/sage/notebook/devel/rkirov-flask/sagenb/data/mathjax/MathJax.js?config=TeX-AMS_HTML-full"></script>
</pre>
TicketjhpalmieriFri, 01 Jul 2011 02:07:22 GMT
https://trac.sagemath.org/ticket/9774#comment:35
https://trac.sagemath.org/ticket/9774#comment:35
<p>
Here's a new version of my patch. With a locally installed version of MathJax, the documentation seems to render properly. I don't know if this is the best solution, but at least it seems to work.
</p>
<p>
(I installed MathJax by downloading a zip file: <a class="ext-link" href="https://github.com/mathjax/MathJax/zipball/v1.1a"><span class="icon"></span>https://github.com/mathjax/MathJax/zipball/v1.1a</a>. I unzipped it and renamed the resulting directory to <code>mathjax</code>, and moved it to <code>SAGE_ROOT/local/lib/python/site-packages/sagenb-0.9.0-py2.6.egg/sagenb/data/</code>, alongside of the old <code>jsmath</code> directory. I also put a copy of the <code>mathjax</code> directory in <code>SAGE_ROOT/devel/sagenb/sagenb/data/</code>. I haven't tried to install local fonts.)
</p>
TicketjhpalmieriFri, 01 Jul 2011 02:22:35 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>mathjax.patch</em>
</li>
</ul>
<p>
(experimental) patch for Sage library
</p>
TicketjhpalmieriFri, 01 Jul 2011 03:59:03 GMT
https://trac.sagemath.org/ticket/9774#comment:36
https://trac.sagemath.org/ticket/9774#comment:36
<p>
By the way, one comment about the latest version of my patch: it fixes the problem Rob mentioned about getting the appropriate invocation to MathJax in each piece of documentation. It does this by setting the variable <code>mathjax_path</code> to
</p>
<pre class="wiki">file://[path to MathJax.js]?config=TeX-AMS_HTML-full,file://[path to mathjax_sage.js]
</pre><p>
The paths here are absolute ones, in <code>SAGE_ROOT/devel/sage/doc/output/html/en/_static/</code>. This directory is created by <code>sage -docbuild website html</code>, so now if you build the docs with the <code>-j</code> flag (to enable MathJax), it first builds the website target, then builds whatever you requested. There might be a better way to do this, using relative paths, but I couldn't get it to work. For example, using
</p>
<pre class="wiki"> <script type="text/javascript" src="_static/MathJax.js?config=TeX-AMS_HTML-full"></script>
</pre><p>
successfully turns on MathJax, but without the local configuration turning on the custom macros. Using
</p>
<pre class="wiki"> <script type="text/javascript" src="_static/MathJax.js?config=TeX-AMS_HTML-full,mathjax_sage.js"></script>
</pre><p>
doesn't work, nor does any variation of it that I tried. (Note that when you change the path specifying the local configuration file, you also need to change the last line of that configuration file to match it, according to <a class="ext-link" href="http://www.mathjax.org/docs/1.1/configuration.html"><span class="icon"></span>http://www.mathjax.org/docs/1.1/configuration.html</a>.) If we could copy the file <code>mathjax_sage.js</code> to <code>_static/config/local/</code>, then we could use
</p>
<pre class="wiki"> <script type="text/javascript" src="_static/MathJax.js?config=TeX-AMS_HTML-full,local/mathjax_sage.js"></script>
</pre><p>
for the invocation, and
</p>
<pre class="wiki">MathJax.Ajax.loadComplete("[MathJax]/config/local/mathjax_sage.js")
</pre><p>
for the last line in mathjax_sage.js. But I don't know how to put this file in the right place: it's autogenerated, so we can't put it in the MathJax local directory ahead of time, and I can't figure out how to get Sphinx to do it when it's building the documentation.
</p>
<p>
Another option would be to try to get Sphinx to write this into each html file:
</p>
<pre class="wiki"><script type="text/x-mathjax-config">
[contents of mathjax_sage.js]
</script>
<script type="text/javascript" src="_static/MathJax.js?config=TeX-AMS_HTML-full"></script>
</pre><p>
We can get the last line by specifing mathjax_path in conf.py, but I don't know how to get the first part.
</p>
<p>
I'll keep working on it...
</p>
TicketrbeezerFri, 01 Jul 2011 04:50:48 GMT
https://trac.sagemath.org/ticket/9774#comment:37
https://trac.sagemath.org/ticket/9774#comment:37
<p>
Hi John,
</p>
<p>
Are you testing with the Flask notebook? If not, it might be easier to build what look like absolute paths to the MathJax files in the data directory of the notebook, because of the way Flask sets up paths with the "route()" command? I can't tell if this will solve the problem you are wrestling with or not.
</p>
<p>
The <code><script></code> tags were being messed with by the notebook on the server side just before being dispatched. But then the client sees two versions - wrapped and unwrapped, and totally trashes one of them to prevent running a script twice. I thought Jason had a patch for this too, but I haven't seen it. The symptom would be when you cycle through wrap, no-wrap, and hide for some output, then one of them is missing. I guess we can press on and fix this eventually.
</p>
<p>
About to go off-line shortly for the long weekend, but will come back to this when I can stick with it.
</p>
<p>
Rob
</p>
TicketjhpalmieriFri, 01 Jul 2011 05:17:39 GMT
https://trac.sagemath.org/ticket/9774#comment:38
https://trac.sagemath.org/ticket/9774#comment:38
<p>
For building the documentation, the notebook isn't relevant: they get built from the command line. I think that when trying to make MathJax work with the notebook, we'll want to construct the URLs differently than I'm doing for the docs, but I don't know enough about the paths, etc., in the notebook to say exactly how to do it. For what it's worth, though, I have been using the flask notebook.
</p>
TicketjasonFri, 01 Jul 2011 06:07:01 GMT
https://trac.sagemath.org/ticket/9774#comment:39
https://trac.sagemath.org/ticket/9774#comment:39
<p>
I've uploaded my current flask patch queue here: <a class="ext-link" href="http://sage.math.washington.edu/home/jason/mathjax-flask-patches.tar.gz"><span class="icon"></span>http://sage.math.washington.edu/home/jason/mathjax-flask-patches.tar.gz</a> My current (probably non-working) patch queue for my sage library, including two mathjax patches, is here:
<a class="ext-link" href="http://sage.math.washington.edu/home/jason/mathjax-sage-patches.tar.gz"><span class="icon"></span>http://sage.math.washington.edu/home/jason/mathjax-sage-patches.tar.gz</a>
</p>
<p>
These are both works-in-progress, but currently stalled for at least a week or two.
</p>
TicketjasonFri, 01 Jul 2011 06:08:33 GMT
https://trac.sagemath.org/ticket/9774#comment:40
https://trac.sagemath.org/ticket/9774#comment:40
<p>
I stalled working on it because of other time pressures with the single-cell, but also because I realized that the *next* version of Sphinx supports Mathjax out of the box, while I thought the current version would require patches.
</p>
TicketjhpalmieriFri, 01 Jul 2011 06:12:05 GMT
https://trac.sagemath.org/ticket/9774#comment:41
https://trac.sagemath.org/ticket/9774#comment:41
<p>
I think that the implementation of MathJax in Sphinx comes from the file mathjax.py, which is available for download separately. So my patch just adds it.
</p>
<p>
I'm attaching another version ("v2") of my patch; this one writes the MathJax local configuration file to a file in <code>SAGE_ROOT/local/lib/python/site-libraries/sagenb.../</code>, which may not be a good idea. But it allows for a simpler invocation of MathJax. I'm really not sure which approach is better.
</p>
TicketjhpalmieriFri, 01 Jul 2011 06:12:32 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>mathjax.v2.patch</em>
</li>
</ul>
<p>
(experimental) patch for Sage library, alternate version
</p>
TicketjasonMon, 09 Jan 2012 20:13:14 GMT
https://trac.sagemath.org/ticket/9774#comment:42
https://trac.sagemath.org/ticket/9774#comment:42
<p>
What is the current status on this now? Where should we start working on it again?
</p>
TicketrkirovTue, 10 Jan 2012 03:43:41 GMT
https://trac.sagemath.org/ticket/9774#comment:43
https://trac.sagemath.org/ticket/9774#comment:43
<p>
The last patch involving <a class="missing wiki">MathJax?</a>, that I rebased from the ones here is on google code:
</p>
<p>
<a class="ext-link" href="http://code.google.com/p/sagenb/issues/detail?id=46"><span class="icon"></span>http://code.google.com/p/sagenb/issues/detail?id=46</a>
</p>
<p>
Unless Jonathan Gutow did something else on top of it, this is latest work.
</p>
TicketjasonWed, 11 Jan 2012 06:50:56 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>mathjax.2.patch</em>
</li>
</ul>
<p>
Rebased version of comprehensive mathjax patch to 4.8.alpha4
</p>
TicketjasonThu, 12 Jan 2012 23:16:31 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>mathjax-try2.patch</em>
</li>
</ul>
<p>
Apply only this patch
</p>
TicketjasonThu, 12 Jan 2012 23:18:00 GMTdescription changed; milestone set
https://trac.sagemath.org/ticket/9774#comment:44
https://trac.sagemath.org/ticket/9774#comment:44
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=44">diff</a>)
</li>
<li><strong>milestone</strong>
set to <em>sage-5.0</em>
</li>
</ul>
TicketjasonThu, 12 Jan 2012 23:18:24 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:45
https://trac.sagemath.org/ticket/9774#comment:45
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=45">diff</a>)
</li>
</ul>
TicketjasonFri, 13 Jan 2012 21:49:29 GMTstatus, description changed; reviewer, author set
https://trac.sagemath.org/ticket/9774#comment:46
https://trac.sagemath.org/ticket/9774#comment:46
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Jason Grout</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=46">diff</a>)
</li>
<li><strong>author</strong>
set to <em>Rob Beezer, Davide Cervone, John Palmieri, Jason Grout</em>
</li>
</ul>
TicketjasonFri, 13 Jan 2012 21:50:52 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:47
https://trac.sagemath.org/ticket/9774#comment:47
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=47">diff</a>)
</li>
</ul>
TicketjasonFri, 13 Jan 2012 21:54:45 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:48
https://trac.sagemath.org/ticket/9774#comment:48
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=48">diff</a>)
</li>
</ul>
TicketjasonFri, 13 Jan 2012 22:28:23 GMTauthor changed
https://trac.sagemath.org/ticket/9774#comment:49
https://trac.sagemath.org/ticket/9774#comment:49
<ul>
<li><strong>author</strong>
changed from <em>Rob Beezer, Davide Cervone, John Palmieri, Jason Grout</em> to <em>Rob Beezer, Davide Cervone, John Palmieri, Jason Grout, Nathan Carter</em>
</li>
</ul>
TicketjasonFri, 13 Jan 2012 22:29:25 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-scripts-mathjax.patch</em>
</li>
</ul>
<p>
apply to <strong>scripts</strong> repository
</p>
TicketjasonFri, 13 Jan 2012 22:30:18 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-try3.patch</em>
</li>
</ul>
<p>
apply to <strong>sage</strong> repository
</p>
TicketjasonFri, 13 Jan 2012 22:42:12 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:50
https://trac.sagemath.org/ticket/9774#comment:50
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=50">diff</a>)
</li>
</ul>
TicketkiniFri, 13 Jan 2012 23:07:36 GMTcc changed
https://trac.sagemath.org/ticket/9774#comment:51
https://trac.sagemath.org/ticket/9774#comment:51
<ul>
<li><strong>cc</strong>
<em>kini</em> added
</li>
</ul>
TicketkiniSat, 14 Jan 2012 11:28:18 GMTstatus, description changed
https://trac.sagemath.org/ticket/9774#comment:52
https://trac.sagemath.org/ticket/9774#comment:52
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=52">diff</a>)
</li>
</ul>
<p>
I assume the description was incorrect, but even with the correction I made, <a class="attachment" href="https://trac.sagemath.org/attachment/ticket/9774/trac_9774-mathjax-try3.patch" title="Attachment 'trac_9774-mathjax-try3.patch' in Ticket #9774">trac_9774-mathjax-try3.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/9774/trac_9774-mathjax-try3.patch" title="Download"></a> does not apply cleanly on top of 4.8.alpha6. On 4.8.alpha4 (at least by <code>hg up 4.8.alpha4 && sage -b</code>) it fails a couple of doctests. Rebasing and fixing doctests now.
</p>
TicketkiniSat, 14 Jan 2012 11:58:15 GMT
https://trac.sagemath.org/ticket/9774#comment:53
https://trac.sagemath.org/ticket/9774#comment:53
<p>
Whoops, looks like "a couple of doctests" was an understatement. I guess it should be done in a separate patch. Here's the new patch, rebased only.
</p>
TicketkiniSat, 14 Jan 2012 11:59:15 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-try4.patch</em>
</li>
</ul>
<p>
apply to $SAGE_ROOT/devel/sage
</p>
TicketjasonSat, 14 Jan 2012 14:42:49 GMT
https://trac.sagemath.org/ticket/9774#comment:54
https://trac.sagemath.org/ticket/9774#comment:54
<p>
The try3 patches were against alpha4. Late last night I patched 5.0.beta1, and realized there were some patch failures, which I fixed. I'll compare your rebase with mine.
</p>
<p>
I also realized last night during dinner that I hadn't run doctests, so those should be run on sage and sagenb. Thanks for checking this.
</p>
TicketjasonSat, 14 Jan 2012 14:44:11 GMT
https://trac.sagemath.org/ticket/9774#comment:55
https://trac.sagemath.org/ticket/9774#comment:55
<p>
You don't happen to have your changes as a separate patch on top of mine, do you? I'd love to review your changes, but it's a bit hard to see where your additions are.
</p>
<p>
If you don't have it, I'll just diff the two patches, but that's a little harder to read than a separate patch.
</p>
TicketjhpalmieriSat, 14 Jan 2012 18:11:07 GMT
https://trac.sagemath.org/ticket/9774#comment:56
https://trac.sagemath.org/ticket/9774#comment:56
<p>
I wonder if the reported problems with "<" and ">" are due to line 1685 in latex.py:
</p>
<pre class="wiki">x = x.replace('<', '&lt;').replace('>', '&gt;')
</pre><p>
This was put in for use with jsMath, but maybe MathJax doesn't have the same issues.
</p>
TicketjasonSat, 14 Jan 2012 18:15:51 GMT
https://trac.sagemath.org/ticket/9774#comment:57
https://trac.sagemath.org/ticket/9774#comment:57
<p>
It was more complicated than that, but I've fixed it by getting rid of the math_parse function and conditional typesetting we were doing. We've configured <a class="missing wiki">MathJax?</a> to make the math_parse function obsolete, and it's inconsistent to typeset only conditionally. See <a class="ext-link" href="https://github.com/jasongrout/sagenb/commit/6a4eed4d6baf78cd19fe634144c727843d1af08d"><span class="icon"></span>https://github.com/jasongrout/sagenb/commit/6a4eed4d6baf78cd19fe634144c727843d1af08d</a> and <a class="ext-link" href="https://github.com/jasongrout/sagenb/commit/8d6b0a071c13850cea983faaa6b910be498cd0ae"><span class="icon"></span>https://github.com/jasongrout/sagenb/commit/8d6b0a071c13850cea983faaa6b910be498cd0ae</a>
</p>
<p>
I've updated test.sagenb.org with the newest mathjax changes.
</p>
TicketkiniSun, 15 Jan 2012 07:03:12 GMT
https://trac.sagemath.org/ticket/9774#comment:58
https://trac.sagemath.org/ticket/9774#comment:58
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:55" title="Comment 55">jason</a>:
</p>
<blockquote class="citation">
<p>
You don't happen to have your changes as a separate patch on top of mine, do you? I'd love to review your changes, but it's a bit hard to see where your additions are.
</p>
<p>
If you don't have it, I'll just diff the two patches, but that's a little harder to read than a separate patch.
</p>
</blockquote>
<p>
Er, no, I don't, unfortunately. You can get such a diff by doing <code>hg qfinish</code> on my patch on top of 4.8.alpha6, then <code>hg up 4.8.alpha4</code>, then <code>hg qimport -P [your patch]</code>, then <code>hg diff -r tip -r [revid of my patch]</code> (you would probably want to <code>hg strip [revid of my patch]</code> later).
</p>
<p>
But I don't see how that's very useful to you since it will be some gigantic patch subsuming everything that was merged in alpha5 and alpha6. In your position I would just diff the two patches, but maybe I don't understand what you're asking for. If you just want diffs for the files touched by the patch, that would also be possible, but maybe a bit messier. Do as above, except also qfinish your patch, and then merge the two qfinished patches' commits into a new commit, with your patch as the primary parent. Then do <code>hg log -r [the merge commit] -p [the file names]</code>. (I think that should work.) Or I guess you could just make the gigantic patch and ignore the parts that are on irrelevant files.
</p>
TicketjasonMon, 16 Jan 2012 22:07:40 GMTstatus, description changed
https://trac.sagemath.org/ticket/9774#comment:59
https://trac.sagemath.org/ticket/9774#comment:59
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=59">diff</a>)
</li>
</ul>
<p>
kini: your try4 patch looks fine to me. It applies cleanly on 5.0.some_version_of_prealpha1_or_beta1
</p>
TicketppurkaMon, 06 Feb 2012 13:32:57 GMT
https://trac.sagemath.org/ticket/9774#comment:60
https://trac.sagemath.org/ticket/9774#comment:60
<p>
I seem to have a broken install here (2nd try). I followed this sequence of steps to install mathjax + jmol (output of <code>history</code> in zsh).
</p>
<pre class="wiki"> 663 local/bin
664 ../../sage -hg qimport http://trac.sagemath.org/sage_trac/raw-attachment/ticket/9774/trac_9774-scripts-mathjax.patch
*** ../../sage -hg qpush # This line is missing because of my zsh setup
666 ../../
667 l
668 cd devel/sage
669 ../../sage -hg qimport http://trac.sagemath.org/sage_trac/raw-attachment/ticket/9774/trac_9774-mathjax-try4.patch
670 ../../sage -hg qpush
671 ../../sage -b
672 ../..
674 ./sage -f http://sage.math.washington.edu/home/jason/mathjax/sagenb-0.9.0.spkg
675 ./sage -f http://sage.math.washington.edu/home/jason/jmol/jmol-12.0.45.p4.spkg
676 ./sage -b
678 ./sage -n
679 BROWSER="firefox" ./sage -n
</pre><p>
Mathjax is broken and so is jmol. Do I need to install something extra for mathjax + jmol to work? These steps were followed on a freshly compiled sage-4.8. Screenshot: <a class="ext-link" href="http://i.imgur.com/A6wrQ.png"><span class="icon"></span>http://i.imgur.com/A6wrQ.png</a>
</p>
TicketjasonMon, 06 Feb 2012 13:39:51 GMTdependencies set
https://trac.sagemath.org/ticket/9774#comment:61
https://trac.sagemath.org/ticket/9774#comment:61
<ul>
<li><strong>dependencies</strong>
set to <em>#11080</em>
</li>
</ul>
<p>
I only tested it on a 5.0 beta. I see that <a class="closed ticket" href="https://trac.sagemath.org/ticket/11080" title="enhancement: move notebook to flask/wsgi-based notebook (closed: fixed)">#11080</a> isn't explicitly listed as a dependency (though it is mentioned in the description).
</p>
<p>
So please follow the directions on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11080" title="enhancement: move notebook to flask/wsgi-based notebook (closed: fixed)">#11080</a> first (which involves a lot more patches). My guess is that things won't apply cleanly to 4.8, and you'll need a 5.0 beta.
</p>
TicketjasonMon, 06 Feb 2012 13:40:39 GMT
https://trac.sagemath.org/ticket/9774#comment:62
https://trac.sagemath.org/ticket/9774#comment:62
<p>
And thanks for looking at this! This ticket is also live at test.sagenb.org.
</p>
TicketppurkaSun, 19 Feb 2012 15:38:23 GMT
https://trac.sagemath.org/ticket/9774#comment:63
https://trac.sagemath.org/ticket/9774#comment:63
<p>
There seems to be some problem with mathjax rendering with <code>LatexExpr</code>. Compare the jsmath rendering here: <a class="ext-link" href="http://sagenb.org/home/pub/4337/"><span class="icon"></span>http://sagenb.org/home/pub/4337/</a> to the mathjax here: <a class="ext-link" href="http://test.sagenb.org/home/pub/19/"><span class="icon"></span>http://test.sagenb.org/home/pub/19/</a>
</p>
TicketppurkaSat, 25 Feb 2012 16:56:50 GMT
https://trac.sagemath.org/ticket/9774#comment:64
https://trac.sagemath.org/ticket/9774#comment:64
<p>
Some doctest failures with this patch:
</p>
<pre class="wiki">...sage-5.0.beta2/devel/sage> ../../sage -t sage/misc/latex.py
sage -t "devel/sage-main-backup/sage/misc/latex.py"
**********************************************************************
File "/home/punarbasu/Installations/sage-5.0.beta2/devel/sage-main-backup/sage/misc/latex.py", line 1765:
sage: MathJax().eval(type(3), mode='inline')
Expected:
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\hbox{ < type 'sage.rings.integer.Integer' > }</script></html>
Got:
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\verb|&lt;type|\phantom{\verb!x!}\verb|'sage.rings.integer.Integer'&gt;|</script></html>
**********************************************************************
File "/home/punarbasu/Installations/sage-5.0.beta2/devel/sage-main-backup/sage/misc/latex.py", line 2199:
sage: sys.displayhook
Expected:
<html>...\verb|&lt;function|\phantom{x}\verb|pretty_print|...</html>
Got:
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\verb|&lt;function|\phantom{\verb!x!}\verb|pretty_print|\phantom{\verb!x!}\verb|at|\phantom{\verb!x!}\verb|0x150b050&gt;|</script></html>
**********************************************************************
2 items had failures:
1 of 7 in __main__.example_52
1 of 7 in __main__.example_59
***Test Failed*** 2 failures.
For whitespace errors, see the file /home/punarbasu/.sage//tmp/latex_7938.py
[3.1 s]
----------------------------------------------------------------------
The following tests failed:
sage -t "devel/sage-main-backup/sage/misc/latex.py"
Total time for all tests: 3.1 seconds
</pre>
TicketppurkaSat, 09 Jun 2012 09:49:11 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-try5.patch</em>
</li>
</ul>
<p>
Apply to devel/sage
</p>
TicketppurkaSat, 09 Jun 2012 10:05:13 GMTstatus changed; work_issues set
https://trac.sagemath.org/ticket/9774#comment:65
https://trac.sagemath.org/ticket/9774#comment:65
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
<li><strong>work_issues</strong>
set to <em>does not work in DOT_SAGE</em>
</li>
</ul>
<p>
rebased patch to sage-5.1beta2.
</p>
<p>
There is however a very weird problem with mathjax, both 1.0 and 2.0 branches. The math is not rendered as long as the sagenb directory is under <code>DOT_SAGE</code>. To reproduce, try the steps below. Use any branch (mathjax-1 or mathjax-2) for instance jasongrout/mathjax (mathjax-1) in github.
</p>
<ol><li><code>mkdir /tmp/a</code>
</li><li><code>DOT_SAGE=/tmp/a sage -n</code>.
</li><li>First, note that the above command launches the nb in port 8000 instead of 8080. But if we use some other command such as the one below, then it does open in port 8080.
<pre class="wiki">sage -n directory=/tmp/a.sagenb
</pre></li><li>Open a new worksheet, and try to print latex, for instance run the command <code>view('?')</code>. You will get a js error popup saying (in Opera 12.00RC, and Opera-11.64)
<pre class="wiki">SyntaxError: at index 0 in "\newcommand{\Bold}[1]{\mathbf{#1}}?": invalid character escape sequence
</pre></li></ol><p>
In firefox-10.0.4 I simply get the error: <code>SyntaxError: illegal character</code>. This error is not present if I run sage instead as <code>sage -n directory=/tmp/a.sagenb</code>, and the mathjax output is all good.
</p>
TicketppurkaSat, 09 Jun 2012 10:34:37 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:66
https://trac.sagemath.org/ticket/9774#comment:66
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=66">diff</a>)
</li>
</ul>
TicketkiniSat, 09 Jun 2012 17:26:34 GMT
https://trac.sagemath.org/ticket/9774#comment:67
https://trac.sagemath.org/ticket/9774#comment:67
<p>
It looks like Samuel Ainsworth has independently got MathJax working in his "newui" branch (I haven't tested it). At a glance it seems he's using the MathJax CDN.
</p>
TicketppurkaSat, 09 Jun 2012 19:40:36 GMT
https://trac.sagemath.org/ticket/9774#comment:68
https://trac.sagemath.org/ticket/9774#comment:68
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:67" title="Comment 67">kini</a>:
</p>
<blockquote class="citation">
<p>
It looks like Samuel Ainsworth has independently got MathJax working in his "newui" branch (I haven't tested it). At a glance it seems he's using the MathJax CDN.
</p>
</blockquote>
<p>
Has he applied the mathjax patches to the sage repo? Without those patches it won't work. And these patches were not applying for quite sometime. I just updated one today.
</p>
<p>
There are more changes to make actually. <code>SAGE_ROOT/devel/sage/doc</code> has lots of jsmath references, which all need to be converted to mathjax.
</p>
<p>
If you can independently confirm the behavior in <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:65" title="Comment 65">comment:65</a> then it will be good.
</p>
TicketjhpalmieriTue, 12 Jun 2012 19:43:51 GMTstatus, reviewer, description changed
https://trac.sagemath.org/ticket/9774#comment:69
https://trac.sagemath.org/ticket/9774#comment:69
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
changed from <em>Jason Grout</em> to <em>Jason Grout, John Palmieri</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=69">diff</a>)
</li>
</ul>
<p>
Regarding <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:65" title="Comment 65">your comment</a>: the spkg in the ticket description is quite old, and that was probably the problem. The notebook has now been upgraded to use MathJax, and it does not have the problem you described.
</p>
TicketjhpalmieriTue, 12 Jun 2012 19:45:18 GMTwork_issues deleted
https://trac.sagemath.org/ticket/9774#comment:70
https://trac.sagemath.org/ticket/9774#comment:70
<ul>
<li><strong>work_issues</strong>
<em>does not work in DOT_SAGE</em> deleted
</li>
</ul>
TicketkcrismanTue, 12 Jun 2012 20:28:40 GMTmilestone changed
https://trac.sagemath.org/ticket/9774#comment:71
https://trac.sagemath.org/ticket/9774#comment:71
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.1</em> to <em>sage-5.2</em>
</li>
</ul>
<p>
Fantastic news!
</p>
<p>
This was merged in the notebook at <a class="ext-link" href="https://github.com/sagemath/sagenb/pull/30"><span class="icon"></span>this github pull request</a>, just for completeness.
</p>
<p>
Since <a class="closed ticket" href="https://trac.sagemath.org/ticket/11080" title="enhancement: move notebook to flask/wsgi-based notebook (closed: fixed)">#11080</a> is for Sage 5.2, this should be too.
</p>
TicketkcrismanTue, 12 Jun 2012 20:30:53 GMTreviewer changed
https://trac.sagemath.org/ticket/9774#comment:72
https://trac.sagemath.org/ticket/9774#comment:72
<ul>
<li><strong>reviewer</strong>
changed from <em>Jason Grout, John Palmieri</em> to <em>Jason Grout, John Palmieri, Punarbasu Purkayastha, Keshav Kini</em>
</li>
</ul>
TicketkcrismanTue, 12 Jun 2012 20:38:19 GMT
https://trac.sagemath.org/ticket/9774#comment:73
https://trac.sagemath.org/ticket/9774#comment:73
<p>
Just checking on this - Jason, will this indeed fix <a class="closed ticket" href="https://trac.sagemath.org/ticket/1608" title="enhancement: Make optional spkg for MathJax png fonts (closed: invalid)">#1608</a>? That is, will we be shipping (the relevant) MathJax fonts? From what I'm reading above, that seems to be the case. Anyone who confirms this, please give positive review to <a class="closed ticket" href="https://trac.sagemath.org/ticket/1608" title="enhancement: Make optional spkg for MathJax png fonts (closed: invalid)">#1608</a> and add your name as a reviewer.
</p>
TicketjhpalmieriTue, 12 Jun 2012 23:35:59 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:74
https://trac.sagemath.org/ticket/9774#comment:74
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
We have doctest failures:
</p>
<pre class="wiki"> sage -t --long -force_lib devel/sagenb-main/sagenb/notebook/jsmath.py # 5 doctests failed
sage -t --long -force_lib devel/sagenb-main/sagenb/misc/sphinxify.py # 1 doctests failed
sage -t --long -force_lib devel/sage/doc/de/tutorial/latex.rst # 27 doctests failed
sage -t --long -force_lib devel/sage/doc/en/tutorial/latex.rst # 27 doctests failed
sage -t --long -force_lib devel/sage/sage/matrix/matrix0.pyx # 1 doctests failed
</pre><p>
The problem with sphinxify is easy to fix. Should we delete jsmath.py, or is it still needed for something?
</p>
<p>
The problems with the tutorial are a bit more involved, since (a) it explicitly discusses using JSMath and (b) I don't speak German.
</p>
<p>
I don't understand the matrix0.pyx problem at all, at least not yet.
</p>
TicketkcrismanTue, 12 Jun 2012 23:55:13 GMT
https://trac.sagemath.org/ticket/9774#comment:75
https://trac.sagemath.org/ticket/9774#comment:75
<blockquote class="citation">
<p>
The problems with the tutorial are a bit more involved, since (a) it explicitly discusses using JSMath and (b) I don't speak German.
</p>
</blockquote>
<p>
There are a number of Sage folks who do, though, so hopefully the second one won't be a problem. Once you fix the English one let us know.
</p>
<p>
I wonder why the other tutorial versions don't cause problems? In particular, there is a tutorial in Russian and one in French in 5.1.beta3 that you don't mention as having caused problems - maybe they're based on different versions of the English tutorial.
</p>
TicketjhpalmieriWed, 13 Jun 2012 05:50:25 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-doctests.patch</em>
</li>
</ul>
TicketjhpalmieriWed, 13 Jun 2012 05:54:47 GMTdescription changed; work_issues set
https://trac.sagemath.org/ticket/9774#comment:76
https://trac.sagemath.org/ticket/9774#comment:76
<ul>
<li><strong>work_issues</strong>
set to <em>fix sagenb</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=76">diff</a>)
</li>
</ul>
<p>
Here is a patch fixing the doctests in the Sage library. For the English tutorial, I did a little bit more than a search-and-replace, changing "JSMath" to "MathJax". For the German tutorial, that's essentially all I did.
</p>
<p>
sagenb also needs fixing, and I don't have the energy to do this right now. If someone else wants to, that would be great. Here's what I think should be done: delete notebook/jsmath.py, and patch misc/sphinxify.py:
</p>
<div class="wiki-code"><div xmlns="http://www.w3.org/1999/xhtml" class="diff">
<ul class="entries">
<li class="entry">
<h2>
<a>sagenb/misc/sphinxify.py</a>
</h2>
<pre>diff --git a/sagenb/misc/sphinxify.py b/sagenb/misc/sphinxify.py
index 837b40a..85c9f4d 100644</pre>
<table class="trac-diff inline" summary="Differences" cellspacing="0">
<colgroup><col class="lineno" /><col class="lineno" /><col class="content" /></colgroup>
<thead>
<tr>
<th title="File a/sagenb/misc/sphinxify.py">
a
</th>
<th title="File b/sagenb/misc/sphinxify.py">
b
</th>
<td><em> def sphinxify(docstring, format='html'):</em> </td>
</tr>
</thead>
<tbody class="unmod">
<tr>
<th>71</th><th>71</th><td class="l"><span> sage: sphinxify('**Testing**\n`monospace`')</span></td>
</tr><tr>
<th>72</th><th>72</th><td class="l"><span> '\n<div class="docstring"...<strong>Testing</strong>\n<span class="math"...</p>\n\n\n</div</span></td>
</tr><tr>
<th>73</th><th>73</th><td class="l"><span> sage: sphinxify('`x=y`')</span></td>
</tr>
</tbody><tbody class="mod">
<tr class="first">
<th>74</th><th> </th><td class="l"><span> '\n<div class="docstring">\n \n <p><span class="math"><del>x=y</span></p>\n\n\n</div>'</del></span></td>
</tr>
<tr class="last">
<th> </th><th>74</th><td class="r"><span> '\n<div class="docstring">\n \n <p><span class="math"><ins>\\(x=y\\)</span></p>\n\n\n</div></ins></span></td>
</tr>
</tbody><tbody class="unmod">
<tr>
<th>75</th><th>75</th><td class="l"><span> sage: sphinxify('`x=y`', format='text')</span></td>
</tr><tr>
<th>76</th><th>76</th><td class="l"><span> 'x=y\n'</span></td>
</tr><tr>
<th>77</th><th>77</th><td class="l"><span> sage: sphinxify(':math:`x=y`', format='text')</span></td>
</tr>
</tbody>
</table>
</li>
</ul>
</div></div>
TicketjhpalmieriWed, 13 Jun 2012 05:58:14 GMT
https://trac.sagemath.org/ticket/9774#comment:77
https://trac.sagemath.org/ticket/9774#comment:77
<p>
Regarding the change in matrix0.py: the main patch already modified that file, and this doctest was missed. (jsMath can't handle the command <code>\hline</code>, so matrices with subdivisions had to be handled specially in the notebook. MathJax handles this command just fine, so the special-casing went away, so the extra doctest for the notebook needed to go away, too.)
</p>
TicketjasonWed, 13 Jun 2012 06:53:34 GMT
https://trac.sagemath.org/ticket/9774#comment:78
https://trac.sagemath.org/ticket/9774#comment:78
<p>
test.sagenb.org and alpha.sagenb.org are running these patches up through try5 (but not the doctest patch just posted).
</p>
TicketjhpalmieriWed, 13 Jun 2012 17:44:01 GMT
https://trac.sagemath.org/ticket/9774#comment:79
https://trac.sagemath.org/ticket/9774#comment:79
<p>
Regarding my comment about sagenb: apparently jsmath.py is already gone in the new sagenb; I don't know why I thought otherwise. sphinxify.py still needs to be patched.
</p>
TicketkcrismanWed, 13 Jun 2012 18:29:40 GMT
https://trac.sagemath.org/ticket/9774#comment:80
https://trac.sagemath.org/ticket/9774#comment:80
<blockquote class="citation">
<p>
Here is a patch fixing the doctests in the Sage library. For the English tutorial, I did a little bit more than a search-and-replace, changing "JSMath" to "MathJax". For the German tutorial, that's essentially all I did.
</p>
</blockquote>
<p>
That looks to have been enough. I have no idea if all the stuff in English is actually <em>true</em> any more, of course. As long as
</p>
<pre class="wiki">In the
case of Sage, the notebook is always connected to a server used to
execute the Sage commands, and this server also provides the necessary
jsMath fonts. So there is nothing extra to set up to have typeset
mathematics in your web browser when you use the Sage notebook.
</pre><p>
is still true for MathJax you should be fine.
</p>
TicketjhpalmieriWed, 13 Jun 2012 18:46:15 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:81
https://trac.sagemath.org/ticket/9774#comment:81
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
<p>
I just <a class="ext-link" href="https://github.com/sagemath/sagenb/pull/60"><span class="icon"></span>submitted a pull request</a> for the sphinxify change in sagenb. So I think this is ready for review. The only thing that needs review is the doctest patch, which just fixes doctests. I'm running doctests now.
</p>
TicketjhpalmieriWed, 13 Jun 2012 18:46:24 GMTwork_issues deleted
https://trac.sagemath.org/ticket/9774#comment:82
https://trac.sagemath.org/ticket/9774#comment:82
<ul>
<li><strong>work_issues</strong>
<em>fix sagenb</em> deleted
</li>
</ul>
TicketjhpalmieriWed, 13 Jun 2012 20:11:07 GMT
https://trac.sagemath.org/ticket/9774#comment:83
https://trac.sagemath.org/ticket/9774#comment:83
<p>
All tests pass with the new patches.
</p>
TicketjhpalmieriWed, 13 Jun 2012 22:14:04 GMT
https://trac.sagemath.org/ticket/9774#comment:84
https://trac.sagemath.org/ticket/9774#comment:84
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/9774#comment:80" title="Comment 80">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
As long as
</p>
<pre class="wiki">In the
case of Sage, the notebook is always connected to a server used to
execute the Sage commands, and this server also provides the necessary
jsMath fonts. So there is nothing extra to set up to have typeset
mathematics in your web browser when you use the Sage notebook.
</pre><p>
is still true for MathJax you should be fine.
</p>
</blockquote>
<p>
As far as I can tell, it still is. If it's not, it's close enough.
</p>
TicketppurkaThu, 14 Jun 2012 03:59:10 GMT
https://trac.sagemath.org/ticket/9774#comment:85
https://trac.sagemath.org/ticket/9774#comment:85
<p>
I see that after this mathjax-1.1 is merged into sagenb. Shouldn't we move to mathjax-2 directly?
</p>
TicketjasonThu, 14 Jun 2012 04:59:13 GMT
https://trac.sagemath.org/ticket/9774#comment:86
https://trac.sagemath.org/ticket/9774#comment:86
<p>
<a class="missing wiki">MathJax?</a> 2.0 should be a separate patch. Let's not delay this year-in-the-making positively-reviewed patch any longer.
</p>
TicketkiniThu, 14 Jun 2012 22:41:13 GMTsummary changed
https://trac.sagemath.org/ticket/9774#comment:87
https://trac.sagemath.org/ticket/9774#comment:87
<ul>
<li><strong>summary</strong>
changed from <em>Upgrade the notebook to use MathJax instead of jsMath</em> to <em>Use MathJax instead of jsMath</em>
</li>
</ul>
TicketkiniThu, 14 Jun 2012 22:59:03 GMT
https://trac.sagemath.org/ticket/9774#comment:88
https://trac.sagemath.org/ticket/9774#comment:88
<p>
Once my <code>make ptestlong</code> finishes, I'm just going to give this positive review. The pull request has already been merged into sagenb (and so everyone will need to apply these patches anyway if they want to test the latest revision of the notebook), the patch looks good to me (though I don't know much about the code it touches), and from some poking around it seems to work as advertised.
</p>
TicketkiniFri, 15 Jun 2012 00:22:53 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:89
https://trac.sagemath.org/ticket/9774#comment:89
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
All systems go!
</p>
TicketkiniFri, 15 Jun 2012 00:29:59 GMTkeywords set
https://trac.sagemath.org/ticket/9774#comment:90
https://trac.sagemath.org/ticket/9774#comment:90
<ul>
<li><strong>keywords</strong>
<em>sd41</em> added
</li>
</ul>
TicketjdemeyerFri, 15 Jun 2012 21:03:29 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:91
https://trac.sagemath.org/ticket/9774#comment:91
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
This obviously needs a proper sagenb spkg before it can be merged.
</p>
TicketjdemeyerFri, 15 Jun 2012 21:05:28 GMT
https://trac.sagemath.org/ticket/9774#comment:92
https://trac.sagemath.org/ticket/9774#comment:92
<p>
Important note: if the sagenb people can write me a script which <em>automatically</em> creates a new sagenb spkg from a git repository, I'll be happy to use it.
</p>
TicketkiniFri, 15 Jun 2012 21:54:42 GMTstatus, dependencies, upstream changed
https://trac.sagemath.org/ticket/9774#comment:93
https://trac.sagemath.org/ticket/9774#comment:93
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>positive_review</em>
</li>
<li><strong>dependencies</strong>
changed from <em>#11080</em> to <em>#13121</em>
</li>
<li><strong>upstream</strong>
changed from <em>N/A</em> to <em>Fixed upstream, but not in a stable release.</em>
</li>
</ul>
<p>
No, we'll (I'll) do it manually. SPKGs being autogenerated is at odds with having repositories for SPKGs.
</p>
<p>
I have written scripts which at least simplify the process, though - they create a directory which can be used as the new SPKG's <code>src/</code> directory without modification of the <code>spkg-install</code> script. Those are at <a class="ext-link" href="https://github.com/sagemath/sagenb/pull/63"><span class="icon"></span>this pull request</a>, which I'd appreciate it if someone reviewed :)
</p>
<p>
I'm setting this ticket to positive review because there is nothing left to be done on the Sage end other than wait for <a class="closed ticket" href="https://trac.sagemath.org/ticket/13121" title="enhancement: Upgrade sagenb to 0.10.x (closed: fixed)">#13121</a> to get in (i.e. Sage to upgrade to sagenb 0.9.1).
</p>
TicketkiniSat, 16 Jun 2012 04:14:56 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:94
https://trac.sagemath.org/ticket/9774#comment:94
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=94">diff</a>)
</li>
</ul>
TicketjdemeyerMon, 18 Jun 2012 22:12:42 GMTmilestone changed
https://trac.sagemath.org/ticket/9774#comment:95
https://trac.sagemath.org/ticket/9774#comment:95
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.2</em> to <em>sage-pending</em>
</li>
</ul>
TicketjhpalmieriWed, 20 Jun 2012 19:07:54 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:96
https://trac.sagemath.org/ticket/9774#comment:96
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=96">diff</a>)
</li>
</ul>
<p>
Rebased to Sage 5.1.beta5 (because of <a class="closed ticket" href="https://trac.sagemath.org/ticket/11775" title="enhancement: Make pretty_print take multiple arguments (closed: fixed)">#11775</a>).
</p>
TicketjasonMon, 25 Jun 2012 16:54:06 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-try6.patch</em>
</li>
</ul>
<p>
Sage library
</p>
TicketjasonMon, 25 Jun 2012 16:54:32 GMT
https://trac.sagemath.org/ticket/9774#comment:97
https://trac.sagemath.org/ticket/9774#comment:97
<p>
I rebased <a class="attachment" href="https://trac.sagemath.org/attachment/ticket/9774/trac_9774-mathjax-try6.patch" title="Attachment 'trac_9774-mathjax-try6.patch' in Ticket #9774">trac_9774-mathjax-try6.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/9774/trac_9774-mathjax-try6.patch" title="Download"></a> to sage 5.1beta6
</p>
TicketkcrismanThu, 05 Jul 2012 16:28:19 GMT
https://trac.sagemath.org/ticket/9774#comment:98
https://trac.sagemath.org/ticket/9774#comment:98
<p>
Dumb question. If the changes to the latex of some vectors is to work around a jsmath bug, maybe we shouldn't remove that comment; after all, maybe that workaround is no longer needed, but now no one will no that it was a workaround in the first place... Maybe it works now completely, and we should change it or remove it!
</p>
<p>
This was apparently introduced in the try3 patch.
</p>
TicketjhpalmieriThu, 05 Jul 2012 16:40:47 GMT
https://trac.sagemath.org/ticket/9774#comment:99
https://trac.sagemath.org/ticket/9774#comment:99
<p>
Can you tell which part is "weird"? Is it the braces around <code></code>\mapsto<code></code>? If I remove those braces, it works with both jsMath and MathJax.
</p>
TicketkcrismanThu, 05 Jul 2012 17:45:39 GMT
https://trac.sagemath.org/ticket/9774#comment:100
https://trac.sagemath.org/ticket/9774#comment:100
<blockquote class="citation">
<p>
Can you tell which part is "weird"? Is it the braces around <code></code>\mapsto<code></code>? If I remove those braces, it works with both jsMath and MathJax.
</p>
</blockquote>
<p>
I wish I could tell you! I didn't write it. I was just trying to point this out, in case it was clear to someone else. If it's not clear what the problem is, maybe we leave the comment in? Maybe Jason can explain.
</p>
<p>
Also, both representations have the braces, and braces are fine for demarcating things in TeX, so I don't think that's the issue. hg blame says that this dates from before the symbolics switch to Pynac.
</p>
<p>
Anyway, not a huge deal, but pointing it out.
</p>
TicketppurkaSat, 14 Jul 2012 00:58:15 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:101
https://trac.sagemath.org/ticket/9774#comment:101
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=101">diff</a>)
</li>
</ul>
<p>
Updated patch to the changes introduced in <a class="closed ticket" href="https://trac.sagemath.org/ticket/11775" title="enhancement: Make pretty_print take multiple arguments (closed: fixed)">#11775</a>. Otherwise, typeset was broken.
</p>
TicketkiniThu, 26 Jul 2012 09:08:04 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:102
https://trac.sagemath.org/ticket/9774#comment:102
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
Patch needs rebasing on <a class="closed ticket" href="https://trac.sagemath.org/ticket/13109" title="enhancement: Rewrite deprecation to use trac ticket numbers (closed: fixed)">#13109</a> - doing that now.
</p>
TicketkiniThu, 26 Jul 2012 10:28:13 GMT
https://trac.sagemath.org/ticket/9774#comment:103
https://trac.sagemath.org/ticket/9774#comment:103
<p>
Hmm. There is a failing doctest caused by <a class="closed ticket" href="https://trac.sagemath.org/ticket/11775" title="enhancement: Make pretty_print take multiple arguments (closed: fixed)">#11775</a>. Did you attempt to fix doctests when you made try7, ppurka? Or is this failing doctest somehow new or caused by my rebasing? Looking at a diff between the try7 patch and my new try8 patch, I don't see anything suspicious...
</p>
TicketkiniThu, 26 Jul 2012 11:01:00 GMT
https://trac.sagemath.org/ticket/9774#comment:104
https://trac.sagemath.org/ticket/9774#comment:104
<p>
In particular this doctest fails, on Sage 5.2.rc1:
</p>
<pre class="wiki">[3] fs@boone /opt/sage/devel/sage $ sage -t --long --force_lib sage/misc/latex.py
sage -t --long --force_lib "devel/sage-main/sage/misc/latex.py"
**********************************************************************
File "/opt/sage-5.2.rc1/devel/sage-main/sage/misc/latex.py", line 1972:
sage: view((x,2), combine_all=True) # trac 11775
Expected:
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}\left(x, 2\right)</script></html>
Got:
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}x 2</script></html>
**********************************************************************
1 items had failures:
1 of 17 in __main__.example_54
***Test Failed*** 1 failures.
For whitespace errors, see the file /home/fs/.sage//tmp/latex_17232.py
[1.3 s]
----------------------------------------------------------------------
The following tests failed:
sage -t --long --force_lib "devel/sage-main/sage/misc/latex.py"
Total time for all tests: 1.3 seconds
</pre>
TicketppurkaThu, 26 Jul 2012 15:47:42 GMT
https://trac.sagemath.org/ticket/9774#comment:105
https://trac.sagemath.org/ticket/9774#comment:105
<p>
Hmm.. I had updated to try7 exactly because it was failing the doctests and in the notebook. I thought I had fixed all the doctests. Updating try7 again soon.
</p>
TicketppurkaThu, 26 Jul 2012 16:21:25 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:106
https://trac.sagemath.org/ticket/9774#comment:106
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
<p>
Updated try7. Please test.
</p>
TicketppurkaFri, 03 Aug 2012 10:07:13 GMT
https://trac.sagemath.org/ticket/9774#comment:107
https://trac.sagemath.org/ticket/9774#comment:107
<p>
updated the try7 patch again, to changes in <a class="closed ticket" href="https://trac.sagemath.org/ticket/13109" title="enhancement: Rewrite deprecation to use trac ticket numbers (closed: fixed)">#13109</a>. To make the review easier, the diff between this and earlier patch <a class="ext-link" href="https://github.com/ppurka/sage-patches/commit/f1253cc6d3f5d0051e5192d17678425b3029e879"><span class="icon"></span>is here</a>.
</p>
TicketppurkaFri, 03 Aug 2012 10:12:28 GMTdescription changed
https://trac.sagemath.org/ticket/9774#comment:108
https://trac.sagemath.org/ticket/9774#comment:108
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/9774?action=diff&version=108">diff</a>)
</li>
</ul>
TicketkiniWed, 22 Aug 2012 06:55:32 GMT
https://trac.sagemath.org/ticket/9774#comment:109
https://trac.sagemath.org/ticket/9774#comment:109
<p>
The patch has fuzz against 5.3.beta2.
</p>
TicketkiniWed, 22 Aug 2012 07:00:33 GMT
https://trac.sagemath.org/ticket/9774#comment:110
https://trac.sagemath.org/ticket/9774#comment:110
<p>
The fuzz is caused by <a class="closed ticket" href="https://trac.sagemath.org/ticket/13310" title="defect: `:trac:` links are broken (closed: fixed)">#13310</a> which was merged in 5.3.beta1 and is harmless.
</p>
TicketkiniWed, 22 Aug 2012 07:01:55 GMT
https://trac.sagemath.org/ticket/9774#comment:111
https://trac.sagemath.org/ticket/9774#comment:111
<p>
Fixed.
</p>
TicketkiniWed, 22 Aug 2012 07:02:28 GMTattachment set
https://trac.sagemath.org/ticket/9774
https://trac.sagemath.org/ticket/9774
<ul>
<li><strong>attachment</strong>
set to <em>trac_9774-mathjax-try7.patch</em>
</li>
</ul>
<p>
apply to $SAGE_ROOT/devel/sage
</p>
TicketppurkaWed, 22 Aug 2012 07:07:32 GMT
https://trac.sagemath.org/ticket/9774#comment:112
https://trac.sagemath.org/ticket/9774#comment:112
<p>
What thing needs "review" here?
</p>
TicketkiniWed, 22 Aug 2012 07:18:37 GMTstatus changed
https://trac.sagemath.org/ticket/9774#comment:113
https://trac.sagemath.org/ticket/9774#comment:113
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Uh... hmm. The rebasing, I guess? Whatever, looks fine to me ;)
</p>
TicketjdemeyerSun, 02 Sep 2012 21:43:03 GMTmilestone changed
https://trac.sagemath.org/ticket/9774#comment:114
https://trac.sagemath.org/ticket/9774#comment:114
<ul>
<li><strong>milestone</strong>
changed from <em>sage-pending</em> to <em>sage-5.4</em>
</li>
</ul>
TicketjdemeyerWed, 05 Sep 2012 18:05:17 GMTstatus changed; resolution, merged set
https://trac.sagemath.org/ticket/9774#comment:115
https://trac.sagemath.org/ticket/9774#comment:115
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>merged</strong>
set to <em>sage-5.4.beta0</em>
</li>
</ul>
TicketnovoseltWed, 19 Sep 2012 16:14:01 GMT
https://trac.sagemath.org/ticket/9774#comment:116
https://trac.sagemath.org/ticket/9774#comment:116
<p>
This document does not compile anymore with SageTeX
</p>
<pre class="wiki">\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{sagetex}
\begin{document}
$\sage{"1 2"}$
\end{document}
</pre><p>
because someone has replaced a verbatim spacer with a version that does not work, as was explicitly explained in the surrounding comment, and then deleted the comment altogether:
</p>
<div class="wiki-code"><div xmlns="http://www.w3.org/1999/xhtml" class="diff">
<ul class="entries">
<li class="entry">
<h2>
<a>sage/misc/latex.py</a>
</h2>
<table class="trac-diff inline" summary="Differences" cellspacing="0">
<colgroup><col class="lineno" /><col class="lineno" /><col class="content" /></colgroup>
<thead>
<tr>
<th title="File a/sage/misc/latex.py">
a
</th>
<th title="File b/sage/misc/latex.py">
b
</th>
<td><em></em> </td>
</tr>
</thead>
<tbody class="unmod">
<tr>
<th>323</th><th>323</th><td class="l"><span> # 2) wrap each line into \verb;</span></td>
</tr><tr>
<th>324</th><th>324</th><td class="l"><span> # 3) assemble lines into a left-justified array.</span></td>
</tr><tr>
<th>325</th><th>325</th><td class="l"><span> </span></td>
</tr>
</tbody><tbody class="mod">
<tr class="first">
<th>326</th><th> </th><td class="l"><span> # There is a bug in verb-space treatment in jsMath...</span></td>
</tr><tr>
<th>327</th><th> </th><td class="l"><span> spacer = "\\phantom{%s}"</span></td>
</tr><tr>
<th>328</th><th> </th><td class="l"><span> # \phantom{\verb!%s!} is more accurate and it works, but it is not a valid</span></td>
</tr><tr>
<th>329</th><th> </th><td class="l"><span> # LaTeX and may cause problems, so let's live with the above variant until</span></td>
</tr><tr>
<th>330</th><th> </th><td class="l"><span> # spaces are properly treated in jsMath/MathJax and we don't need to worry.</span></td>
</tr>
<tr class="last">
<th> </th><th>326</th><td class="r"><span> spacer = r"\phantom{\verb!%s!}"</span></td>
</tr>
</tbody><tbody class="unmod">
<tr>
<th>331</th><th>327</th><td class="l"><span> lines = []</span></td>
</tr><tr>
<th>332</th><th>328</th><td class="l"><span> for line in x.split("\n"):</span></td>
</tr><tr>
<th>333</th><th>329</th><td class="l"><span> parts = []</span></td>
</tr>
</tbody>
</table>
</li>
</ul>
</div></div><p>
What was the motivation for this???
</p>
TicketjasonWed, 19 Sep 2012 16:22:17 GMT
https://trac.sagemath.org/ticket/9774#comment:117
https://trac.sagemath.org/ticket/9774#comment:117
<p>
Do you by chance see who changed it? If it was me, I don't recall the motivation. So +1 to making sure things work.
</p>
TicketnovoseltWed, 19 Sep 2012 16:31:32 GMT
https://trac.sagemath.org/ticket/9774#comment:118
https://trac.sagemath.org/ticket/9774#comment:118
<p>
It is in the jumbo patch to Sage library uploaded by Keshav, I guess it is a flattening of others. Most of it was automatic, I imagine, but this part is definitely made by hand.
</p>
TicketkiniThu, 20 Sep 2012 13:40:56 GMT
https://trac.sagemath.org/ticket/9774#comment:119
https://trac.sagemath.org/ticket/9774#comment:119
<p>
Another reason why we shouldn't flatten patches...
</p>
TicketnovoseltFri, 29 Mar 2013 17:31:31 GMT
https://trac.sagemath.org/ticket/9774#comment:120
https://trac.sagemath.org/ticket/9774#comment:120
<p>
<a class="closed ticket" href="https://trac.sagemath.org/ticket/14382" title="defect: Fix LaTeXing of strings (closed: fixed)">#14382</a> finally reverts the change, sorry for delay.
</p>
Ticket