Community Wishlist Survey 2022/Multimedia and Commons/Improve LaTeX rendering

Improve LaTeX rendering

  • Problem: The current system for displaying mathematical formulas is very unsatisfactory. The formulas are converted into images in which the text appears in black on a transparent background, and then inserted into the text. For this reason, mathematical formulas in some extent clash with the surrounding text:
    • Most important : sometimes punctuation signs are rejected on the next line when the formula is at the end of the line (cf. this page, in the second paragraph, or the next one, first line).
    • formulas are always black, whatever the color of the surrounding text (see this page, the note);
    • the alignment of the mathematical text on the line is not perfect;
    • less important, the font differs from the ambient font and does not have exactly the same size.
I would therefore like to see the formulas rendered in a more coherent manner with the surrounding text, and above all in such a way as not to violate the most basic rules of typography.
  • Proposed solution: MathJax for example?
  • Who would benefit: All readers of scientific articles on Wikipedia/scientific texts on Wikisource or Wikibooks.
  • More comments: Please note that the request does not concern the input of mathematics by contributors, but only their display.
  • Phabricator tickets:
  • Proposer: ElioPrrl (talk) 10:57, 11 January 2022 (UTC)Reply[reply]


  • We already use mathjax, just rendered to images (Because mathjax is hugely expensive JS to load). —TheDJ (talkcontribs) 10:52, 13 January 2022 (UTC)Reply[reply]
So my suggested solution may be discarded, but this does not make the problem (and especially the problem of punctuation) go away. — ElioPrrl (talk) 11:38, 14 January 2022 (UTC)Reply[reply]
For the most part, I'm fine with the current SVG rendering, but having at least the option to use others may still be a good implementation. For example, the blog Algorithm Archive uses mathjax as well, and allows changing the rendering very easily (right click the formulas). 01:23, 31 January 2022 (UTC)Reply[reply]
  • It is not true that "formulas are always black": There is a {color} feature. Maybe the description of LaTeX is unsatisfactory.
I mean: the color does not change automatically depending on the ambient text. — ElioPrrl (talk) 18:39, 5 February 2022 (UTC)Reply[reply]
  • The alignment of the mathematical text can be forced to be perfect. Maybe the description of LaTeX is too complicated and unsatisfactory. -Nomen4Omen (talk) 16:06, 4 February 2022 (UTC)Reply[reply]
  • I'm not sure if the mismatch between text and formulas is bothersome for many readers: it gives contrast, it may help to skim through. But I think your point was implicitly that gross or slight imperfections jump out even more starkly – to the point of tiring the eye – because of this somewhat strong contrast. Concerning those imperfections:
    • The fact that a punctation sign immediately following a formula can go dangling around as the first character on the next line after break is a must fix! The only usable workaround today is to force the punctation in the formula, and since the punctation does not belong to the formula but to the surrounding sentence, it creates a typographic aberration (not to mention the semantic aspect). Maybe the formula processor could simply "eat" punctation signs and put them in a wrapper element with some CSS to prevent line-breaks?
    • the same way there is an option <math display=inline>, there could be an option <math color=inherit>, and every wiki could choose its prefered default value?
    • the baseline alignment? I guess there is/could be tweaking of configuration of the math renderer at every wiki. I'm certain there is an interaction with the CSS. For example if you paste the same text and formulas between and, you'll see a snappier baseline at en.
    • concerning the sizing, if it's not tweakable in the configuration of each wiki, it means every wiki must retrofit its (text) css to match with the math renderer! Trlit (talk) 03:31, 9 February 2022 (UTC)Reply[reply]
  • Support (didn't know voting ends at 18 UTC): We should start using KaTeX or MathJax already. w:user:Esquivalience/mathjax.js is a good start. ~~~~
    User:1234qwer1234qwer4 (talk)
    18:38, 11 February 2022 (UTC)Reply[reply]