1

After playing around with tex4ebook, I've noticed that italic and bold in footnotes don't work correctly if fontspec package is loaded. It applies the bold/italic, but the text is no longer footnote size, and is instead larger than the rest of the footnote text. If fontspec is not loaded, then the italic and bold text in the footnotes are sized correctly. I'm using lualatex. MWE:

\documentclass{scrbook}
\usepackage{fontspec}
\begin{document}
Some text here. \footnote{This footnote is \textit{italic} and \textbf{bold}}.
\end{document}

With a simple config file:

\Preamble{xhtml,svg,no-cut}
\begin{document}
\EndPreamble

Does anyone have any ideas to get around this? Ultimately, I want to embed a latin script font into my ebook, but the ebook has some small bits of text from other alphabets, which, for my standard tex pdf, I have used new fontspec families to print. For tex4ebook I think the recommended solution for multilingual ebooks is fontspec (https://www.kodymirus.cz/tex4ht-doc/Configurations.html#unicode), but I have the above fontspec problem, so I need to solve one of these problems.

As an aside, I am not sure how embedding a font that doesn't cover all unicode letters used (i.e. my book is multilingual) will work in tex4ebook in Lualatex, if anyone has any advice on that too.

Thanks very much!

1 Answer 1

1

The problem here is that with Fontspec, TeX4ht produces standard HTML tags <i> and <strong> for \textit and \textbf, instead of the default markup which looks like <span class="ec-lmr-9">. It is OK in most cases, but not when it is surrounded by smaller fonts, which use this formatting, as in the HTML code for footnotes:

<div class='footnote-text'>
<!-- l. 4 --><p class='indent'>   
<span class='footnote-mark'><a id='fn1x0'><a id='x2-3x'></a><sup class='textsuperscript'>1 </sup></a></span>
<span class='ec-lmr-9'>This footnote is </span><i>italic</i> <span class='ec-lmr-9'>and </span><strong>bold</strong></p></div>
          

In this case, you need to use CSS and declare <strong> and <i> tags which are inside footnote-text to have the same size as <span class='ec-lmr-9'>.

It can be done using this configuration file:

\Preamble{xhtml,svg,no-cut}
\Css{.footnote-text strong {font-size: 81\%}}
\Css{.footnote-text i {font-size: 81\%}}
\begin{document}
\EndPreamble

This is the result:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .