# Is there a way such that I can put text in $$without changing the font? Sometimes I need to cancel \cancel{} or \enclose{horizontalstrike}{} or change color \color{}{} using methods introduced in this post. Such manipulations should be done in dollar signs and after using \text{}, letters will be shown with different font. For example: This is the original. \text{This is inside dollar signs.} Is it possible to avoid this? Edit: \rm{} or \mathrm{} do the same thing. ## 2 Answers The short answer is no. A slightly longer answer is that MathJax uses local fonts since it renders locally, so not every user sees the same font in the first place. (See meta posts asking about MathJax fonts and STIX vs tex fonts). But I also don't think that there are times when I intermix TeX fonts and regular fonts. You can strike through text without resorting to TeX. If I'm trying to distinguish something by using {\color{#AA0000}{\text{colors}}}, then I'm specifically using the different styling and I don't care to make the TeX more similar. On the other hand, from an abstract standpoint, it is interesting to know whether one can consistently use MathJax to render the exact same font and size. I don't know of it, but I bet that the amazing wizards at TeX.se know. • IIRC MathJax is off-topic on tex.se (but one could try on SO and the MJ devs read this meta even, at least sometimes). – quid May 14 '15 at 1:30 • How does strike through work? I can't find it here. – MonkeyKing May 14 '15 at 1:33 • @MonkeyKing <strike>strike through</strike> is the source-snippet; it does not work in comments though. – quid May 14 '15 at 1:35 • @quid oh is it? That doesn't surprise me too much, I suppose, as it is fundamentally different. But I also ascribe to the belief that reasonable questions might be asked where they would best be answered. MathJax is remarkable. It didn't occur to me that the devs might pass through here from time to time. [If you see this - brilliant, and thank you!] – davidlowryduda May 14 '15 at 3:32 • @mixedmath: the devs do pass this way, and if I recall, they do not support using MathJax to enhance images or non-math text (the reason that I remember dealt with reading software for the visually impaired). I was told not to center images by starting a line with \hspace{...}. I would think using the cancel package would also be against their recommendation, unless used in math. – robjohn May 14 '15 at 5:58 • It is possible for SE to configure MathJax to use the surrounding text font within \text{} and other text-creation commands, but they have not done so. Perhaps it is because there is a performance penalty associated with it, or perhaps it is because their configuration was developed before this option was available. It is possible to force the font using the \style{} macro, but if SE ever changed their CSS, your text would not reflect the change. @robjohn is correct that we don't recommend using MathJax in this way, and screen readers is one of the important reasons. – Davide Cervone May 14 '15 at 9:24 • For MJ on tex.se see its tagwiki for the MJ dev see the comment above. :-) Besides Davide Cervone there is also Peter Krautzberger that is affiliated with MJ and on this site. (Perhaps there are more but these two I know about.) – quid May 14 '15 at 10:21 Sure, it is possible. Take a look below, the second line is in MathJax. Hello, World! \style{font-family:inherit;}{\text{Hello, World!}} You can right click the second line and select Show Math As > TeX Commands to see the code to produce it: \style{font-family:inherit;}{\text{Hello, World!}}$$\sum_{n=0}^\infty\frac1{n!}\hspace{20px}\style{font-family:inherit;}{\text{You can use it in display mode as well.}}\hspace{20px}\sum_{n=0}^\infty\frac1{n!}

Davide Cervone points out in a comment that using the \style macro would force a specific font, which would be undesirable should MSE ever change to a different font. However, you can set the font to be inherited from the parent element. This way, even if MSE does change the font, this change should be reflected in your post.

• That is sneaky and devious. I like it. :) – Ilmari Karonen May 19 '15 at 11:23
• I think it could make sense to put the code in a visible way. too like $\style{font-family:inherit}{\text{Hello, World!}}$ Not everybody can see the source. [On reflection everybody could see the source but some might not know they can.] – quid May 19 '15 at 15:32
• Davide Cervone also points out in the same comment that "we don't recommend using MathJax in this way, and screen readers is one of the important reasons." – user856 May 19 '15 at 15:58
• @Rahul: That is in response to robjohn, who said "they do not support using MathJax to enhance images or non-math text". I don't see why changing the font for math related text (that would be there regardless) would be bad. – Regret May 19 '15 at 16:34
• Fair enough. ${}$ – user856 May 19 '15 at 18:38
• Alas, with the new Common HTML math renderer, the font size seems to be mismatched. :( – Ilmari Karonen May 19 '16 at 17:24