I want to use Gentium as my mainfont and that is done by the command \usepackage{Gentium}. But I want "Computer Modern" to be my Bold font. Any idea of how to do it?
1 Answers
There's no Gentium package, but gentium; using uppercase in the package name can work in case insensitive file systems (Windows), but limits file portability, as \usepackage{Gentium} won't work on GNU/Linux or Mac OS X systems.
A simplistic solution is by patching \bfseries and \mdseries to check the current font family and, if it is the default (gentium), switch to CM, for \bfseries; to the contrary, if the font family is CM, switch to gentium.
Other font families are not affected as shown in the example.
However, the example also shows that Computer Moder Roman Bold is visually incompatible with Gentium, so I strongly advise you not to do this. Adventor and Cursor are used here just by way of example and I make no claim they're to be used along with Gentium.
As a general typographic rule, a normal document should use just one serif font family.
\documentclass{article}
\usepackage{gentium}
\usepackage{tgadventor}
\usepackage{tgcursor}
\usepackage{xpatch,pdftexcmds}
\xpatchcmd{\bfseries}
{\selectfont}
{\checkfamily{\familydefault}{cmr}\selectfont}
{}{}
\xpatchcmd{\mdseries}
{\selectfont}
{\checkfamily{cmr}{\familydefault}\selectfont}
{}{}
\makeatletter
\newcommand{\checkfamily}[2]{%
\ifnum\pdf@strcmp{\f@family}{#1}=\z@
\fontfamily{#2}%
\fi
}
\makeatother
\begin{document}
Some text in Gentium and \textbf{some in CM {\mdseries (this is Gentium)} and back to CM}
\sffamily
Some text in Adventor and \textbf{some in bf {\mdseries (this is md)} and back to bf}
\ttfamily
Some text in Cursor and \textbf{some in bf {\mdseries (this is md)} and back to bf}
\end{document}

A magnified view better showing the font clash

A longer and possibly more robust solution involves modifying the .fd files for Gentium.
If you use XeLaTeX or LuaLaTeX, then you can get this more easily:
\usepackage{fontspec}
\setmainfont{Gentium}[
BoldFont={Latin Modern Roman 10 Bold}
]
\setsansfont{TeX Gyre Adventor}
\setmonofont{TeX Gyre Cursor}
Some more juggling with the sizes should be necessary.
- 1,121,712
Fontspeccan probably do this. – 1010011010 Dec 23 '14 at 09:50