Page MenuHomePhabricator

Allow distinction between inline and display math
Closed, ResolvedPublic

Assigned To
None
Authored By
bzimport
Dec 6 2007, 9:43 PM
Referenced Files
F4334: PNG.png
Nov 21 2014, 9:56 PM
F4335: mathml.png
Nov 21 2014, 9:56 PM
F4332: math-modes.png
Nov 21 2014, 9:56 PM

Description

Author: psychomessiah

Description:
Hi,
I think that adding a tag for inline TeX expressions (like $...$) and reserving <math> for displayed expressions (like \[...\]) would be a good workaround for the known problems -- before we can use MathML.

In this way, the users would have a second, similar list of choices in their Math rendering Settings : one for each tag. By default, both would be set to « HTML if very simple », like now. But a user who has enough Unicode might want to set « HTML if possible » for inline TeX, and « Always PNG » for displayed TeX. « HTML if possible » still needs improvements, but it's better than nothing. I'll enter a bug for this too.

And please don't tell me « keep your breath for BlahTeX ». We all know that MathML isn't currently usable. And when it'll be, the distinction between inline and displayed will be useful too.

I've had this idea in response to the frequent lamentations on the french Wiki about mathematical typography, and it satisfied everyone in the mathematics project. Should I create a poll to show you the support ?

A french developer told me that if a developer implemented this in a patch, we could apply it only in the french Wiki. Perhaps is it simpler and quickier to implement it in a patch than into Mediawiki.

Thanks for your interest !


Version: unspecified
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=57437

Details

Reference
bz12223

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:56 PM
bzimport added a project: Math.
bzimport set Reference to bz12223.

Rather than a poll, an example showing what difference it makes might be useful. :)

psychomessiah wrote:

Consider :

Let <math>f:x \mapsto y</math> with
<center><math>y = \int_0^x g(t) dt</math></center>
we say that blablabla...

Currently, with the « HTML if simple » setting, the first expr. is rendered in PNG, which looks awful (bad alignment). But with the « HTML if possible » setting, the first expr. is rendered in HTML (good) but the second expr too, and that's even uglier (an array is used). It would be perfect if the first expr. is rendered in HTML and the second in PNG. Indeed, inline expressions are almost simple, but displayed expr. are generally more complicated and do not need to be perfectly aligned with the text. The two need a different rendering. Is it clearer ?

psychomessiah wrote:

Hey ! Is there someone ?

Created attachment 4449
Screen shots of example text in default, preferred HTML, and proposed mixed modes

Taken on Firefox 2/Mac.

Attached:

math-modes.png (417×683 px, 24 KB)

psychomessiah wrote:

Yes, it is exactly what I suggest !

psychomessiah wrote:

Three months without even an answer ! At least, tell me that you reject my idea !

Mediawiki developers are generally very busy, so non-urgent issues may receive not so much attention.

There are two ways you can work around that:

  • Code it up yourself (without looking deeply, what you want should be doable with an extension, without touching the MediaWiki core). If the extension works well and is simple enough, it has a much higher chance of being integrated.
  • Ask on IRC - maybe someone is interested in fixing the bug for you.

This blocks bug 35479, which would allow to optimize a bit the MathJax mode by dropping the preprocessing phase. Currently the wiki2jax preprocessor has heuristics to guess inline or display mode (with more or less success).

The LaTeXML mode does not have this preprocessing phase and directly outputs <script type="math/mml"> for MathJax. However, it does not distinguish between inline or display mode, which is a serious issue atm.

Since all the formulas are currently in inline mode, what should be done instead is to add something to distinguish display equations. So for example keep

<math>...</math>

for inline math and allow something like

<math display="block">...</math> or <displaymath>...</displaymath>

to specify display mode.

(Of course, that would mean that people will have to reedit all the Math pages to explicitly specify display equations)

Change 84629 had a related patch set uploaded by Physikerwelt:
Displaystyle

https://gerrit.wikimedia.org/r/84629

physik wrote:

png-rendering with the proposed option display

Attached:

PNG.png (1×1 px, 124 KB)

physik wrote:

mathml-rendering with the proposed option display

Attached:

mathml.png (1×1 px, 104 KB)

physik wrote:

Request for comments:

I created a demo page concerning the issue.
http://math-test2.instance-proxy.wmflabs.org/w/index.php?title=Displaystyle

You can test it with Firefox in MathML mode. (The default behavior.)

If you want to test it in png mode you have to log in using the user

png

and the password

iLovePictures

MathJaX does not work at the moment, but will be once there is a agreement that the demopage looks like you want it to look like.

physik wrote:

I just realized that equations are not centred in PNG mode tested at
https://en.wikipedia.org/wiki/User:Physikerwelt/bug5600#foobar
The computed style-sheet

img.mwe-math-fallback-png-display {

display: block;

}

seems to be ok

physik wrote:

It seems that this would need an additional div block...
do we want that?