michal-h21/tex4ebook

Problem with accented small caps

Closed this issue · 4 comments

Hi

When generating a epub ( epub or epub3 format), accented small caps are rendered as normal characters. For instance for the input file

\documentclass[a5paper,11pt,twoside]{book}
\usepackage{tex4ebook}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\textsc{Bonne année èeê ïiî 'e`e}
\end{document}

gives as output

Bonne année èeê ïiî éè

From what I have seen elsewhere I am afraid that fixing this bug may be rather hard...

Frédéric

I am not sure the source code will be visible. So I explicit here. Non accented letters are under too spans:
span class='eccc1095-' and span class='small-caps' while for accented letters there is only:
span class='eccc1095-'

For an outsider, what is puzzling is that a single \textsc is translated by many span class='small-caps' (one per word, and then words with accented letters are subdivided).

Frédéric

Hi Frédéric,

font commands like \textsc, or \textit use tex4ht post-processing by default. This post-processing is dependent on the the used fonts and how they are output in the DVI file. So you can get these weird issues if characters from different encodings are used in one word.

You can request to use generic elements using the "fonts" option. Like

 tex4ebook -f epub3 filename.tex "fonts"

Alternatively, you can configure \textsc in the configuration file using:

  \Configure{textsc}{\Protect\HCode{<span class="textsc">}\NoFonts}
                    {\EndNoFonts\Protect\HCode{</span>}}
 \Css{span.textsc { font-variant: small-caps; }}

This is the code used by the fonts option, but only for the \textsc command. The \NoFonts command prevents creation of <span class="eccc1095"> etc. This will support also the accented characters.

Best,
Michal

Hi Michal

I just check adding the "fonts" argument and the output looks fine for the whole book. I had not found this solution when I searched for one online.

Thanks a lot.

Best,
Frédéric

Hi Frédéric,

most of options are described here: https://www.kodymirus.cz/tex4ht-doc/texfourhtOptions.html, but info about the fonts option is not really clear. I will try to make it better understandable.

Best,
Michal