7

I need to typeset a whole document sans serif with sourcesanspro, including formulas. I know that there are a lot of arguments against doing this, but in this particular case it makes sense.

My problem is (as often asked at several places of the web), that I don't find a proper sans serif math font. I searched the web for hours and tested a lot of possibilities (arec. cmbright, iwona ...) but ended up using sansmath.

As far as I understood sansmath, it uses the default sans serif family for typesetting formulas. The problem is, that sourcesanspro doesn't include greek letters or symbols like blackboard fonts.

Is it possible to replace several symbols of the math font, e. g. greek letters, by the greek letters of other fonts manually?

That's my MWE, so far:

\documentclass{scrartcl}

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

\usepackage{amsmath, amssymb}

\usepackage[default]{sourcesanspro}

\usepackage{sansmath}
\sansmath

\begin{document}


\noindent
ABCDEFGHIJKLMNOPQRSTUVWXYZ \\
abcdefghijklmnopqrstuvwxyz \\
$abcdefghijklmnopqrstuvwxyz$ \\
$ABCDEFGHIJKLMNOPQRSTUVWXYZ$ \\
$\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\varkappa\lambda\mu\nu\xi o\pi\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega$ \\
$\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega$ \\
$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
\[
  \frac{1}{2\pi i}\int_\gamma f = \sum_{k=1}^m n(\gamma;a_k) \cdot \text{Res}(f;a_k).
\]

\end{document}

Sans serif document

dawu
  • 1,648
  • See http://tex.stackexchange.com/questions/174386/detexify-couldnt-help-me-find-and-can-you/174429#174429 – JPi Aug 11 '14 at 13:13
  • Thank you! Nice to be here! This site is a real enrichment for (La)TeX user! – dawu Aug 11 '14 at 15:17

1 Answers1

8

This uses Iwona for Greek, change the font family in \DeclareSymbolFont if you want a different font.

\documentclass{scrartcl}

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

\usepackage{amsmath, amssymb}

\usepackage[default]{sourcesanspro}

\usepackage{sansmath}
\sansmath

\DeclareSymbolFont{Greekletters}{OT1}{iwona}{m}{n}
\DeclareSymbolFont{greekletters}{OML}{iwona}{m}{it}
\DeclareMathSymbol{\Delta}{\mathord}{Greekletters}{"01}
\DeclareMathSymbol{\Theta}{\mathord}{Greekletters}{"02}
\DeclareMathSymbol{\Lambda}{\mathord}{Greekletters}{"03}
\DeclareMathSymbol{\Xi}{\mathord}{Greekletters}{"04}
\DeclareMathSymbol{\Pi}{\mathord}{Greekletters}{"05}
\DeclareMathSymbol{\Sigma}{\mathord}{Greekletters}{"06}
\DeclareMathSymbol{\Upsilon}{\mathord}{Greekletters}{"07}
\DeclareMathSymbol{\Phi}{\mathord}{Greekletters}{"08}
\DeclareMathSymbol{\Psi}{\mathord}{Greekletters}{"09}
\DeclareMathSymbol{\Omega}{\mathord}{Greekletters}{"0A}

\DeclareMathSymbol{\alpha}{\mathord}{greekletters}{"0B}
\DeclareMathSymbol{\beta}{\mathord}{greekletters}{"0C}
\DeclareMathSymbol{\gamma}{\mathord}{greekletters}{"0D}
\DeclareMathSymbol{\delta}{\mathord}{greekletters}{"0E}
\DeclareMathSymbol{\epsilon}{\mathord}{greekletters}{"0F}
\DeclareMathSymbol{\zeta}{\mathord}{greekletters}{"10}
\DeclareMathSymbol{\eta}{\mathord}{greekletters}{"11}
\DeclareMathSymbol{\theta}{\mathord}{greekletters}{"12}
\DeclareMathSymbol{\iota}{\mathord}{greekletters}{"13}
\DeclareMathSymbol{\kappa}{\mathord}{greekletters}{"14}
\DeclareMathSymbol{\lambda}{\mathord}{greekletters}{"15}
\DeclareMathSymbol{\mu}{\mathord}{greekletters}{"16}
\DeclareMathSymbol{\nu}{\mathord}{greekletters}{"17}
\DeclareMathSymbol{\xi}{\mathord}{greekletters}{"18}
\DeclareMathSymbol{\pi}{\mathord}{greekletters}{"19}
\DeclareMathSymbol{\rho}{\mathord}{greekletters}{"1A}
\DeclareMathSymbol{\sigma}{\mathord}{greekletters}{"1B}
\DeclareMathSymbol{\tau}{\mathord}{greekletters}{"1C}
\DeclareMathSymbol{\upsilon}{\mathord}{greekletters}{"1D}
\DeclareMathSymbol{\phi}{\mathord}{greekletters}{"1E}
\DeclareMathSymbol{\chi}{\mathord}{greekletters}{"1F}
\DeclareMathSymbol{\psi}{\mathord}{greekletters}{"20}
\DeclareMathSymbol{\omega}{\mathord}{greekletters}{"21}
\DeclareMathSymbol{\varepsilon}{\mathord}{greekletters}{"22}
\DeclareMathSymbol{\vartheta}{\mathord}{greekletters}{"23}
\DeclareMathSymbol{\varpi}{\mathord}{greekletters}{"24}
\DeclareMathSymbol{\varrho}{\mathord}{greekletters}{"25}
\DeclareMathSymbol{\varsigma}{\mathord}{greekletters}{"26}
\DeclareMathSymbol{\varphi}{\mathord}{greekletters}{"27}


\begin{document}


\noindent
ABCDEFGHIJKLMNOPQRSTUVWXYZ \\
abcdefghijklmnopqrstuvwxyz \\
$abcdefghijklmnopqrstuvwxyz$ \\
$ABCDEFGHIJKLMNOPQRSTUVWXYZ$ \\
$a\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\varkappa\lambda\mu\nu\xi o\pi\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega$ \\
$\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega$ \\
$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$
\[
  \frac{1}{2\pi i}\int_\gamma f = \sum_{k=1}^m n(\gamma;a_k) \cdot \text{Res}(f;a_k).
\]
\end{document}

enter image description here

Personal opinion Sans serif math can be justified only in a presentation.

egreg
  • 1,121,712
  • That's exactly what I looked for, thank you very much!

    Just to be clear:

    – dawu Aug 12 '14 at 09:41
  • Just to be clear: \DeclareSymbolFont{Greekletters}{OT1}{iwona}{m}{n} declares the new symbol font Greekletters using iwona and \DeclareMathSymbol{\Delta}{\mathord}{Greekletters}{"01} (re)declares the command \Delta to be typeset in Greekletters font?

    One more question: Where do I find the numbers, e. g. "01 for the large delta?

    Personal answer I totally agree with you! I create a document class (my first, by the way) for overhead transparencies I want to use at school.

    – dawu Aug 12 '14 at 09:52
  • The numbers are the standard ones for OT1 (uppercase Greek) and OML (lowercase Greek) encoded fonts; you find them in fontmath.ltx. Note that I changed the default \mathalpha for the uppercase Greek into \mathord or the letters would respect the \sansmath declaration. – egreg Aug 12 '14 at 09:56
  • Okay! Thank you very much! Fonts are a really big topic (despite or maybe because of the many information in the web), so it is really helpful to get some support here. :o) – dawu Aug 12 '14 at 10:52
  • Unfortunately it does not work with numbers. Just add
    $1234567890$\\```
    to the example and you'll see. Any tip to solve it?
    
    – LEo Jan 06 '21 at 21:13
  • @LEo There is a 2 in the example formula and it is sans serif. – egreg Jan 06 '21 at 21:54
  • @egreg not inline... just add the 1234... as you added the abcd... and you will see. – LEo Jan 07 '21 at 01:09
  • @LEo Sorry, but if I add 1234567890\\$1234567890$ just after \noindent, I get the expected result: the digits print the same and sans serif. – egreg Jan 07 '21 at 06:15
  • @egreg here is the result I get: https://i.imgur.com/89SMiqy.png In fact, – LEo Jan 07 '21 at 12:36
  • @LEo Sorry, but it's not what I get from the example. You might have something different in your document. – egreg Jan 07 '21 at 12:41
  • @egreg it was a problem with Texmaker built-in viewer – LEo Jan 07 '21 at 12:47