I'm using \renewcommand{\familydefault}{\sfdefault}
so that my entire document is in sans serif, but I'm getting peculiar results with regards to formatting.
I'm a rather sparse LaTeX user, but in the past I've always used \textbf{Super Important Text!}
for bold text rather than what I've been told is obsolete; {\bf Important Junk}
(which is what I first learned).
While I have that \sfdefault
line in the preamble, \textbf{}
is completely ignored while {\bf }
is not. I suppose it wouldn't be the end of the world if the answer is that I just have to use {\bf }
, but I'm assuming there's a reason you're not supposed to.
The closest solution I could find was Bold sans-serif font in LaTeX, but it dealt with section names rather than in text formatting.
EDIT: My apologies – after recreating the document bit by bit, it turns out \usepackage{charter}
was causing this. The confusing part was that if I removed \renewcommand{\familydefault}{\sfdefault}
, then normal boldface functionality was restored. It turns out \textbf
wouldn't work iff both lines were in the preamble. Although I'm curious to know why this is, I don't need charter
for the project I'm currently working on, so for practical purposes this issue has been resolved.
\documentclass{article}
\usepackage{charter} % If either of these two are removed
\renewcommand{\familydefault}{\sfdefault} % There is no issue
\begin{document}
\textbf{Not bold.}
{\bf Quite Bold.}
Also Not Bold.
\end{document}
Not Bold. Quite Bold. Also Not Bold.
Best Answer
The root of the problem is a bit of a naming problem: Computer Modern's bold series is actually bold/extended, code bx, while most other fonts have an ordinary bold, code b. Your log file should tell you something like:
which translated to something readable means: "I don't have Computer Modern Sans in Bold Upright, so I'm using Computer Modern Sans in Medium Upright instead". (
charter
redefines bold to mean bold, not bold-extended, so that its boldface works.)The easiest fix is probably to use
\usepackage{lmodern,charter}
becauselmodern
, while optically pretty identical to the default Computer Modern font, has a b-not-bx-bold for its sans-serif typeface.