6
$\begingroup$

Currently MathJax supports several fonts for text in mathematics:

$$normal,\mathbf{mathbf},\mathsf{mathsf},\mathrm{mathrm},\mathtt{mathtt}.$$ (And I intentionally omitted all the \mathbb,\mathscr,\mathfrak and \mathcal which are really not used for text usually.)

In addition, MathJax also supports the \text command which allows one to insert text mid-math mode (and thus retain some basic spacing between words and letters which are otherwise ignored). It also supports $\textbf{textbf}$ and $\textrm{textrm}$ and $\textit{textit}$ explicitly. However $\textsf{textsf}\ $ and $\texttt{texttt}$ -- are unsupported.

Still, not all is lost. We can use a small hack and do the following: \mathsf{\text{...}} to get the same functionality as \textsf{...} would have given us: $$\mathsf{\text{This is a short sentence in mathmode using a \textsf{} hack}.}$$


Since this functionality "almost" exists in MathJax, two questions are needed to be asked:

  1. Why isn't \textsf and \texttt are part of MathJax, like their boldface/italics/serif counterparts?

  2. If there is no plan to incorporate these fonts into MathJax, should we request the StackOverlords to include these two definitions for them: \newcommand{\textsf}[1]{\mathsf{\text{#1}}} and \newcommand{\texttt}[1]{\mathtt{\text{#1}}} for us?

$\endgroup$
  • 3
    $\begingroup$ +1, thanks for bringing this up; it's bugged me too. While we're requesting fonts: I would really like support for the Euler calligraphic font (from the eucal package). If I were king of MathJax, I would keep the command \mathcal as is, and use \eucal for the Euler calligraphic font. $\endgroup$ – Zev Chonoles May 21 '13 at 7:48
  • $\begingroup$ Zev, I know that this bugged you. ;-) But it also bugged me for quite a long time now... $\endgroup$ – Asaf Karagila May 21 '13 at 8:21
  • 2
    $\begingroup$ I have opened a feature request for this on the MathJax issue tracker: github.com/mathjax/MathJax/issues/477 $\endgroup$ – Davide Cervone May 21 '13 at 10:33
  • $\begingroup$ @Davide: Thanks. I was hoping you'll see this and reply (Peter didn't know to tell me why these commands are not implemented, and suggested I post on the github tracker, or here for a custom macro until such feature is inserted. I chose the latter so that you might come and shed some light, but opening this request seems like there's no actual reason...) $\endgroup$ – Asaf Karagila May 21 '13 at 10:44
  • 4
    $\begingroup$ There is no reason not to have \textsf and \texttt (other than my ignorance of all the LaTeX macros out there that people use). They weren't in the list I was working from. As for \eucal, that is another story, for two reasons: 1) it would require additional web fonts, and 2) since MathJax maps everything to MathML, there would need to be a way to notate it. There is no mathvariant that could be used for that, so MathJax would need to use something non-standard to do that. It is possible, but a bit awkward. $\endgroup$ – Davide Cervone May 21 '13 at 10:49
  • $\begingroup$ @Zev: Ping.${}{}$ $\endgroup$ – Asaf Karagila May 21 '13 at 16:14
  • $\begingroup$ @Davide: Thank you for that last comment. $\endgroup$ – Asaf Karagila May 21 '13 at 16:15
  • $\begingroup$ @Zev But we already have \mathscr and \mathcal (which are distinct)! Yet another calligraphic font seems excessive... $\endgroup$ – Zhen Lin May 21 '13 at 23:20
  • $\begingroup$ @Zev: Happy day. $\endgroup$ – Asaf Karagila May 12 '14 at 20:57
3
$\begingroup$

The issue has been resolved in MathJax 2.4 (which has deployed in beta).

$$\Large\textsf{This is}\ldots\texttt{awesome.}$$

$\endgroup$
  • 2
    $\begingroup$ For other people as lazy as me: The source for the above is $$\Large\textsf{This is}\ldots\texttt{awesome.}$$ $\endgroup$ – Martin Sleziak May 13 '14 at 5:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .