Is there a way to load packages Iwona and CMBright so that Iwona is used only for text, CMBright only for math, and all text and math is sans-serif?
The only command I've thought of so far are:
\usepackage{cmbright}
\usepackage{iwona}
\renewcommand*{\familydefault}{\sfdefault}
\SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n}
And it's certainly not quite right.
Thanks in advance to anybody who shall try to help me.
P.S. I can provide complete code if anybody feels it's gonna be useful.
ETA:
Here's some basic document from which we can try to solve my problem:
\documentclass{article}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsfonts, amsmath, amssymb}
\usepackage{lipsum}
\usepackage[math]{iwona}
\usepackage{cmbright}
\renewcommand*{\familydefault}{\sfdefault}
\SetSymbolFont{largesymbols}{normal}{OMX}{iwona}{m}{n}
\begin{document}
\section{A section}
\begin{equation}
S\!\left(x\right) = \mathsf{Pr}\!\left[X > x\right] \qquad \widehat{S}\!\left(t\right) = \textsf{exp}\!\left(-\widehat{H}\!\left(t\right)\right).
\end{equation}
\noindent \lipsum[1-1]
\end{document}
ETA:
We're almost there. The last thing that remains is the sections, subsections, and so forth font that is ultra bold and ugly, and as far as I know unrelated to Iwona. Is this a thing we can remedy? As for the body's font, I'd like the sections font to be Iwona's sans-serif… Thanks again!
ETA:
I think I found something really interesting for that last part:
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large}}
\makeatother
\makeatletter
\renewcommand\subsection{\@startsection {subsection}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\large}}
\makeatother
\makeatletter
\renewcommand\subsubsection{\@startsection {subsubsection}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\normalsize}}
\makeatother
Somehow, that really seems to do it, so now if anybody has time for it, I'd would like to understand (even if only a little bit more) why mixing fonts like I did isn't a good idea. I promise to do my best to be open-minded about the semantic problem it engenders.
ETA:
OK, took some time to do more testing, and my last solution wasn't quite right after all. I have nonetheless been able to redeem myselft (at least I think) with teh following code:
\documentclass{article}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsfonts, amsmath, amssymb}
\usepackage{lipsum}
\usepackage[math]{iwona}
\usepackage{sfmath}
\renewcommand*{\familydefault}{\sfdefault}
\begin{document}
\title{MY TITLE}
\date{}
\maketitle
\section{A section}
\section{Another section}
\subsection{A subsection}
\subsubsection{A subsubsection}
\begin{equation}
\begin{aligned}
S\!\left(x\right) & \ = \ \mathsf{Pr}\!\left[X > x\right]\\
H\!\left(x\right) & \ = \ \int_0^x h\!\left(t\right)\mathsf{d}t\\
\end{aligned}
\qquad
\begin{aligned}
\widehat{S}\!\left(t\right) & \ = \ \textsf{exp}\!\left(-\widehat{H}\!\left(t\right)\right)\\
\widehat{H}\!\left(t\right) & \ = \ \sum_{k \, | \, t_k \leq t} d_k / n_k
\end{aligned}
\end{equation}
\noindent \lipsum[1-1]
\end{document}
It has everything I wish for: sans-serif font, sans serif math, no ugly ultra bold sections font. The key is the package sfmath which does an amazing job.
That said, I would appreciate to be noticed if there somehow remains a ticking bomb hidden inside the document.
I would like to thanks anybody who tried to help me, especially cfr. Thank you mate. I mean it (it is very sad that my rep prevents me from upvoting you).
Best Answer
In no way do I recommend doing this as I think it is aesthetically extremely dubious, at best. However, this site is not concerned with whether things are typographically judicious but only with the most technically elegant implementations of them in TeX.
iwona
sets the font up as the default roman family.cmbright
sets up the font as the default sans family and then sets the default family to sans.So, if we load
iwona
first, we can letcmbright
overwrite the maths configuration, which will fall back toiwona
's choices for e.g.OMX
wheere these are not provided by CM Bright. (This is not a good idea but it seems to be what you have in mind.)We can then switch the default family back to roman to obtain Iwona for text.
See
cmbright
's documentation for suggestions concerning suitable large symbols, such ascmex
. These may go a bit better than mixing Iwona. But, since you are already mixing two sans fonts, perhaps large symbols are the least of your worries.You should also consider a solution which involves replacing just the symbols you do not like. There are several questions of this kind on the site to use as guides.
EDIT: NOTES
If you use the following code:
then you will get CM Bright for text and maths. The only exception is the large maths symbols, lacking from CM Bright, which will come from Iwona:
I think in that case, you might be better off dropping Iwona altogether and using the configuration suggested in
cmbright
's documentation:UPDATE
This is a response to the edited question. As I explain in a comment, the solution posted there is not a good one because it is not really doing what you think.
Let's start by examining the different fonts because this is causing some confusion:
Code:
I gather from comments, that you do not actually like Iwona. That is, you do not want to use the last font in the sampler above. This is not 'Iwona serif' or 'Iwona roman'. It is just Iwona. If you don't like that font, you don't like Iwona.
Computer Modern Sans
What you wish to use, I think, is either Computer Modern Bright or Computer Modern Sans Serif. The code I gave earlier demonstrates how to use CM Bright. To use Computer Modern Sans Serif:
The complication in all this is that
iwona.sty
installs Iwona as the default roman/serif family even though Iwona is actually a sans serif font. So, if you loadiwona
but then switch to sans for the document, you don't actually see any Iwona in use for text at all. (Unless you explicitly request the roman family.)I think what you really wish to do is to use the large maths symbols from Iwona to avoid the serif versions you otherwise get. And I'm not sure that is the best solution. However,...
Maths
What happens to maths? By default, nothing. All we've done is change the text font. As you explain,
sfmath
can be used to activate sans maths:This is taking large symbols from Computer Modern's
cmex
font, with letters and operators from the sans serif font.Large Symbols from Iwona
If you would prefer to take the large symbols from Iwona, you can do this:
Iwona, Bold and Computer Modern
The issue of bold sections is different. What happens if you load
iwona
is that it redefines the bold seriesSo the following document
will produce this:
That is, you cannot use bold at all. This happens because the far-from-ideal redefinition in
iwona.sty
interacts with the far-from-ideal default setup of the Computer Modern fonts. In fact, the manual forsfmath
recommends loadingfix-cm
and doing so before\documentclass
. Addingbefore
\documentclass
fixes the problem:So loading
iwona
merely to get non-bold sections is also going to kill bold everywhere. But fixing bold will also reinstate bold sections because if LaTeX can find bold fonts, it will use them for section headings by default. Moreover, it is likely to lead to inconsistencies in surprising places. It would be better to ask LaTeX for non-bold sections rather than hoping that LaTeX will be unable to find bold fonts at all.Non-Bold Sections
The
titlesec
package can be used to achieve this easily. The following passestitlesec
thesf
andmd
options for sans serif, medium weight section headings. [Note that the options aresf
andmd
rather thansffamily
andmdseries
i.e. they do not correspond to the LaTeX font commands\sffamily
and\mdseries
.]Importantly, this preserves your ability to use bold when you wish:
Note that even if you do not wish to use bold, loading
iwona
to get rid of it is not a good solution because some fonts (such as Iwona) do have a boldb
series and you are likely to get weird things happening. Moreover, your logs and output on the console will complain frequently about missing fonts, making it harder to identify real issues which you do want to find.