Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
3  
Welcome to TeX.SX! My test tells me that \textbf is obeyed. Can you show a minimal example of code producing the issue? –  egreg Nov 1 '12 at 0:40
add comment

2 Answers 2

up vote 8 down vote accepted

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:

LaTeX Font Warning: Font shape `OT1/cmss/b/n' undefined
(Font)              using `OT1/cmss/m/n' instead on input line 6.

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} because lmodern, while optically pretty identical to the default Computer Modern font, has a b-not-bx-bold for its sans-serif typeface.

share|improve this answer
2  
Another possibility is to say \renewcommand{\bfdefault}{bx} after loading charter, since the font description files for the bch family define substitutions from bx to b. But this is irrelevant if one changes \familydefault to mean \sfdefault: the easiest fix is to remove the loading of charter, which becomes useless. –  egreg Nov 1 '12 at 10:32
    
Thanks - this is helpful. I recently switched to TexWorks (Mac), which by default automatically hides the output console unless there's an error, which is why I wasn't seeing this warning. –  Señor O Nov 1 '12 at 16:22
add comment

It is always helpful to supply a complete small document that shows the problem. If I try:

\documentclass{article}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{array}

\begin{document}

\showoutput
aaa \textbf{bbb} {\bf ccc}

\end{document}

Then the log (and the pdf result) show that both bbb and ccc are bold sans serif, using the same font:

....\OT1/cmss/m/n/10 a
....\OT1/cmss/m/n/10 a
....\OT1/cmss/m/n/10 a
....\kern 0.0
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmss/bx/n/10 b
....\OT1/cmss/bx/n/10 b
....\OT1/cmss/bx/n/10 b
....\kern 0.0
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmss/bx/n/10 c
....\OT1/cmss/bx/n/10 c
....\OT1/cmss/bx/n/10 c

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.