• John Palmieri

    John Palmieri - 2009-05-12

    Is the font mathsf implemented in jsMath? It doesn't seem to be there by default, but is there an extension or a font which will add it? (This question came up on the sage-support mailing list.)

    • Davide P. Cervone

      No, there is no mathsf at this point.  There are two possible solutions that I can see.

      The cheap but easy one is to do a definition like the following:




      if you include it in a JavaScript file.  Some disadvantages:  it will always be at the normal text size (so won't get smaller for super- or sub-scripts, for example), and it will use the browser's default sans-serif font, not a TeX font, so it might not match the rest of the TeX output as well.  There may also be some spacing issues, as jsMath doesn't really know the sizes of the characters.  But it is easy to do and may be sufficient for your needs.

      The other approach is to make a new jsMath "extra font" for mathsf, like the ones for the other extra fonts (msam10, etc).  The tools for doing this are on the jsMath website at

      but you will have to figure out which TeX font you want to use for the \mathsf font.  Probably cmss10 would do.


    • Davide P. Cervone

      OK, I built the cmss10 font files and put them on the extra-fonts download page at

      where you can download the image fonts to install on your server, and the TTF files for your clients.  Loading the cmss10 font will cause the \mathsf command to be defined.  It is also possible to make the \mathsf command be predefined to load the cmss font when it is first used (so you don't have the overhead of loading the cmss font when it is not used).  To do this, use the commands

          jsMath.Macro("mathsf","{\\cmss #1}",1);

      Hope that takes care of your needs.


      • John Palmieri

        John Palmieri - 2009-05-14

        That's great, thanks a lot!


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks