0

I have followed this https://tex.stackexchange.com/a/385068/80468 advice to enable me to change the font with \sffamily in math mode:

\DeclareMathVersion{sfmath}
\SetSymbolFont{letters}{sfmath}{OT1}{\sfdefault}{m}{n}
\xapptocmd{\sffamily}{\mathversion{sfmath}}{}{}

However, this gives some weird artifacts, particularly with the use of lowercase Greek characters and periods. In fact, periods are converted to colons, so that

{\sffamily $a_1 \ldots a_n$} actually prints as if I was typing {\sffamily $a_1 ::: a_n$}.

What is the best way to overcome this?

Edit (minimal working example)

\documentclass[american, hidelinks]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{xpatch}

% Math fonts.
\DeclareMathVersion{sfmath}
\SetSymbolFont{letters}{sfmath}{OT1}{\sfdefault}{m}{n}

\xapptocmd{\sffamily}{\mathversion{sfmath}}{}{}

\begin{document}

{\sffamily
\[
  a_1 \ldots a_n = \mathit{foo}
\]
}

\end{document}

gives

enter image description here

  • 1
    Now I can reproduce the problem. I will remove my "answer". – Dr. Manuel Kuehner Aug 8 '17 at 19:08
  • 1
    The default encoding for letters is OML, mapping them in full to OT1 doesn't work. – Ulrike Fischer Aug 8 '17 at 19:37
  • It is unrelated to sans serif, you have changed the letters family from OML to OT1 which means you need to redefine almost every math command to the new layout, most likely you have removed lower case greek altogether (as OT1 does not have lower case greek) – David Carlisle Aug 8 '17 at 20:02
  • The answer you linked to is flawed in the first place: very strange, considering who authored it. – GuM Aug 8 '17 at 20:17
  • @GuM The answer is not flawed in any way. The OP is simply taking it for what it isn't supposed to do. – egreg Aug 8 '17 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.