1

I am using the package sfmath. It is rather hard to explain why, but the reason should not matter for my question. If it is required I can try to explain why I need sfmath. Nevertheless, the main message is that it can not be turned off.

Although I am using sfmath, I do would like to use the typical "a" in the mathmode of amsmath. How can I achieve this?

Is it possible to change the font style for single words/letter such that I, per command, can change the font style locally when required?

For illustration purposes a simple working example looks like this:

\documentclass{article}

\usepackage{sfmath}
\usepackage{amsmath}

\begin{document}

\begin{equation}
 a = a
\end{equation}

\end{document}

sfmath seems to be overruling amsmath as it does not produce the "a" that I would like. The code above results in:

enter image description here

Whereas the lower "a = a" is obtained by turning off sfmath in order to illustrate the "a" that I would like to include.

Thank you very much!

9
  • Does tex.stackexchange.com/q/42394/39222 help?
    – cfr
    Jun 22, 2014 at 15:28
  • Yes and no, I mean it does allow me to locally change the font. However it does not result in the required "a" which amsmath produces. I am not sure how to alter the answer of the link you gave me to my specific case.
    – The Dude
    Jun 24, 2014 at 15:05
  • 1
    In that case, please provide a small but complete document illustrating the issue to encourage people to help you and to help them understand your situation. (This is known locally as a 'Minimal Working Example' and should begin with \documentclass and end with \end{document}.)
    – cfr
    Jun 24, 2014 at 21:13
  • I am not sure how to include a image of the pdf I am producing. I guess my "hack" will suffice.
    – The Dude
    Jun 25, 2014 at 9:36
  • There may be some confusion over terminology: While sfmath is a package that provides a certain sans-serif font for math mode, this is not the purpose of amsmath. The macros and environments of the amsmath package are compatible with all sorts of font families, including those provided by sfmath. Thus, it doesn't make much sense to say that amsmath overrules sfmath, or vice versa. Are you really looking to use the serif-style a of either Computer Modern Roman or Computer Modern math italics instead of the sans-serif a that's activated when sfmath is loaded?
    – Mico
    Jun 25, 2014 at 9:38

2 Answers 2

2

Well you either can define a mathcommand that switches to the standard font:

\documentclass{article}

\usepackage{sfmath}
\usepackage{amsmath}
\DeclareSymbolFontAlphabet{\mathori}    {letters}
\begin{document}

\begin{equation}
 a = \mathori{a}
\end{equation}

\end{document}

You can also reset the font for the "a" back to "normal" (this doesn't work "locally"):

\documentclass{article}

\usepackage{sfmath}
\usepackage{amsmath}
\DeclareMathSymbol{a}{\mathalpha}{letters}{`a}
\begin{document}

\begin{equation}
 a = a
\end{equation}

\end{document}
1

From the comments in sfmath.sty:

% After including the package sfmath.sty, all maths of the current
% document is displayed with sans serif fonts; there is no way to
% switch back to the original behavior.

The style works by overwriting all the standard math font commands, and so does not leave access to the original math fonts. Those fonts are computer modern or latin modern by default. As many have pointed out in comments, amsmath is not a font changing package, it has a close cousin amsfonts which is, but it mostly provides extra symbols on top of the computer modern ones.

A package that will provide you with a form of sans serif math and allow switching is sansmath. Here is a small sample:

Sample output

\documentclass{article}

\usepackage{sansmath}

\begin{document}

\begin{equation}
  a = a \ne \mathsf{a}
\end{equation}

\begin{sansmath}
  \begin{equation}
    a = a \ne \mathsf{a} \ne \mathit{a}
  \end{equation}
\end{sansmath}

\end{document}

Note how you can use \mathit to get the standard a.

You should also look at this discussion: Typeset mathematical symbols also in sans serif font?

You must log in to answer this question.

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