Last modified: 2013-07-25 07:03:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37188, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35188 - Determine block mode vs. inline mode properly for MathJax
Determine block mode vs. inline mode properly for MathJax
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Math (Other open bugs)
unspecified
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
http://leuksman.com/mw/index.php/Bloc...
:
: 36062 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-13 09:04 UTC by Michael M.
Modified: 2013-07-25 07:03 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
the png version (1.19 KB, image/png)
2012-03-25 20:14 UTC, Derk-Jan Hartman
Details
the mathjax version (8.65 KB, image/png)
2012-03-25 20:15 UTC, Derk-Jan Hartman
Details

Description Michael M. 2012-03-13 09:04:23 UTC
In all these formulas

\bigwedge_x
\bigvee_x
\sum_{0\le i\le m\atop 0<j<n}P(i,j)

the PNG shows the subscript below the symbol, while MathJax puts them in the lower left corner. Consistency would be nice, but not necessary.
Comment 1 Michael M. 2012-03-14 08:54:25 UTC
s/lower left/lower right/
Comment 2 Derk-Jan Hartman 2012-03-25 20:14:23 UTC
Created attachment 10325 [details]
the png version
Comment 3 Derk-Jan Hartman 2012-03-25 20:15:13 UTC
Created attachment 10326 [details]
the mathjax version

They look similar to me. What browser and version do you have, might be browser specific issue ?
Comment 4 Michael M. 2012-03-26 08:54:48 UTC
I found out where the problem is:

While texvc renders every formula in block mode ($$), MathJax is able to render both for block mode and inline mode ($). But the configuration for this in MathJax/extensions/wiki2jax.js is not ideal. Have a look at the ConvertMath function. Block mode is only chosen for formulas directly inside a <DD> with only one child, i. e. when a formula is indented using colons. This will fail when formulas are wrapped inside a span (see bug 35191). Furthermore formulas which form there own paragraph should be treated as block, too. Currently there is some code to insert \displaystyle etc. to do this.

I created a test page on http://leuksman.com/mw/index.php/Block_vs._inline. This shows that it actually looks as expected, but a cleaner code would be nice.

Perhaps some code like

if ( $formula.closest( 'p, div, dd' ).text() === $formula.text() ) {
	//$$-mode
} else {
	//$-mode
}

works, but I didn't test this.
Comment 5 Derk-Jan Hartman 2012-03-26 19:24:26 UTC
Nageh said something about this that is relevant when he detailed his changes: https://en.wikipedia.org/wiki/User_talk:Nageh#MathJax_integration_into_stock_MediaWiki

Heuristic detection of inline vs. display maths. Heuristic used: parent HTML element is "DD" and maths element is the only child, then interpret as "display maths", otherwise as "inline maths". Also, if the maths element is classified as "inline maths" but the element is the first child in the parent "DD", precede the maths with "\displaystyle": this effectively treats the maths as a display-style formula but without the newline of ordinary display maths formulas. See ConvertMath() function in User:Nageh/mathJax/config/TeX-AMS-texvc_HTML.js.
Comment 6 Michael M. 2012-04-18 09:54:40 UTC
*** Bug 36062 has been marked as a duplicate of this bug. ***
Comment 7 Michael M. 2012-04-18 09:57:52 UTC
From bug 36062:
The added \displaystyle also appears on [right click]-Show Math As-TeX Commands, which might be confusing for users.
Comment 9 Derk-Jan Hartman 2012-09-07 15:02:43 UTC
https://gerrit.wikimedia.org/r/23079

I've not done the oiint part yet, we will have to add that later.
Comment 10 Gerrit Notification Bot 2013-04-27 19:19:49 UTC
https://gerrit.wikimedia.org/r/23079 (Gerrit Change Ie0c308c31d38581e556dc73109879c7a3d365121) | change APPROVED and MERGED [by jenkins-bot]
Comment 11 Andre Klapper 2013-05-14 09:24:41 UTC
Gerrit patch got merged, can this bug report get closed as RESOLVED FIXED or is there anything else to do?
Comment 12 Michael M. 2013-05-15 07:41:43 UTC
Tested with

Formula <math>\bigwedge_x</math> in text.

Here comes a formula:

<math>\bigwedge_x</math>

Here comes an indented formula:

:<math>\bigwedge_x</math>


Everything looks as it should.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links