# Can we have a font which harmonizes better with MathJax?

It seems that we're somewhere in the queue for a site CSS adjustment, accompanied by the new profile pages. Since the CSS is getting a makeover, I would like to float this idea: can we change the font to something that gets along better with the MathJax font?

Currently, posts with MathJax look something like this:

(this example). Note how the math tends to stick out like a sore thumb, to the point that I often do things like 10<sup>-9</sup> s to keep the text streamlined, unless I really need the maths. Ideally, within the LaTeX paradigm - i.e. in the style used by all serious physics journals - the math will blend in perfectly:

Now, I know that this is quite a lot to ask, since the site font is currently very sans-serif, but over in Chemistry SE's gorgeous new design it does work much better (with a serif font):

So: can we move over in that direction somewhat?

• Agreed. Mind you math should be visually distinct. It just needs to get along with text. – dmckee --- ex-moderator kitten May 17 '15 at 17:53
• presumably we could instead change the mathjax font to be in harmony with the main font? – innisfree May 17 '15 at 19:04
• I find the sans serif font easier to read than the serif for the primary text. I agree there should be a font that jives better with the math, but I don't really want to go to a serif font (not like I'm the sole decider or anything) – tpg2114 May 17 '15 at 19:24
• Serifs please. Just like chem and math. – user10851 May 17 '15 at 21:35
• @ChrisWhite - A number of studies have been conducted on the readability of fonts on screen versus on paper. With a decent printer, serif fonts on paper are more readable than sans serif fonts. On screen, those serifs cause aliasing (or at least they used to do so). Sans serif fonts are supposedly more readable on screen. Or so say the studies. My eyes say different. To me, a document produced with TeX or LaTeX is easily distinguished from a document produced using microstuff as being easy on my eyes, whether on paper or on screen. The default TeX/LaTeX font has serifs. As should this site. – David Hammen May 18 '15 at 4:49
• Just some background information. MathJax tries to match the ex-height of the surrounding font. From a quick test this seems to be working here (but the surrounding font has a very different design otherwise). Also, MathJax (as configured on SE sites) will use locally installed STIX or MathJax fonts if available. These fonts differ quite a bit since the MathJax fonts were derived from Computer Modern and STIX is similar to Times New Roman. Also, MathJax can only support a few fonts (for lack of browser APIs and good math fonts), see docs.mathjax.org/en/latest/font-support.html. – Peter Krautzberger May 18 '15 at 13:24
• I find that large and prominent serifs cause more of the screen/page difference @David talks about. We want refined and distinguished serifs to go with our user base. – dmckee --- ex-moderator kitten May 19 '15 at 4:00
• I agree that sans serif main text and MathJax don't blend well, and this should be corrected. But are you seriously suggesting to use Computer Modern here? It's the Times New Roman of LaTeX documents, and long obsolete. Also, I haven't seen a physics journal that uses this font. – A. Donda May 24 '15 at 11:24
• @A.Donda No, Computer Modern would be a terrible choice. However, we can do a lot better than this. – Emilio Pisanty May 24 '15 at 20:13
• I agree with the first half of the comment from @DavidHammen I work on a high resolution screen and the sans serif fonts are MUCH easier to read. If we want to harmonize with the math, my preference would be to change the MathJax font. – Rick May 27 '15 at 15:47
• @Rick That could work, but MathJax fonts are notoriously unreliable and can be changed by the user. I get completely different fonts on my linux and windows machines. – Emilio Pisanty May 27 '15 at 16:14
• @EmilioPisanty: Fonts have changed!! – user36790 Feb 18 '16 at 20:21

Ask and you shall receive. This site is in line for CSS conversion, and, while we're in there, we'll make sure that we match the serif font in the body like Chemistry SE and Math SE. Thanks!

• Excellent! Can we ask if there's a rough timeline for this? (If it's still six-to-eight-weeks that's OK!) – Emilio Pisanty May 18 '15 at 15:03
• I don't suppose that while the CSS is being re-examined, something could be done about the clash between the top bar and the site's design? (The bar is overwhelmingly dark against the light-coloured design, and the Stack Exchange logo clashes nastily with the blue-green of the site.) It's been a bit of a long-standing issue, see meta.physics.stackexchange.com/questions/5261/… – Nathaniel May 24 '15 at 8:58
• @Nathaniel It seems some proponents of that change have backtracked on it. – Emilio Pisanty May 25 '15 at 11:57
• Can we have an option to choose serif or sans-serif? On a dark background, serifs produce unacceptable glare (may not be the right word). Besides, serifs are good for a reflected display (like paper or e-ink). On a backlit display, sans-serif works better. The original concern of @EmilioPisanty could have been taken care of by increasing the default font size of non-mathJAX text. – magguu Apr 11 '20 at 5:56
• @magguu Note that, while Kurtis will be notified, his profile indicates that he no longer works at SE, so your comment won't find its way to the devs. Moreover, this thread is from a previous epoch in SE design architecture (for details see meta.stackexchange.com/q/311033 and related MSE threads), so its current validity is mostly as a historical marker. If you want to ask for a change like this, then it's better (read: you have any chance at all of the devs noticing, cf. meta.stackexchange.com/q/345032) to start a new feature request, either here or on MSE. – Emilio Pisanty Apr 11 '20 at 22:26
• ... though, that said, for something as niche as the options you mention, it's probably easier for you to roll it yourself as a userscript or using Stylish, if either is available for the devices you want to change the behaviour on. Maybe there's already something on StackApps? – Emilio Pisanty Apr 13 '20 at 7:35

Not much of an answer to the real question because (a) it's a single-user solution rather than the whole user-base of Physics and (b) it applies to all websites and not just this one1, but you can change the font yourself. For Firefox, for example, you can select

Edit > Preferences


Then under the Content tab, select Advanced:

At the bottom is the option Allow pages to choose their own fonts, instead of my selections above:

If you unselect that, then you can choose whatever font you want & have the same fonts as Chemistry. Thus, your example becomes

I don't use Chrome, but I suspect that there is a similar option hidden somewhere.

1. I've not tested it, but this SuperUser post says that there is a work-around for particular sites that involves writing a CSS and enabling Firefox to see it.

• Yes, individual users can change the look and feel of the site both via Stylish (chrome/firefox) or via greasemonkey/tampermonkey userscripts. I was thinking more of a definitive style change for the site. – Emilio Pisanty May 18 '15 at 10:58
• I know, that's why I preface it with the two big problems :) – Kyle Kanos May 18 '15 at 11:13
• FYI this will actually force MathJax to fallback to image-based rendering, i.e., using the same fonts but with glyphs turned into PNGs (unless you switch to SVG or MathML output). – Peter Krautzberger May 18 '15 at 13:14
• This can cause minor problems with mathjax - see the comments here physics.stackexchange.com/questions/184851/… – innisfree May 19 '15 at 14:59
• @innisfree: I am not at all sure, but maybe that is due to Peter K's comment above? – Kyle Kanos May 19 '15 at 15:01
• Yes it could be - @PeterKrautzberger what do you think? Why does picking the font make mathjax display $x'$ so badly? – innisfree May 19 '15 at 15:18
• @innisfree that screenshot looks like the rendering of the Fast Preview (which is that rough). Eventually (once a gazillion PNGs, one for each character is downloaded), the Fast Preview should be replaced by something of better quality (but using PNGs instead of fonts) – Peter Krautzberger May 19 '15 at 19:31