This question was asked and answered 20 years ago but I wonder if there is a more modern solution today that does not involve quite so much hackery with overriding settings in font files.

I want my font to look exactly like the result of \texttt but in bold face.

How might I achieve this?

  • 2
    I would guess the same solution still holds. Mainly that \texttt (using Computer Modern Typerwriter font) does not have a bold font. So you'd have to get a bold typewriter font first... – Werner Dec 5 '14 at 5:09
  • 3
    @Werner, In 20 years we have not created a bold typewriter font that looks like Computer Modern with bold? – merlin2011 Dec 5 '14 at 5:15
  • 2
    i did this 30+ years ago, for a special project. the problem is, cmtt is too heavy to support a bold that is readable, and not bold enough to look bold unless the companion lightface is so light that it breaks up in printing. so two new fonts had to be created -- one lighter and one bolder. (they were never released.) latin modern has fixed the problem. – barbara beeton Dec 5 '14 at 15:56

Use Bera Mono:

\usepackage{libertine}%% Only as example for the romans/sans fonts
  • libertine is too wide. beramono seems to make no difference – voices May 23 '19 at 2:11

There are the Latin Modern Fonts, from their README:

The fonts are based on Donald E. Knuth's Computer Modern fonts in the PostScript Type 1 format

In family lmtt, there are even three series:

% \usepackage[T1]{fontenc}
\fontseries{l}\selectfont light
\fontseries{m}\selectfont medium
\fontseries{b}\selectfont bold


They are also available in OpenType font format with a math version.

The number of glyphs is dramatically increased in comparison to the old Computer Modern fonts.

Thus indeed much has happened in the last twenty years.

  • 2
    cfr-lm includes commands to switch analogous to the standard end-user font commands e.g. \textlg{} and \lgweight. (Not series because that conflates two dimensions of fonts: weight and width.) – cfr Dec 5 '14 at 17:38
  • Can I choose a level for the keywords in a lstlisting? – user4417 Jan 18 '19 at 20:06
  • @user4417 This question seems unrelated to this question or this answer. Therefore I suggest making a new question. – Heiko Oberdiek Mar 28 '19 at 22:25

I just ran across it and found a simpler answer here: https://en.wikibooks.org/wiki/LaTeX/Fonts

\texttt{TT Text \textbf{Bold TT Text}}
  • 5
    Welcome to TeX.SE. Note that the site you say the excerpt is from has the code snippet as \textsc{TT Text \textbf{Bold TT Text}}, not as \texttt{TT Text \textbf{Bold TT Text}}. Please indicate how you can get your code snippet to work. – Mico Mar 2 '16 at 21:44
  • 2
    It's not working with \texttt{}, only with \textsc{}. – Fuji San Oct 27 '16 at 13:22
  • 3
    Prompted by another answer/comment, I tried this myself, and it works for me on TeX Live 2017 on macOS. (\documentclass{article} \usepackage{bold-extra} \begin{document} \texttt{TT Text \textbf{Bold TT Text}} \end{document}) The first time I ran it, METAFONT was invoked (via mktextfm via kpathsea) to create the font cmttb10. Note that this is a bitmap font (and with sufficient zoom visible as such in the PDF), but at typical print and screen resolutions, this is not a problem. – ShreevatsaR Feb 9 '18 at 21:38
  • I will remember this one! +1 – Amir Hossein Dec 9 '19 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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