2

I'm trying to apply textbf and ttfamily simultanously, but the font is only getting monospaced and not bold.

Example:

\documentclass{book}

\begin{document}
\chapter{Testing}
\textbf{Bold}\\
\ttfamily{Monospaced}\\
\textbf{\ttfamily{Bold and Monospaced}}\\
\end{document}

Result:

How can I make the output become monospaced and bold at the same time?

Moriambar
  • 11,466
  • The standard Computer Modern fonts don't have a boldface monospaced type. The Latin Modern fonts do, and they also have a lighter version for medium, that can be activated with \usepackage[lighttt]{lmodern}. Give it a try. – egreg May 21 '13 at 19:27
  • \ttfamily acts like a switch. So, \ttfamily{A}B effects both the A and the B. To limit the effect of \ttfamily you need to enclose it in parentheses. – A.Ellett May 21 '13 at 19:28
  • @egreg, it worked, if you want to write as a answer, i'll mark as solved – Francisco Sokol May 21 '13 at 19:33
  • I beleive that it's not a duplicate, since is a different solution and I'm not using listings. – Francisco Sokol May 21 '13 at 19:34
  • @FranciscoSokol It's really the same: \ttfamily and \bfseries. Using listings is incidental. As I often say, closing as duplicate is not a judgment on the questioner, but rather a way to keep information more compact and useful for future readers. – egreg May 21 '13 at 19:38
  • @egreg -- your suggestion to use \usepackage[lighttt]{lmodern} isn't clearly presented in the cited reference, and it would make a much better answer if it were. a logical place to add it there would be in Ulrike's answer, but that would make nonsense out of some of the comments. i'm all for enhancing and consolidating, but i think this one is a bit tricky. – barbara beeton May 21 '13 at 19:45
  • @barbarabeeton I added an answer there: it was clearly missing. – egreg May 21 '13 at 19:46
  • @egreg -- okay. +1 there, and vote to close, and hope enough other people notice to kick the new answer up from the bottom. – barbara beeton May 21 '13 at 19:56

0 Answers0