[tex4ht] Fwd: Getting rid of <span class="cmr-9"> breaks in footnotes

Jürgen Hubert jhubert at gmx.de
Sat Jul 4 07:50:41 CEST 2020

> Gesendet: Freitag, 03. Juli 2020 um 20:46 Uhr
> Von: "Michal Hoftich" <michal.h21 at gmail.com>

> These <span> elements are inserted by HT Fonts. You can suppress them,
> but it is then necessary to provide configurations that insert HTML tags
> for \textit, \textbf and similar commands. Fortunately, it is possible
> to do that using the "fonts" option, so you don't need to configure them
> yourself. So it is necessary just to configure footnotes to ignore HT
> Fonts.
> Try the following .cfg file:
> \Preamble{xhtml,fonts}
> \Configure{footnote-text}
>     {\HPage{}\HCode{<div class="footnote-text">}\par\NoFonts}
>     {\ifvmode \IgnorePar\fi \EndP
>      \EndNoFonts\HCode{</div>}\EndHPage{}}
> \Css{.footnote-text{font-size:0.9em;}}
> \begin{document}
> \EndPreamble
> It is a direct copy from html4.4ht, I've just added the \NoFonts and
> \EndNoFonts commands, so no <span> elements will be used in the footnote
> text.

Thank you for the quick reply! I tried it out, and the HTML code was indeed cleaned up:

     <div class="footnote-text"> 
    <!--l. 15--><p class="indent" >   <span class="footnote-mark"><a 
 id="fn5x1"><sup class="textsuperscript"><a 
href="EPUBSCEPch1.html#x6-5037r7">5</a> </sup></a></span>Yes, the German text explicitly says that the curly hair is from his head. This may be a story about the
     Devil, but it still should be suitable for <span class="textit">children</span>.</p></div>

Unfortunately, the problem persisted even after this change. I investigated further by manually editing the EPUB file with Calibre, and it turns out that the problem wasn't actually the </span><span> tags - it was the line break between "the" and "Devil". The empty spaces _also_ seem to be displayed in the popup.

Yes, Amazon - one of the biggest companies in the world with massive amounts of IT resources - is unable to interpret HTML correctly with their "popup footnote" feature.


So, uhm, do you see any way of eliminating this line break and the unnecessary empty spaces while compiling the EPUB file?

Otherwise I will just have to resign myself to either trying to fix this via half-remembered Unix regex commands (wince) or fixing my footnotes manually (double wince). It will be a chore, but it won't prevent publication...

Best regards,

- Jürgen

More information about the tex4ht mailing list.