1

This is a follow-up question to the previous one of mine.

Consider the following MWE.

\documentclass{article}
\usepackage[all]{tcolorbox}
% \usepackage{newtxtt}
\begin{document}
\begin{docCommand}{foo}{}
  \verb|\foo|
\end{docCommand}
\end{document}

The result (with Computer Modern) is like the following and this is as intended:

Output w/ CM

If we uncomment the line \usepackage{newtxtt}, the red \foo gets bold while the black one remains regular weight.

Output w/ newtxtt

Font packages with which this issue can be confirmed are

  • Courier (\usepackage{courier}),
  • DejaVu (\usepackage{dejavu}),
  • Fira (\usepackage{FiraMono}),
  • Incondolata (\usepackage{zi4}), and
  • Source Code Pro (\usepackage{sourcecodepro}).

I find it very weird that the font series used in the first argument of docCommand environment varies according to the font family. How come this happens?

yudai-nkt
  • 921
  • 1
    Ulrike Fischer answered the question. I will add a new option keywords bold to the next tcolorbox version to switch off boldface, if needed. – Thomas F. Sturm Apr 25 '17 at 09:05
  • @ThomasF.Sturm I appreciate it if you consider that option deserves implementation as a package feature. Redefining \tcb@Print@***s is easy but provision of such interface would be much better IMHO. – yudai-nkt Apr 25 '17 at 11:02

1 Answers1

2

The font series is bold for all font families. But the typewriter font family of computer modern has no bold variant and so LaTeX falls back to the normal series. In the log you will find the message:

LaTeX Font Info:    Font shape `OT1/cmtt/bx/n' in size <10> not available
(Font)              Font shape `OT1/cmtt/m/n' tried instead on input line 7.
Ulrike Fischer
  • 327,261
  • You were some seconds faster than me :-) Indeed, the docCommand is intended to set the key words bold, but does not work for the original computer modern typewriter font. – Thomas F. Sturm Apr 25 '17 at 08:21
  • To my shame, I didn't know the lack of boldface in CM while LM has font series b... – yudai-nkt Apr 25 '17 at 08:37
  • @ThomasF.Sturm: Sorry but it was in the core a fonts question ;-). But here a tcolorbox for you: is there a better way to set the baseline measured from the top that this one: http://www.mrunix.de/forums/showthread.php?77202-Vertikale-Ausrichtung-einer-tcolorbox-in-einer-enumerate-Umbegung&p=362624&viewfull=1#post362624 – Ulrike Fischer Apr 26 '17 at 08:36