>> Here's the thing: The CM family doesn't contain a font for >> monospace bold. Since `texinfo.tex` essentially only uses this >> font family, there is no support for it. > > Ah! OK, of course. Given your help offer below, I suppose you have > another font in mind. What would that be?
Alas, after some investigation I found out it would be very cumbersome to set up both bold and bold italic typewriter fonts that have the same metrics as CM typewriter, and which works with pdfTeX, luatex, and XeTeX. For this reason, I use a PDF primitive instead to embolden the glyphs. It's not optimal, since such emboldened glyphs are not hinted very well, but it is quite a simple solution. Attached is my code. This works with an unmodified `texinfo.tex`; simply append the stuff (without the example at the end of the file) to `Documentation/en/macros.itexi`. Werner
\input texinfo.tex @tex % Modify `@setcolor` to make it work in `@example` environments. \gdef\setcolor{\begingroup \spaceisspace \dosetcolor} \gdef\dosetcolor#1{% \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% \endgroup \domark \pdfsetcolor{#1}% } % There doesn't exist bold typewriter within the CM family; we thus provide % an internal command to embolden glyphs with PDF primitives. Obviously, % this works only for PDF output. \ifx\XeTeXrevision\thisisundefined % for pdfTeX and luatex \gdef\embolden#1#2{% \pdfliteral direct {2 Tr #1 w}% #2% \pdfliteral direct {0 Tr 0 w}% } \else % for XeTeX \gdef\embolden#1#2{% \special{pdf:literal direct {2 Tr #1 w}}% #2% \special{pdf:literal direct {0 Tr 0 w}}% } \fi % Internal font setup commands for `@tb` and `@tbsl`. Note that CM is one % of the few font families that offer both a slanted and a real italic shape % for typewriter. \gdef\dotb#1{\embolden{0.2}{\texttt #1}} \gdef\dotbsl#1{\embolden{0.2}{\textttsl #1}} @end tex @c A generic macro `@color` to set the color globally. @iftex @macro color {clr} @setcolor{\clr\} @end macro @end iftex @ifnottex @macro color {clr} @end macro @end ifnottex @c Since stuff like `@t{@b{...}}` doesn't work in texinfo, provide `@tb` as @c a command to access bold typewriter. @iftex @macro tb {arg} @dotb{\arg\} @end macro @end iftex @ifnottex @macro tb {arg} \arg\ @end macro @end ifnottex @c Provide another command `@tbsl` to access bold slanted typewriter. @iftex @macro tbsl {arg} @dotbsl{\arg\} @end macro @end iftex @ifnottex @macro tbsl {arg} \arg\ @end macro @end ifnottex @c ========================================================================= @node tests for pygments support @section tests for pygments support before @example example@t{typewriter}example example@color{1 0 0}@t{typewriter}@color{0 0 0}example example@tb{typewriter bold}example example@color{0 1 0}@tb{typewriter bold}@color{0 0 0}example example@tbsl{typewriter bold italic}example example@color{0 0 1}@tbsl{typewriter bold italic}@color{0 0 0}example @end example @noindent after @bye
pygments.pdf
Description: Adobe PDF document