Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pkra opened this issue Aug 15, 2014 · 15 comments

Comments

Projects
None yet
3 participants
@pkra
Copy link
Member

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.

@dpvc

This comment has been minimized.

Copy link
Member

commented Aug 15, 2014

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

@dpvc dpvc added the Accepted label Aug 15, 2014

@pkra

This comment has been minimized.

Copy link
Member Author

commented Aug 15, 2014

Thanks. I'll let the MW bugzilla know.

@dpvc

This comment has been minimized.

Copy link
Member

commented Aug 15, 2014

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

@dpvc dpvc changed the title px dimensions in TeX input px dimensions in \\[...] in TeX inpu Aug 17, 2014

@dpvc dpvc changed the title px dimensions in \\[...] in TeX inpu px dimensions in \\[...] in TeX input Aug 17, 2014

@dpvc

This comment has been minimized.

Copy link
Member

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.

@dpvc

This comment has been minimized.

Copy link
Member

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.

@pkra

This comment has been minimized.

Copy link
Member Author

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.

@dpvc

This comment has been minimized.

Copy link
Member

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?

@pkra

This comment has been minimized.

Copy link
Member Author

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?)

@dpvc

This comment has been minimized.

Copy link
Member

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.

@pkra

This comment has been minimized.

Copy link
Member Author

commented Aug 18, 2014

Ok. I'll go through them.

@davidcarlisle

This comment has been minimized.

Copy link

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)

@pkra

This comment has been minimized.

Copy link
Member Author

commented Aug 18, 2014

Thanks for the additional information, David.

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

@dpvc

This comment has been minimized.

Copy link
Member

commented Aug 18, 2014

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

@dpvc dpvc added this to the Next Release milestone Aug 18, 2014

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

@dpvc

This comment has been minimized.

Copy link
Member

commented Aug 19, 2014

==> Merged.

@dpvc dpvc closed this Aug 19, 2014

@dpvc dpvc added Merged and removed Ready for Review labels Aug 19, 2014

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

@dpvc dpvc added Test Available and removed Test Needed labels Jan 16, 2015

@dpvc

This comment has been minimized.

Copy link
Member

commented Jan 16, 2015

==> In Testsuite

LaTeXToMathML/matrices/issue890.html

@dpvc dpvc added Fixed v2.5 and removed Merged labels Jan 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.