## Re: [Docutils-develop] Configuring MathJax URL

 Re: [Docutils-develop] Configuring MathJax URL From: Guenter Milde - 2012-10-18 11:19:17 On 2012-10-16, Dmitry Shachnev wrote: > Guenter Milde users.sf.net> writes: >> > You are right, it is not as bad as I thought of it. But handling some common >> > things such as \sum_{…}^{…} or \int_{…}^{…} is still broken… >> Could you elaborate? The example file >> docutils/test/functional/expected/math_output_html.html >> shows that some tweaking of the size of the sum/integral sign and the >> indices is required (is is reasonably well inside the fraction in the >> "modulation transfer function"). > Well, compare > http://mandriver.users.sourceforge.net/files/retext-math-html.png and > http://mandriver.users.sourceforge.net/files/retext-math-mathjax.png … Comparing this I can just re-state the comments above - I would not call this "broken" but suboptimal. >> Display of math-output=html requires math fonts, which should become a >> suggestion of the Debian python-docutils package... > Which package are those fonts in? I do have fonts-stix installed, > but it seems that's not what you mean. > I can't find any special fonts mentions in the CSS file either. Sorry for not beeing clear: with "math font" in this context I mean a Unicode-encoded font that contains the required mathematical symbols. Some examples are Asana-Math, STIX, DejaVu (to a large extend), Cambria or the Mathematica fonts. Günter 

 [Docutils-develop] Configuring MathJax URL From: Dmitry Shachnev - 2012-09-08 13:22:46 Attachments: signature.asc [ I'm not subscribed to this list, so please CC me when you reply. ] Hi everybody! I've written a small patch that adds an ability to configure URL of MathJax JS file. The configuration is done by appending the URL to value of "math_output" setting. When nothing is appended, the default URL is used. The "MathJax" word (which can be lowercase) and the URL can be separated by a space or any other character. Having such an option will make it possible to view docutils-generated HTML files without an internet connection. Examples: 1. math_output = MathJax file:///usr/share/javascript/mathjax/MathJax.js 2. math_output = MathJax,https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js My patch can be found at: http://sourceforge.net/tracker/index.php?func=detail&aid=3540052&group_id=38414&atid=422030. See also http://bugs.debian.org/677929 for the corresponding bug report in Debian. Can you please apply my patch or let me know if there's something wrong with it? Cheers, -- Dmitry Shachnev 
 Re: [Docutils-develop] Configuring MathJax URL From: Guenter Milde - 2012-09-21 14:02:16 On 2012-09-08, Dmitry Shachnev wrote: Hi everybody! > I've written a small patch that adds an ability to configure URL of > MathJax JS file. The configuration is done by appending the URL to value > of "math_output" setting. When nothing is appended, the default URL is > used. The "MathJax" word (which can be lowercase) and the URL can be > separated by a space or any other character. ... > My patch can be found at: > http://sourceforge.net/tracker/index.php?func=detail&aid=3540052&group_id=38414&atid=422030. Thanks for the patch and sorry for taking so long. I have some problems with the patch as it is now: 1. I opt for whitespace as separator between keyword and mathjax-URL: * dropping one character between the keyword and the mathjax URL is error prone (how about two spaces?) and without precedence. * a comma separates list values (class arguments, stylesheets) in other options. It might be used for a list of math-output formats later (e.g. fallbacks to try when an error occurs) and should therefore not be used within one output format specifier. * if given on the command line, the argument can be quoted like --math-output="mathjax myURL". 2. The configuration part of the URL (?config=TeX-AMS-MML_HTMLorMML) should not be hardcoded but part of the configurable URL. (See the mathjax homepage for the many options that users may want to specify.) 3. There should be a test case. I will add support for a configurable mathjax-URL when time permits. > See also http://bugs.debian.org/677929 for the corresponding bug report > in Debian. My preference for solving this bug is changing the default math-output of the html4css1 writer to HTML+CSS. My question how to handle the required math.css style sheet still waits for a comment from co-developers. If noone responds, I may end up implementing automatic loading of the stylesheet if there is math content with the option to add an alternative stylesheet URL to the math-output option (similar to the mathjax-URL). Günter 
 Re: [Docutils-develop] Configuring MathJax URL From: Dmitry Shachnev - 2012-10-10 16:15:08 Guenter Milde users.sf.net> writes: > Thanks for the patch and sorry for taking so long. > > I have some problems with the patch as it is now: > > 1. I opt for whitespace as separator between keyword and mathjax-URL: > > 2. The configuration part of the URL (?config=TeX-AMS-MML_HTMLorMML) > should not be hardcoded but part of the configurable URL. (See the > mathjax homepage for the many options that users may want to specify.) > > 3. There should be a test case. Hi Guenter, I didn't receive your reply in time (did you CC me?), but I managed to find your reply in the list archives. Updated patches are now attached to the bug report. I am not sure if I've put the test case to a correct file (test/test_writers/test_html4css1_misc.py), so I've split it to a separate patch so that you could change it. > > See also http://bugs.debian.org/677929 for the corresponding bug report > > in Debian. > > My preference for solving this bug is changing the default math-output of > the html4css1 writer to HTML+CSS. My question how to handle the required > math.css style sheet still waits for a comment from co-developers. HTML+CSS supports 0% of what MathJax supports — doesn't it? — and I think we shouldn't break users who think "My formulas will work everywhere out of the box". > If noone responds, I may end up implementing automatic loading of the > stylesheet if there is math content with the option to add an alternative > stylesheet URL to the math-output option (similar to the mathjax-URL). +1 to this idea, though. -- Dmitry Shachnev 
 Re: [Docutils-develop] Configuring MathJax URL From: Guenter Milde - 2012-10-11 22:23:07 Dear Dmitry, On 2012-10-10, Dmitry Shachnev wrote: > Guenter Milde users.sf.net> writes: >> 1. I opt for whitespace as separator between keyword and mathjax-URL: >> 2. The configuration part of the URL (?config=TeX-AMS-MML_HTMLorMML) >> should not be hardcoded but part of the configurable URL. (See the >> mathjax homepage for the many options that users may want to specify.) >> 3. There should be a test case. ... > Updated patches are now attached to the bug report. I am not sure if > I've put the test case to a correct file > (test/test_writers/test_html4css1_misc.py), so I've split it to a > separate patch so that you could change it. Thanks for your patches, I'll have a look when time permits. >> > See also http://bugs.debian.org/677929 for the corresponding bug report >> > in Debian. >> My preference for solving this bug is changing the default math-output of >> the html4css1 writer to HTML+CSS. My question how to handle the required >> math.css style sheet still waits for a comment from co-developers. > HTML+CSS supports 0% of what MathJax supports — doesn't it? — and I think we > shouldn't break users who think "My formulas will work everywhere out of the > box". HTML+CSS supports 90% of the LaTeX-Math MathJax supports (but without specials like downloading web-fonts etc.) HTML+CSS works out of the box everywhere -- also without internet connection or a local MathJax installation. HTML+CSS does not need JavaScript - so you can keep safe browser settings. HTML+CSS does not download scripts from somewhere over the net - which the abovementioned Debian bug calls a grave security breach. >> If noone responds, I may end up implementing automatic loading of the >> stylesheet if there is math content with the option to add an alternative >> stylesheet URL to the math-output option (similar to the mathjax-URL). > +1 to this idea, though. Günter 
 Re: [Docutils-develop] Configuring MathJax URL From: Dmitry Shachnev - 2012-10-15 08:45:43 Guenter Milde users.sf.net> writes: > HTML+CSS supports 90% of the LaTeX-Math MathJax supports (but without > specials like downloading web-fonts etc.) > > HTML+CSS works out of the box everywhere -- also without internet connection > or a local MathJax installation. > > HTML+CSS does not need JavaScript - so you can keep safe browser settings. > > HTML+CSS does not download scripts from somewhere over the net - which the > abovementioned Debian bug calls a grave security breach. > > Günter You are right, it is not as bad as I thought of it. But handling some common things such as \sum_{…}^{…} or \int_{…}^{…} is still broken… Also, the CSS file isn't installed during setup.py build+install. It's also missing from the Debian package. You may want to apply this: --- a/docutils/setup.py +++ b/docutils/setup.py @@ -147,6 +147,7 @@ what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60 glob.glob('docutils/parsers/rst/include/*.txt')), ('docutils/writers/html4css1', ['docutils/writers/html4css1/html4css1.css', + 'docutils/writers/html4css1/math.css', 'docutils/writers/html4css1/template.txt']), ('docutils/writers/latex2e', ['docutils/writers/latex2e/default.tex', Cheers, -- Dmitry Shachnev 
 Re: [Docutils-develop] Configuring MathJax URL From: Guenter Milde - 2012-10-15 12:21:32 On 2012-10-15, Dmitry Shachnev wrote: > Guenter Milde users.sf.net> writes: >> HTML+CSS supports 90% of the LaTeX-Math MathJax supports (but without >> specials like downloading web-fonts etc.) >> HTML+CSS works out of the box everywhere -- also without internet connection >> or a local MathJax installation. >> HTML+CSS does not need JavaScript - so you can keep safe browser settings. >> HTML+CSS does not download scripts from somewhere over the net - which the >> abovementioned Debian bug calls a grave security breach. >> Günter > You are right, it is not as bad as I thought of it. But handling some common > things such as \sum_{…}^{…} or \int_{…}^{…} is still broken… Could you elaborate? The example file docutils/test/functional/expected/math_output_html.html shows that some tweaking of the size of the sum/integral sign and the indices is required (is is reasonably well inside the fraction in the "modulation transfer function"). Display of math-output=html requires math fonts, which should become a suggestion of the Debian python-docutils package... > Also, the CSS file isn't installed during setup.py build+install. It's also > missing from the Debian package. You may want to apply this: > --- a/docutils/setup.py > +++ b/docutils/setup.py > @@ -147,6 +147,7 @@ what-you-see-is-what-you-get plaintext markup syntax.""", # > wrap at col 60 > glob.glob('docutils/parsers/rst/include/*.txt')), > ('docutils/writers/html4css1', > ['docutils/writers/html4css1/html4css1.css', > + 'docutils/writers/html4css1/math.css', > 'docutils/writers/html4css1/template.txt']), > ('docutils/writers/latex2e', > ['docutils/writers/latex2e/default.tex', Done, thanks for the patch. Günter 
 Re: [Docutils-develop] Configuring MathJax URL From: Dmitry Shachnev - 2012-10-16 17:31:03 Guenter Milde users.sf.net> writes: > > You are right, it is not as bad as I thought of it. But handling some common > > things such as \sum_{…}^{…} or \int_{…}^{…} is still broken… > > Could you elaborate? The example file > docutils/test/functional/expected/math_output_html.html > shows that some tweaking of the size of the sum/integral sign and the > indices is required (is is reasonably well inside the fraction in the > "modulation transfer function"). Well, compare http://mandriver.users.sourceforge.net/files/retext-math-html.png and http://mandriver.users.sourceforge.net/files/retext-math-mathjax.png … > Display of math-output=html requires math fonts, which should become a > suggestion of the Debian python-docutils package... Which package are those fonts in? I do have fonts-stix installed, but it seems that's not what you mean. I can't find any special fonts mentions in the CSS file either. -- Dmitry Shachnev 
 Re: [Docutils-develop] Configuring MathJax URL From: Guenter Milde - 2012-10-18 11:19:17 On 2012-10-16, Dmitry Shachnev wrote: > Guenter Milde users.sf.net> writes: >> > You are right, it is not as bad as I thought of it. But handling some common >> > things such as \sum_{…}^{…} or \int_{…}^{…} is still broken… >> Could you elaborate? The example file >> docutils/test/functional/expected/math_output_html.html >> shows that some tweaking of the size of the sum/integral sign and the >> indices is required (is is reasonably well inside the fraction in the >> "modulation transfer function"). > Well, compare > http://mandriver.users.sourceforge.net/files/retext-math-html.png and > http://mandriver.users.sourceforge.net/files/retext-math-mathjax.png … Comparing this I can just re-state the comments above - I would not call this "broken" but suboptimal. >> Display of math-output=html requires math fonts, which should become a >> suggestion of the Debian python-docutils package... > Which package are those fonts in? I do have fonts-stix installed, > but it seems that's not what you mean. > I can't find any special fonts mentions in the CSS file either. Sorry for not beeing clear: with "math font" in this context I mean a Unicode-encoded font that contains the required mathematical symbols. Some examples are Asana-Math, STIX, DejaVu (to a large extend), Cambria or the Mathematica fonts. Günter