2

Try this following MWE and run tex4ebook, you will find that small caps are ignored in this epub. 1. Why? And 2. how to make it happen?

\documentclass[11pt,a4paper]{report}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\begin{document}

\textsc{A sentence with small caps of lmodern font, which is not showed in epub}

\end{document}

Update 1

When I use the .htf file that is shown in the first answer, small caps are respected when viewed with calibre ebook reader. But the size settings seem to be ignored. For example things like \textsc{\Huge Huge Text} or {\scshape\Huge Huge Text} seem to be ignored in the epub file when viewed with calibre. Thank you for suggestions how to fix this. The MWE for this detection is:

\documentclass[11pt,a4paper]{report}
\usepackage{lmodern}
%\usepackage[cmintegrals,cmbraces]{newtxmath}
%\usepackage{ebgaramond-maths}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\begin{document}

\textsc{A sentence with small caps text of lmodern font, which is shown in epub when using the fonts option}

\Huge\textsc{Huge text in small caps is ignored when viewed in callibre with lmodern}

\begin{center}
\normalsize\scshape Another sentence with scshape command where sc is ignored in callibre\\
\LARGE LARGE text in small caps is respected but sc is ignored when viewed in callibre with lmodern
\end{center}

\end{document}

Always run tex4ebook sample.tex "fonts".

The Update 1 question would be: Why is the relative order of size settings, which appear in the .tex file not respected via tex4ebook in the .epub file when viewed with calibre? To be precise: It should appear a solvable task to respect the relative order of \footnotesize and \normalsize and \large and \Huge (which are used in a .tex file) to be respected in the .epub file. Is my question out of scope? Or is it solvable?

1 Answer 1

2

It seems that there is an error in the font configuration file for Latin Modern fonts, so the information about small caps is not transferred to the CSS file. The correct file is this one, ec-lm.htf:

.lm-ec
htfcss: ec-lmbo  font-style: oblique;
htfcss: ec-lmbx  font-weight: bold;
htfcss: ec-lmbxi  font-style:italic; font-weight: bold;
htfcss: ec-lmbxo  font-style: oblique; font-weight: bold;
htfcss: ec-lmcsco  font-style: oblique;
htfcss: ec-lmcs  font-variant: small-caps;
htfcss: ec-lmcsc  font-variant: small-caps;
htfcss: ec-lmri  font-style:italic;
htfcss: ec-lmro  font-style: oblique;
htfcss: ec-lmss  font-family: sans-serif;
htfcss: ec-lmssbo  font-family: sans-serif; font-style: oblique; font-weight: bold;
htfcss: ec-lmssbx  font-family: sans-serif; font-weight: bold;
htfcss: ec-lmssdc  font-family: sans-serif;
htfcss: ec-lmssdo  font-family: sans-serif; font-style: oblique;
htfcss: ec-lmsso  font-family: sans-serif; font-style: oblique;
htfcss: ec-lmssq  font-family: sans-serif;
htfcss: ec-lmssqbo  font-family: sans-serif; font-style: oblique; font-weight: bold;
htfcss: ec-lmssqbx  font-family: sans-serif; font-weight: bold;
htfcss: ec-lmssqo  font-family: sans-serif; font-style: oblique;
htfcss: ec-lmtcsc  font-family: monospace,monospace;
htfcss: ec-lmtcso  font-style: oblique; font-family: monospace,monospace;
htfcss: ec-lmtk  font-family: monospace,monospace;
htfcss: ec-lmtko  font-style: oblique; font-family: monospace,monospace;
htfcss: ec-lmtl  font-weight: light; font-family: monospace,monospace;
htfcss: ec-lmtlc  font-weight: light; font-family: monospace,monospace;
htfcss: ec-lmtlco  font-weight: light; font-style: oblique; font-family: monospace,monospace;
htfcss: ec-lmtlo  font-weight: light; font-style: oblique; font-family: monospace,monospace;
htfcss: ec-lmtt  font-family: monospace,monospace;
htfcss: ec-lmtti  font-family: monospace,monospace; font-style:italic;
htfcss: ec-lmtto  font-style: oblique; font-family: monospace,monospace;
htfcss: ec-lmvtk  font-family: monospace,monospace;
htfcss: ec-lmvtko  font-style: oblique; font-family: monospace,monospace;
htfcss: ec-lmvtl  font-weight: light; font-family: monospace,monospace;
htfcss: ec-lmvtlo  font-weight: light; font-style: oblique; font-family: monospace,monospace;
htfcss: ec-lmvtt  font-family: monospace,monospace;
htfcss: ec-lmvtto  font-style: oblique; font-family: monospace,monospace;

Alternatively, you can use the "fonts" option, which will use HTML markup for fonts:

$ tex4ebook sample.tex "fonts"

This is the result:

enter image description here

13
  • Thank you Michal. I will look this evening for your solution if it works on my system. I thought this might me a problem of different ebook reader performance, that some interpret small caps as normal font and only display normalfonts and italic and omit small caps. Your answer: The "fonts" option needs to be added with run of tex4ebook? Including " " signs? I think I have to read the documentation of tex4ebook to see what else there can be possible.
    – Thomkrates
    Mar 28, 2023 at 11:19
  • @Thomkrates the "fonts" option is better in your case because bold and italics should work even in Epub readers without CSS support. Small-caps have no particular element in HTML, so it always depends on the CSS support. You can find information about options here: kodymirus.cz/tex4ht-doc/texfourhtOptions.html
    – michal.h21
    Mar 28, 2023 at 12:13
  • Ok., I will look at it. My .tex files do not use any bold fonts, no \textbf, no \bfseries. But only \scshape, and \textsc{} and \emph. \textit{} or \rmfamily, and \textrm{}, \normalfont. sc for the chapter titles and headings, emph and it for Quotations and the normal rm for the main and ordinary text content. If I understand you right, it would give the best results for epub and epub readers to use the "fonts" option? And there is no another way to force ebook readers to display small caps? Only through css support?
    – Thomkrates
    Mar 28, 2023 at 12:33
  • @Thomkrates If you use only these commands, then it will take most of the information from CSS, so the updated .htf file is necessary.
    – michal.h21
    Mar 28, 2023 at 13:18
  • Ok. But originally I like to use ebgaramond fonts (not lmodern) for both my pdf prints and epub files. And with them I had error messages, when using small caps and \textsc{] or \shshape and generating .epub files. So is there a possibility to get correct output in epub (and to get an output at all), using corrected .htf files for ebgaramond fonts? In an earlier error message runnig tex4ebook it concerned EBGaramond-Regular-lf-ts1.htf this file obviolusly. Since when I changed to lmodern, this error disappeared.
    – Thomkrates
    Mar 28, 2023 at 13:59

You must log in to answer this question.

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