5

I feel stupid. The Iwona package seems to load Iwona as \rmfamily font but I want to use it as sans serif font, after all it is a sans serif font... How do I get it as the \sffamily font?


Example for clarification:

\documentclass{article}

\usepackage{iwona}

\begin{document}
This should be Computer Modern but is Iwona

\sffamily
This should be Iwona but is Computer Modern Sans Serif
\end{document}
jonalv
  • 11,466
  • 1
    Hm, I just made a very simple document with Iwona and it's sans serif –  Feb 12 '16 at 15:10
  • yes... But it doesn't load into the \textsf{} command but it goes as default font – jonalv Feb 12 '16 at 15:13
  • Hm, I not sure I understand you correctly. Do you want to have the font sans serif for the whole document? Does \renewcommand{\rmdefault}{\sfdefault} help then? –  Feb 12 '16 at 15:15
  • Hm it's very much Friday afternoon and I am not making a good work at explaining I guess. I would need to do something like: (pseudocode) \temp = \rmdefault; \usepackage{iwona}; \sfdefault = \rmdefault; \rmdefault=\temp; – jonalv Feb 12 '16 at 15:20
  • @jonalv prefix assignments with \let as in \let\temp=\rmdefault and that's exactly what you should do – David Carlisle Feb 12 '16 at 15:31
  • @DavidCarlisle Oh that's so easy! It really is Friday... :) – jonalv Feb 12 '16 at 15:50

1 Answers1

5

Prepare a file sansiwona.sty

\ProvidesPackage{sansiwona}

\DeclareOption{regular}{\renewcommand{\sfdefault}{iwona}}
\DeclareOption{light}{\renewcommand{\sfdefault}{iwonal}}
\DeclareOption{condensed}{\edef\sfdefault{\sfdefault c}}
%\DeclareOption{mathnoalias}{\let\define@iwona@mathversions\relax}
\DeclareOption{math}{%
  \let\define@iwona@mathversions a%
  \PassOptionsToPackage{mathnoalias}{iwona}%
}

\ExecuteOptions{regular}
\ProcessOptions

\let\sansiwona@saved@rmdefault\rmdefault
\let\sansiwona@saved@bfdefault\bfdefault

\RequirePackage[mathnoalias]{iwona}

\let\rmdefault\sansiwona@saved@rmdefault
\let\bfdefault\sansiwona@saved@bfdefault
\mathversion{normal}

\endinput

Then the document

\documentclass{article}
\usepackage[math]{sansiwona}

\begin{document}

What font will this be?

{\sffamily And this? \bfseries And this?}

$a+b=\sum$

\mathversion{iwona}

$a+b=\sum$

\end{document}

will do the right thing, because the “wrong” settings made by iwona.sty are reverted.

Put sansiwona.sty where TeX will find it, see Adding style files

enter image description here

The math option is needed only if you need Iwona Math.

egreg
  • 1,121,712