W3C home > Mailing lists > Public > www-math@w3.org > August 2012

alignment of scripts in mmultiscripts

From: David Carlisle <davidc@nag.co.uk>
Date: Wed, 22 Aug 2012 00:48:49 +0100
Message-ID: <50341E61.2070105@nag.co.uk>
To: "'www-math@w3.org'" <www-math@w3.org>

Recently Alexander Krutik asked an interesting question on the mathjax 
list about the proper display of mmultiscripts. the thread is archived at:

https://groups.google.com/d/topic/mathjax-users/SAmlSkWQ3TY/discussion


It turns out that MathML (1 2 and 3) are less than explicit about how 
the scripts should be aligned, it says that they should be 
"vertically-aligned " this is distinct from msubsup where the 
positioning can take account of the italic correction of a base letter. 
(Compare P_1^2 and {P{}}_1^2 in TeX which produce the attached ps.png 
results). However the specification does not currently state whether the 
sub/sup pairs should be left or right aligned. The test suite only has 
examples with single letters so does not produce a very good guide for 
horizontal alignment.

In order to check the current state of implementations we tested the 
following file with results being attached.

<!DOCTYPE html>
<html>
<head>
<!--
<script type="text/javascript"
 
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
-->
<title>mmultiscripts test</title>
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mmultiscripts>
<mi>A</mi>
<mn>1</mn><mn>111</mn>
<mn>2</mn><mn>222</mn>
<mprescripts/>
<mn>3</mn><mn>333</mn>
<mn>4</mn><mn>444</mn>
</mmultiscripts>
</math>
</body>
</html>

test case of various systems rendering  the above, (without the script 
element except for mathjax)


pmml2tex:               left aligned    (tex.png attached)
firefox 17 (nightly)    center aligned  (ff.png attached)
mathjax (in Chrome)     left aligned    (mj.png attached)
mathplayer 2            center aligned  (mp2.png attached)


After some discussion the current feeling is that we should have an 
errata to the spec (equivalently an update to the editor's draft)
that

1.  Points out that the spec currently does not specify horizontal 
alignment, so systems are free to align as they desire
2.  Mentions that an attribute to control alignment may be added in 
future versions of MathML.
3.  Mentions that sub/sup prescripts of different lengths are more 
common in chemistry and in that case it is best to right align 
prescripts and left align postscripts; because of the difficulty of 
recognizing that use case, it may be a good default alignment.

An example of the Chemistry use case might be seen in the mhchem latex 
package documentation where the example


\ce{^{227}_{90}Th+}

is given on page 6 of


http://mirrors.ctan.org/macros/latex/contrib/mhchem/mhchem.pdf

Thus might want the possibility of not always left-aligning prescripts.

It might be noted that the similar \sideset macro from the amsmath latex 
package for mathematics left aligns prescripts. However (not entirely 
coincidentally) the AMS documentation doesn't explicitly mention 
horizontal alignment, and the examples typically just involve single digits.

Comments as usual welcome on this list,

David
for the Math WG.












tex.png
(image/png attachment: tex.png)

ff.png
(image/png attachment: ff.png)

mj.png
(image/png attachment: mj.png)

mp2.png
(image/png attachment: mp2.png)

ps.png
(image/png attachment: ps.png)

Received on Tuesday, 21 August 2012 23:49:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 21 August 2012 23:49:17 GMT