Sans-serif fonts are better for figures. Various of ways to typeset LaTeX math in sans-serif font are compared. Based on the results, sansmathfonts is recommended for use.
Background
Sans-serif fonts has a better readability when scaled down, and thus is the preferred font for figures in many journals.
However, it's not straightforward to typeset math formulas with in the figure, because using a simple \mathsf or \sf can be tricky and tedious. For example, \sf does not affect symbols inside in \mathbf{k}, and you have to use \boldsymbol{\sf k} to make k correctly displayed.
If you search on the web, you can find this heated Stack Overflow thread, where a dozen of different approaches are mentioned. But which one to choose, and why?
Results
To compare the behavior of different approaches, I'm using the following equation for testing:
View Post on Blog
Background
Sans-serif fonts has a better readability when scaled down, and thus is the preferred font for figures in many journals.
However, it's not straightforward to typeset math formulas with in the figure, because using a simple
\mathsf
or\sf
can be tricky and tedious. For example,\sf
does not affect symbols inside in\mathbf{k}
, and you have to use\boldsymbol{\sf k}
to makek
correctly displayed.If you search on the web, you can find this heated Stack Overflow thread, where a dozen of different approaches are mentioned. But which one to choose, and why?
Results
To compare the behavior of different approaches, I'm using the following equation for testing:
The results are shown below, and the red symbols are ones that are not rendered correctly.
\mathbf
are not in sans-serif.\mathbf
are not bold.Conclusion
Just use sansmathfonts, it's simple and nice.
Code availability
The code for reproducing the results are available at AllanChain/sans-math-compare.