Hi Francis, On Thu, Jan 16, 2025 at 6:52 PM Francis Wright <f.j.wri...@live.co.uk> wrote:
> The problem is the fall-back font, which should be monospace, not serif. > 'Nimbus Mono L' would probably be fine, but I don't have it installed on my > computer! > > This example also illustrates another problem, which is that if I fix the > font problem (say, by editing "bug.css" by hand) then the space after the > word "minimize" is too long, i.e. noticeably longer than the space before > the word, which looks quite ugly. I presume this is because the </span> > follows the space after the word, whereas is should precede it, as in the > source file. > > I was actually trying to track down a slightly different bug affecting the > use of \texttt in a large document. For that document, TeX4ht generates > invalid CSS such as > > .pcrr8t-x-x-109{font-weight: monospaced;} > Which TeX distribution do you use? I get this CSS with TeX Live 2024: .pcrr7t-{ font-family: 'Nimbus Mono L', monospace,monospace;} I know that I fixed all monospaced fonts a few years ago, because I found that we need to use "monospace,monospace" in the font family to get the correct font size. Just a single monospace produces text which is smaller than the surrounding non-monospaced text. Regarding space, I think it is marked in monospaced because the markup in this case is produced by post-processing of the DVI file, so it changes the font style only after it finds next characters in another font. What you can do? It is best to use explicit configuration to \Configure{texttt} to produce HTML markup. You can try the "fonts" option: $ make4ht -m draft sample.tex "fonts" But it is possible that your distro doesn't know this option either. You can then configure it directly in a config file: \Preamble{xhtml} \Configure{texttt}{\HCode{<code>}\NoFonts}{\EndNoFonts\HCode{</code>}} \Css{code{font-family:monospace,monospace;}} \begin{document} \EndPreamble Best regards, Michal