#44 Missing commands \vspace et al

v0.9
open-later
nobody
5
2010-04-09
2010-04-08
Alex Fernandez
No

There are a few unsupported LaTeX commands as shown in http://www.nongnu.org/elyxer/math-mathjax.html. They are, in no particular order: \euro, \raisebox, \vspace, \unit, \unitfrac, \nicefrac, \intop. \lyxlock is a LyX-defined command, and maybe some others?

Discussion

  • Certainly not all LaTeX commands are implemented in MathJax, as there are numerous LaTeX packages, and I am not able to reproduce all of them. Some decisions had to be made.

    That being said, here are some comments on your list. For \euro, none of the fonts that I used to create the MathJax TeX fonts include a euro character, and the quick search I did for ones that do did not turn up one whose license was clear enough for me to feel comfortable including it in MathJax's fonts.

    You can, of course, use MathJax's \unicode extension to request a Euro symbol via something like

    \def\euro{\unicode[.7,0]{x204C}}

    (One could add the equivalent of this to the MathJax/config/local/local.js file and include "local/local.js" in the extensions array of the MathJax configuration. See the comments in local/local.js for more information.)

    The \raisebox command is not really a math-mode command, though it can be used there. MathJax already has Plain TeX's \raise and \lower macros, and most of what \raisebox offers can be handled with that. (The optional arguments would need to be handled with zero-width rules (called "struts") and perhaps \smash, but the effect could be achieved.) It would certainly be possible to implement \raisebox, but the priority is low, I'm afraid.

    MathJax does not have a vertical mode like TeX, and so \vspace is not really appropriate in MathJax. The only place I can see that it could make sense would be in \noalign commands within arrays, but that hasn't been implemented, and probably won't be, as it does not translate well into MathML, the underlying format used by MathJax. We'll see. So I don't see implementing \vspace for MathJax.

    I am adding \intop to the core, but haven't committed it yet. It will be in soon.

    Finally, the \unit, \unitfrac, and \nicefrac could be implemented as an extension, but haven't been. I'll put them on the list for the future. Not sure when they will get done, however.

    Davide

     
    • milestone: --> v0.9
    • status: open --> open-later
     
  • Alex Fernandez
    Alex Fernandez
    2010-04-09

    I cannot say that I understand the problem of the \euro sign. A quick search however shows that the STIX fonts do indeed support the €: http://www.stixfonts.org/allGlyphs.html. And of course it should work on MathML (if anything after conversion to the € Unicode character).

    As to the rest: no hurry, you have far more important challenges ahead. Thanks for the quick answer and for all the hard work!

     
  • Yes, the STIX fonts (will) have the Euro sign; however, the user may not have the STIX fonts installed, and those are not the fonts that are being used as web-fonts. The MathJax TeX fonts are a smaller set of glyphs that are used for delivery over the web, and they are made from the CM fonts and some others for which that is possible. None of the fonts used to create the MathJax fonts include the Euro, and I don't have a (TeX) font that does for which the license clearly allows it. So I am not including one. You are welcome to request the Euro sign as a unicode character, as I describe above (or I guess below), and it can come from the STIX fonts if they are installed (or another font if not).

    Davide

     
  • Alex Fernandez
    Alex Fernandez
    2010-04-09

    OK, I should have supposed that it would not be so easy (or you would have solved it already). Anyway, thanks for looking into it!

     
  • I forgot about \lyxlock: whst is it supposed to do? Your best bet is to use your local/local.js file to define it. Depending on how complicated it is, it could be done as a macro, or as JavaScript code (like MathJax's internals), if need be.

    Daviide

     
  • Alex Fernandez
    Alex Fernandez
    2010-04-10

    Oh, no problem about that: it is just supposed to be an empty marker. I defined a \newcommand at the top of the page. You can see the results at http://www.nongnu.org/elyxer/math-mathjax.html, where I have uploaded a definitive version. I intend to place into that <script> all the global settings for MathJax.

     
  • Alex Fernandez
    Alex Fernandez
    2010-04-18

    Hi again,

    I can confirm that \intop works fine. As to the rest, only \unit, \unitfrac and \nicefrac are really important; if you need testing or anything else just let me know. Thanks a lot!