Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I match the font of an equation to a Sans Serif font? I am using the following code.


\usepackage[scaled, mono=false]{libertine} 
\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif

\section*{Sans Serif Font along with equation and formula}

\noindent How can I put my equation between dollar signs, e.g., \verb|$E=mc^2$|, and get an output which matches a Sans Serif font? 

\noindent Here is the result of \verb|$E=mc^2$|: $E=mc^2$


Here is the output.

enter image description here

share|improve this question
well, not all fonts have a math support. I think that Euler matches Libertine reasonably: add \usepackage{eulervm} into your preamble and see whether you like it or not. –  yo' Aug 13 at 6:53
Is it just me who reads the title as my kingdom for a horse? Free association is weird. –  percusse Aug 13 at 9:53

1 Answer 1

up vote 3 down vote accepted

Use the sansmath package.

The package is designed to offer sans-serif mathematics in the absence of proper sans maths fonts.

The package’s name could be misconstrued: there was an ambition to do the job for “non-standard” sans fonts (as indicated by the value of \sfdefault), but the only good results have been with Computer Modern and cmss.

To use the package, add \usepackage{sansmath} to your preamble, and then use the \sansmath command in any maths environment when you want to switch to a sans-serif font.

If you want this applied to every maths environment in your document, you can use \sansmath in your document preamble.

share|improve this answer
It did not work for me. I get the same result, no change. –  A2009 Aug 13 at 6:40
However, that's a poor man's solution... –  yo' Aug 13 at 6:52
@tohecz: I liked the look of the sansmath's result more than \usepackage{eulervm} after I got sansmath to work by using \sansmath{$E=mc^2$} but you know sansmath is kind of inconvenient as I have to put in in front of all the equations. The solution you suggested is very convenient but the look is different. –  A2009 Aug 13 at 7:23
@A2009 I've edited my answer to show you how to avoid having to put \sansmath in front of every equation. –  ChrisS Aug 13 at 9:18
@A2009 Answer updated so that it actually works. –  ChrisS Aug 15 at 1:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.