I am writing to ask for some ideas as to why the equation numbering is
not working for ipython (ipython.org). I am using its notebook
interface to do symbolic computations using sympy (sympy.org). There
are code cells and Markdown cells, among others. The Markdown cells
can contain LaTeX and I use that a lot in my current work. Ipython
has been using MathJax for a while now and it worked fine with version
1.1. Now that version 2.0 is officially up it uses that, as is easy to
verify by right-clicking on a rendered equation. However, I can not
get it to render equation numbers. I can, however, get it to display
equation numbers using \tag{}. Also I can get it to correctly
display a colored bounding box of desired width. I am wondering why
equation numbering is not currently working?
To this end, I have tried the following:
1. I modified a file notebookmain.js and added a line to supposedly
promote the equation numbering to work. Here is a code snippet without
the change and then with the change I cribbed from the MathJax
documentation:
current javascript code without change:
$(document).ready(function () {
if (window.MathJax){
// MathJax loaded
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
},
displayAlign: 'left', // Change this to 'center' to center
equations.
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 0}}
}
});
changed above js code to add equation numbering:
$(document).ready(function () {
if (window.MathJax){
// MathJax loaded
MathJax.Hub.Config({
MathJax.Hub.Config({
----> TeX: { equationNumbers: { autoNumber: "AMS" } }, <--- added
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
},
displayAlign: 'left', // Change this to 'center' to center
equations.
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 0}}
}
});
When I do this change and reinstall ipython and clean out the Chrome
cache, restart Chrome, then run ipython and try to get an existing
notebook to display on my laptop (mac with lion), _no_ notebooks
display at all. Removing the indicated line and reinstalling gives me
back the same notebooks as before the change. According to what I can
glean thus far from the code this is the right place to make changes,
but alas the result is disastrous. So I must be making an error.
Can you please suggest some things to try? Note that this is a dynamic
environment without fixed html docs that I simply display. One can
build new notebooks and run python scripts and get graphics and
symbolic mathematics out. So, I can not add some code segment to a
static web page that would encourage MathJax to do automatic equation
numbering.
Thanks very much for your help.
Comer
$(document).ready(function () {
if (window.MathJax){
// MathJax loaded
MathJax.Hub.Config({
MathJax.Hub.Config({
----> TeX: { equationNumbers: { autoNumber: "AMS" } }, <--- added
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
},
displayAlign: 'left', // Change this to 'center' to center
equations.
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 0}}
}
});
Thanks for the reply.
Yeah, that was a typo. I removed that and reinstalled. No equation
numbering. I am attaching the html page so you can see what it
actually ended up producing. Can you please take a look and let me
know what you think?
Thanks.
Comer
d>
<meta charset="utf-8">
<title>IPython Notebook</title>
<script type="text/javascript" src="/static/mathjax/MathJax.js?
config=TeX-AMS_HTML" charset="utf-8"></script>
I assume there is "<html><hea" in front of that.
But I don't see your configuration section, or the code you list
below. Where is that included? The only MathJax calls I see is the
one quoted above that loads MathJax with the standard TeX-AMS_HTML
configuration. I seem to be missing something.
Davide
> <generatedhtml>
Davide
> <newgeneratedhtml>
> OK, this looks like a complete file, but I still don't see where the MathJax
> configuration is performed. It is not in the HTML file. Perhaps it is in
> one of the loaded .js files (and there are quite a few of them). Without
> that, I can't really tell what might be wrong. Can you send whatever JS
> files have to do with MathJax?
>
The ipython developers indicate that the code is BSD license, so I am
ok to send you the js files for the ipython notebook. I am attaching
a tz file containing the javascript files.
I note that in the html file I sent (the complete one), there are a
couple of things there which I don't understand. Near the top of the
file one sees the MathJax stuff. Here is the relevant fragment.
<script type="text/javascript"
src="/static/mathjax/MathJax.js?config=TeX-AMS_HTML"
charset="utf-8"></script>
<script type="text/javascript">
// MathJax disabled, set as null to distingish from *missing* MathJax
// where it will be undefined, and should prompt a dialog later.
window.mathjax_url = "/static/mathjax/MathJax.js";
Note that the prose indicates the word 'missing'. And the
window.mathjax_url is set to a file which is in the static/mathjax
dir. So, is it the case that the cdn mathjax is never accessed and the
local version is being used? Now,
This morning the equation numbering seems to work. Go figure. I will
experiment more and see if other new features work too.
I don't understand what is new.
Thanks for your help.
Comer
On Sat, Mar 3, 2012 at 8:53 AM, Davide P. Cervone <dp...@union.edu> wrote:
> My short tenure with Design Sciences has ended so please remove this email
> address for MathJax related items.
>
>
> I regret we did not have the opportunity to meet. Perhaps we will get that
> opportunity another time.
>
>
> Sorry to hear that you are leaving us, and that I never got to meet you. I
> hope it is that you found something even better rather than something drove
> you away.
>
> I have removed you from the MathJax-users mailing list. You don't seem to
> be on the MathJax-dev list. Those are the only two I manage. You will have
> to ask DSI to remove you from MathJax Plus. I don't have you on any private
> mailing lists of my own, so that is the extent of what I can do.
>
> Best of luck.
>
> Davide
is it the case that the cdn mathjax is never accessed and the
local version is being used?
Best regards,
Fr�d�ric
On 03/03/2012 01:25, Robert Ross wrote:
> Hi Davide:
>
> My short tenure with Design Sciences has ended so please remove this email address for MathJax related items.
>
> I regret we did not have the opportunity to meet. Perhaps we will get that opportunity another time.
>
> Sincerely
>
> Bob Ross
>