4

I'm using kpfonts in the thesis for its light variant. I don't really like its sans serif variant, though, since it's too bold and doesn't blend well with the light serif font. Looking for another sans serif font, I've found the Montserrat font, which is really nice in its light option, and looks really good for all caps titles in the extralight variant.

The problem is that the montserrat package does not provide any math support, so if I write any \mathsf in math formulas, I get the kpfonts sans serif math font. On the other hand, letters and numbers from Montserrat look very well also in math mode (in the rare cases one wants to render sans serif math).

Here is an example to see what I mean.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[light,onlyrm]{kpfonts}
\usepackage[light,scale=0.85]{montserrat}

\usepackage[sf,uppercase]{titlesec}

\newcommand*\elseries{\fontseries{el}\selectfont}

\titleformat*{\section}{\sffamily\elseries\large}

\begin{document}
  \section{Section Title}
  A little piece of text, \textsf{with some sans serif parts}, and some math:
  \begin{equation*}
  e^{i\pi}+1=0
  \end{equation*}
  Plus some sans serif math:
  \begin{equation*}
  \mathsf{e^{i\pi}+1=0}
  \end{equation*}
  Good looking sans serif math:
  \begin{equation*}
  \text{\textsf{e}}^{\text{\textsf{i}}\pi} + \text{\textsf{1}} = 
  \text{\textsf{1}}
  \end{equation*}
\end{document}

example

So, is there a way to fake math support and use montserrat glyphs for sans serif math, at least for numbers and latin letters? I'd prefer to stick to solutions that work with pdflatex.

EDIT: note that the Montserrat font itself does not appear to have greek glyphs not any math-related feature. However, if you look at the sans serif math font from kpfonts, you'll notice the only real difference is in numbers and latin letters, so greek letters and other symbols do not appear different in normal math mode and in \mathsf, and for me this is ok. So really to achieve what I want I only need to swap the glyphs for numbers and latin letters.

2
  • Your last requirement makes it very hard; in XeLaTeX for instance mathspec works like a charm.
    – TeXnician
    Commented Dec 4, 2017 at 6:01
  • I understand, please try anyway XD Commented Dec 4, 2017 at 6:08

1 Answer 1

5

You can easily map \mathsf to montserrat. But apart from some math in section titles I don't see why you would want to write e.g. the numbers as sans serif.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[light,onlyrm]{kpfonts}
\usepackage[light,scale=0.85]{montserrat}

\usepackage[sf,uppercase]{titlesec}

\newcommand*\elseries{\fontseries{el}\selectfont}

\titleformat*{\section}{\sffamily\elseries\large}

\SetMathAlphabet{\mathsf}    {normal}{T1} {Montserrat-LF} {l}{n}


\begin{document}
  \section{Section Title}\makeatletter
  A little piece of text, \textsf{with some sans serif parts}, and some math:
  \begin{equation*}
  e^{i\pi}+1=0
  \end{equation*}
  Plus some sans serif math:
  \begin{equation*}
  \mathsf{e^{i\pi}+1=0}
  \end{equation*}
  Good looking sans serif math:
  \begin{equation*}
  \text{\textsf{e}}^{\text{\textsf{i}}\pi} + \text{\textsf{1}} =
  \text{\textsf{1}}
  \end{equation*}

   \begin{equation*}
  \mathsf{e}^{\mathsf{i}\pi} + \mathsf{1} =
  \mathsf{1}
  \end{equation*}
\end{document}

enter image description here

1
  • That's exactly what I was looking for, thank you! Commented Dec 4, 2017 at 12:17

You must log in to answer this question.

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