# Combine \textbf and \texttt

I'm trying to combine \textbf{} with \texttt{} to obtain a code style that is more "fat". I tried to combine first \textbf and then \texttt and viceversa but nothing changed, it seems like \texttt has a priority over \tetxbf:

• You need to use a font which has a bold typewriter. Oct 23 at 10:33

The Courier teletype font family provides both a light/regular and a bold font weight, with the weights looking very distinct.

Other teletype font families, including Latin Modern Mono, provide regular and bold font weights as well; however, their looks aren't as different from one another as in the case of the Courier teletype font.

To generate the preceding screenshot, just replace \usepackage{courier} with \usepackage{lmodern} in the code shown below.

\documentclass{article}
\usepackage{courier} % or: \renewcommand{\ttdefault}{pcr}
\begin{document}
Example \textbf{Example} \texttt{Example} \texttt{\textbf{Example}}
\end{document}

• Inconsolata is another one they might want to try out. Oct 23 at 14:48
• @Davislor - I fully agree. As a general proposition, I'd say that it can't be a good idea to use a monospaced font whose regular and bold font weights are so similar as to leave readers unsure as to whether a given monospaced word is typeset in regular or bold. That's why I held up Courier as a font to consider using. Inconsolata/Consolas is definitely a fine choice as well.
– Mico
Oct 23 at 19:16

With contour package, you can get fatter characters as a type of special effect when the contourlength is set to a relatively small amount:

(contour is designed for printing readable text on top of images, and usually the contour colour would be white or some other light colour)

MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{contour}
\usepackage{fontspec}
\newfontfamily{\ffmono}{Noto Sans Mono}
\newfontfamily{\ffcourier}{Courier New}
\newcommand{\testtext}{%
\par\bigskip
\begin{tabular}{ll}
font regular &  plain  \\
font bold& \textbf{bold} \\
contour& \contour{black}{bold} \\
contour red and yellow& \contour{red!20}{bold} \contour{yellow}{bold} \\
fatter contour& \contourlength{0.05em} \contour[40]{black}{bold} \contour[40]{red!20}{bold} \contour[40]{yellow}{bold} \\
\end{tabular}
\par
}

\begin{document}
\ttfamily
Default font
\testtext
\bigskip\ffcourier Courier New
\testtext
\bigskip\ffmono Noto Sans Mono
\testtext
\end{document}


1.

\documentclass{article}
% \usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
\ttfamily
\fontseries{l}\selectfont light
\fontseries{m}\selectfont medium
\fontseries{b}\selectfont bold
\end{document}

1. \documentclass{article}
% \usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{bold-extra}

\begin{document}
\textbf{qwe} \texttt{qwe} \texttt{\textbf{qwe}}
\end{document}

• I think this answer would benefit from some additional explenations. Especially to make it more clear that the first example works because of lmodern and not because it uses \fontseries{b} directly. Also the second example does not need bold-extra since it loads lmodern. Maybe you wanted to omit that package there? Oct 23 at 11:42