# px dimensions in \\[...] in TeX input #890

Closed
opened this issue Aug 15, 2014 · 15 comments

Projects
None yet
3 participants
Member

### pkra commented Aug 15, 2014

 From MediaWiki https://bugzilla.wikimedia.org/show_bug.cgi?id=69554 Something like \begin{align} 1+1=1 \\[5px] 2+2=4 \end{align}  works in LaTeX but not in MathJax's TeX input. I don't know if this is expected behavior.
Member

### dpvc commented Aug 15, 2014

 It is a bug. The list of allowed units is missing "px". Easily fixed.

Member Author

### pkra commented Aug 15, 2014

 Thanks. I'll let the MW bugzilla know.
Member

### dpvc commented Aug 15, 2014

 PS, substituting a unit like "pt" would allow the user to get the extra space they desire.

Member

### dpvc commented Aug 17, 2014

 Note, this is specific to the \\[...] construct, not to TeX dimensions in general, which do allow the use of px as a unit.
Member

### dpvc commented Aug 18, 2014

 I've looked into this some more, and there is a reason that px was left out. First, px is not a valid unit in TeX dimensions, so one shouldn't expect it to be accepted; but since MathJax does accept px elsewhere, it would be nice if it could here, as well. The problem is that the extra inter-row spacing is handled by adding it to the default spacing, and that spacing is given in em's, so the dimension within \\[...] must be converted to em's in order to add the two together. Unfortunately, the TeX input jax doesn't know the pixel size (only the output jax know that), so it can't do the conversion. I could do a conversion based on some constant number of pixels per em, but the results would not be very accurate.
Member Author

### pkra commented Aug 18, 2014

 First, px is not a valid unit in TeX dimensions, so one shouldn't expect it to be accepted; I had tried this on pdflatex and it had done something that seemed correct. I just found http://tex.stackexchange.com/questions/41370/what-are-the-possible-dimensions-sizes-units-latex-understands, so this seems to be pdftex/pdflatex specific.
Member

### dpvc commented Aug 18, 2014

 Currently, MathJax doesn't do the bp, sp, dd, or cc units because these can't be passed to MathML directly (as the other ones can). It does handle mu as a special case, so it would be possible to add these others as well, but it didn't seem necessary. Do you think they should be added? My hack to cover px is to do essentially something like the 72dpi value indicated in your link. Should I do that?
Member Author

### pkra commented Aug 18, 2014

 Currently, MathJax doesn't do the bp, sp, dd, or cc units because these can't be passed to MathML directly (as the other ones can). It does handle mu as a special case, so it would be possible to add these others as well, but it didn't seem necessary. Do you think they should be added? To me they seem more exotic (at least more than px, but I'm not an expert). So I'd say "no". My hack to cover px is to do essentially something like the 72dpi value indicated in your link. Should I do that? That sounds good to me. (But I think there might be more important bugs we want to fix in the next release. Should we go through the tracker some time soon?)
Member

### dpvc commented Aug 18, 2014

 I thought it was just going to be a quick one, but it turned out to be more involved. I've already fixed it, so even then it was only 10 minutes. I've marked the ones as ready for development that I thought would be easily taken care of. If you want to go through them or others, that's OK.
Member Author

### pkra commented Aug 18, 2014

 Ok. I'll go through them.

### davidcarlisle commented Aug 18, 2014

 Although pt are legal units in TeX and MathML they are not the same unit, MathML (implicitly) follows css where 1pt = 1/72 in which is bp in TeX. A TeX point is 1/72.27 in . Normally no one cares about this except when matching up EPS bounding boxes (given in postscript points) with TeX dimensions (where it's easier to use bp rather than pt so things match up exactly)
Member Author

### pkra commented Aug 18, 2014

 Thanks for the additional information, David.

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Aug 18, 2014

 Add ability to process units of px in \\[...] (not particularly accur… 
…ate, however). Issue mathjax#890
 72a6a67 

Member

### dpvc commented Aug 18, 2014

 The issue890 branch of my fork of MathJax includes a work-around.

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Aug 19, 2014

 Merge branch 'issue890' into develop. Issue mathjax#890. 
 adbc17a 
Member

### dpvc commented Aug 19, 2014

 ==> Merged.

### dpvc pushed a commit to mathjax/MathJax-test that referenced this issue Jan 16, 2015

 Add test for \\[] allowing px units. (mathjax/MathJax#890) 
 54c8379 

Member

### dpvc commented Jan 16, 2015

 ==> In Testsuite LaTeXToMathML/matrices/issue890.html