This site is supported by donations to The OEIS Foundation.

Talk:Features Wishlist

From OeisWiki
Jump to: navigation, search

Main Site (sequences)

(...)

OEIS Wiki

Using MathJax

Cf. #Using LaTeX throughout to get consistent rendering of mathematical content (next section). — Daniel Forgues 03:50, 29 July 2012 (UTC)

For examples of how nice MathJax's generated HTML-CSS (from the LaTeX code) looks in your browser (unfortunately, after an admittedly horribly long Flash Of Unstyled Content, see (you may also set "Math Settings > Math Renderer" to SVG or MathML and see how your browser renders it)

Daniel Forgues 02:12, 11 August 2012 (UTC)

Using LaTeX throughout to get consistent rendering of mathematical content

In the following example n is rendered via HTML and doesn't render like the in

where is the number of distinct prime factors of n and is the th prime.

so I use those clumsy ​<math>\scriptstyle n \,</math>​ which gets the OEIS server to create all those little PNG bitmap images, and this slows down the download and rendering of the page... Furthermore, those little images most often don't align properly (in inline style) with the surrounding HTML text ... Which brings me to...

The suggestion that we use MathJax (cf. MathJax) which allows the use of LaTeX which is then converted into HTML-CSS, MathML or SVG vector images. Have a look at how nice it renders (and how well it aligns in inline style) on

http://www.scholarpedia.org/article/Scaling_laws

where you may verify that the page uses LaTeX by looking at the source

http://www.scholarpedia.org/w/index.php?title=Scaling_laws&action=edit

Daniel Forgues 05:19, 25 July 2012 (UTC) (updated — Daniel Forgues 02:50, 11 August 2012 (UTC))

Of course there's no perfect solution; <math>\scriptstyle \omega(n)\,</math> clutters up the source, doesn't align well, and has the wrong size/weight. ''n'' introduces a font mismatch with the formulas. MathJax has the mother-of-all-FOUCs, loads very slowly, and doesn't work on all browsers. But it may be worth bringing up on SeqFan once Russ gets back. Charles R Greathouse IV 05:44, 25 July 2012 (UTC)
I copied my above comment to Talk:Typesetting systems#Using LaTeX throughout to get consistent rendering of mathematical content, especially with MathJax, where it is a more appropriate location for the topic. I also sent an email to Neil Sloane about using MathJax. — Daniel Forgues 05:52, 25 July 2012 (UTC)
I just noticed the Flash of unstyled content (FOUC) that you mention: annoying, I admit. That's unfortunate, because it looks good after (1/2 second pause...) its rendered. I also thought it would load faster than all those little PNGs... It might not be such a good idea after all... — Daniel Forgues 06:00, 25 July 2012 (UTC)
I like MathJax, but I'm not sure if I like it better. The rendering time is more like 1.5 seconds for me, not sure why it's so fast for you. But because the PNGs can be spaced out even before they're loaded, and the MathJax LaTeX can't, it's much more disruptive regardless of loading time. But it *does* look better once loaded, I think.
I don't have a strong preference about where we have this discussion as long as it's just in one place. I think both Talk pages are 'wrong' places, technically, because this isn't about either article, even if it is related to the subject of one.
Edit: Sorry about the moving around of the discussion; looks like I caused just the problem I was looking to avoid.
Charles R Greathouse IV 06:14, 25 July 2012 (UTC)
I guess the rendering time depends on how many equations needs to be rendered, so lots of equations on a page might be quite disruptive...
I added a link on Talk:Typesetting systems pointing to here (for the discussion about MathJax). What would be the best location for this discussion? — Daniel Forgues 06:23, 25 July 2012 (UTC)
I don't know, a subpage of Features Wishlist maybe? Charles R Greathouse IV 18:05, 25 July 2012 (UTC)
With MathJax, the option of rendering to SVG vector images would make the formulas render optimally from smallest screens (e.g. smartphones) to largest screens (e.g. projectors). Not that I would want to edit wiki pages from my Android phone... — Daniel Forgues 03:35, 29 July 2012 (UTC)
I sent an email to Neil Sloane and David Applegate citing the pros and cons of using MathJax. — Daniel Forgues 04:32, 29 July 2012 (UTC)
Since we have wiki pages with lots, I mean LOTS, of formulas, the Flash of unstyled content (FOUC) might be unacceptable, I am afraid... — Daniel Forgues 04:35, 29 July 2012 (UTC)
For more examples of sites using MathJax, see #Using MathJax. — Daniel Forgues 02:50, 11 August 2012 (UTC)
Back to the original question, I think it is not a good idea to add \scriptstyle in front all math formulas, nor to enforce the image rendering by appending \,. There is an option in the Preferences allowing each user to choose this or not, and this option is there on purpose. If I prefer HTML whenever possible, I claim the right to get that! If it is desired that image rendering be the default, I'm sure this can be set in the config of the server. But it should not be imposed in each formula. Same for the \scriptstyle: it may depend on your personal browser and its settings whether the sizes match. Putting \scriptstyle is not the way to fix this problem, this actually breaks things where (or: in case) they (would) work as expected -- certainly not the thing to do! — M. F. Hasler 22:22, 13 January 2013 (UTC)
I happen to think that \scriptstyle is ugly as rendered here (and on Wikipedia), but there's room for discussion on that point. On the other hand adding \, to formulas for the purpose of overriding user's preferences is not acceptable, and all instances should be removed. Users preferring blahtex rendering should set their preferences accordingly. Charles R Greathouse IV 22:44, 13 January 2013 (UTC)

Comparing with/without \scriptstyle and \,

Using \scriptstyle for inline TEX rendering
and \, to force PNG rendering and/or for proper spacing of inline TEX rendering, e.g. (taken from perfect numbers)


A <math>\scriptstyle k \,</math>-'''perfect number''' is an integer <math>\scriptstyle n \,</math> such that its [[sum of divisors]] is <math>\scriptstyle kn,\, k \,\ge\, 1,\, k \,\in\, \N, \,</math> i.e. 

:<math>\sigma_1(n) \equiv \sum_{i=1}^{\sigma_0(n)} d(i) = \sum_{\stackrel{i=1}{i | n}}^{n} i = \sum_{i=1}^{n} [n \,\bmod\, i = 0] \cdot i = k n, k \ge 1, k \in \N, \,</math>

where <math>\scriptstyle d(i) \,</math> is the <math>\scriptstyle i \,</math>{{^|th}} [[Divisors|divisor]] of <math>\scriptstyle n \,</math>, <math>\scriptstyle \sigma_0(n) \,=\, \tau(n) \,</math> is the [[number of divisors]] of <math>\scriptstyle n \,</math>, <math>\scriptstyle \sigma_1(n) \,=\, \sigma(n) \,</math> is the [[sum of divisors]] of <math>\scriptstyle n \,</math> and <math>\scriptstyle [ \cdot ] \,</math> is the [[Iverson bracket]].

we get

A -perfect number is an integer such that its sum of divisors is i.e.

where is the  th divisor of , is the number of divisors of , is the sum of divisors of and is the Iverson bracket.




NOT using \scriptstyle for inline TEX rendering
and NOT using \, to force PNG rendering and/or for proper spacing of inline TEX rendering, e.g. (taken from perfect numbers, but now edited for this test)


A <math>k</math>-'''perfect number''' is an integer <math>n</math> such that its [[sum of divisors]] is <math>kn, k \ge 1, k \in \N,</math> i.e. 

:<math>\sigma_1(n) \equiv \sum_{i=1}^{\sigma_0(n)} d(i) = \sum_{\stackrel{i=1}{i | n}}^{n} i = \sum_{i=1}^{n} [n \,\bmod\, i = 0] \cdot i = k n, k \ge 1, k \in \N,</math>

where <math>d(i)</math> is the <math>i</math>{{^|th}} [[Divisors|divisor]] of <math>n</math>, <math>\sigma_0(n) = \tau(n)</math> is the [[number of divisors]] of <math>n</math>, <math>\sigma_1(n) = \sigma(n)</math> is the [[sum of divisors]] of <math>n</math> and <math>[ \cdot ]</math> is the [[Iverson bracket]].

we get

A -perfect number is an integer such that its sum of divisors is i.e.

where is the  th divisor of , is the number of divisors of , is the sum of divisors of and is the Iverson bracket.




Using Math preferences (with \scriptstyle and \,)

  • Always render PNG: inline as inline style PNG, display style as display style PNG (with proper spacing, looks good to me)
  • HTML if very simple or else PNG: inline as inline style PNG, display style as display style PNG (with proper spacing, looks good to me)
  • HTML if possible or else PNG: inline as inline style PNG, display style as display style PNG (with proper spacing, looks good to me)
  • Leave it as TeX (for text browsers): for MathJax (or jsMath, predecessor of MathJax)
  • Recommended for modern browsers: inline as inline style PNG, display style as display style PNG (with proper spacing, looks good to me)
  • MathML if possible (experimental): inline as inline style PNG, display style as display style PNG (with proper spacing, looks good to me)


Using Math preferences (without \scriptstyle and \,)

  • Always render PNG: oops, all the inline TEX is rendered in display style PNG
  • HTML if very simple or else PNG: oops, the inline TEX is rendered as a mixture of HTML and display style PNG
  • HTML if possible or else PNG: most inline TEX is rendered as HTML (oops, look at lack of spacing of some HTML)
  • Leave it as TeX (for text browsers): for MathJax (or jsMath, predecessor of MathJax)
  • Recommended for modern browsers: oops, the inline TEX is rendered as a mixture of HTML and display style PNG
  • MathML if possible (experimental): oops, the inline TEX is rendered as a mixture of HTML and display style PNG


Test done with:

Build identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.5) Gecko/20100101 Firefox/10.0.5

For all the Math preferences, things look better for me, as described above. It seems that might not be the case for everybody? — Daniel Forgues 03:48, 19 January 2013 (UTC)

You prefer png output, so you consider rendering png when the user specifically requests HTML a benefit. I strongly disagree: if the user requests HTML we should follow the request whenever possible. Ditto for MathML.
As it happens I hate MathML and tend to prefer the fake-TeX to the HTML output, so our preferences aren't really that far apart (though I very much dislike the \scriptstyle as rendered here, though true TeX does a lovely job). But that does not mean we should override user preferences, especially since we have had some users complain that they have set HTML in their preferences only to have it ignored...!
Charles R Greathouse IV 05:34, 19 January 2013 (UTC)
To get inline style with proper size and spacing we would need to use \textstyle, but it renders as display style for some reason (must be a bug?), so I've been using \scriptstyle instead to get proper size and manually corrected the spacings with \, all over. But using any of these forces PNG rendering. So you want me to never use \scriptstyle or \, and I won't use it ever again. Then it seems that the best possible "Math preferences" setting is "Always render PNG," and this will unfortunately give display style everywhere, including for inline style since \scriptstyle cannot be used (it forces PNG rendering). This doesn't look that good either, since it renders too big for inline style, but at least this way I don't get to see a mixture of HTML and display style PNGs (when TEX to HTML is not possible...) for inline formulae.
It's unfortunate that MathJax has the flash of unstyled content problem, since it looks so much better (after the annoying flash of unstyled content, that is).
I would like to know which Web browser you are using and also your Math preferences for OEIS Wiki. I should use the same then (I'm currently using Firefox 18.0.1 on either Windows 7 or Mac OS X Lion). — Daniel Forgues 23:19, 20 January 2013 (UTC)
Have a look at the unsightly "typeset" column of the table in How to write math on a typewriter... (I'm quickly switching back to "Always render PNG"!) — Daniel Forgues 23:50, 20 January 2013 (UTC)