Verbatim Code Bold/Italic

When using bold/italic in verbatim code (as a result of highlighting with pygments), the alignment gets off because TeXmacs does not use true monospaced bold fonts. Is there a way to fix this?

Hi @olynch, do you have an example of a monospaced font with proper bold and italic variants we could test?

Dejavu Sans seems to have a monospaced bold font. It seems to get picked up properly in the main document, but verbatim-code blocks use the serif font by default:

I’ll have another look at it later on.

1 Like

Okay, so I had another look at this. Something seems to be going wrong with Dejavu Sans (I haven’t figured out what yet).

Other fonts do work properly, though. A difficulty is finding font families with both monospace bold and monospace italic. A useful tool for this is the filter in the font selection dialogue. On the right hand side of this window, you can pick Spacing -> Monospaced and then either Weight -> Bold or Slant -> Italic.

On my system, I could identify Liberation Sans, TeXmacs Courier, Source Code Pro and TeX Gyre Cursor as having both mono bold and mono italics.

Once you have found a versatile font that you like, you can redefine the verbatim-code tag to use it (ask if you need help with this).

Hi, sorry I should have said this earlier, but thank you for your help!

1 Like