2

I am using smallcaps to mark certain direct speech (essentially uttered by non-human entities).

I use it almost exclusively through the following macro:

\usepackage{quotmark}
\newcommand{\gqt}[1]{\tqt{\scshape #1}}

This works as expected in plain LaTeX (memoir), but completely (and silently) disappears when I compile with tex4ebook (i.e.: content is there, but no font change).

Note: use of SmallCaps is not mandatory, I just need a way to graphycally differentiate certain parts and I cannot use standard bold/italic because that effect is already used for other (orthogonal) visual enhancements. Switch to a very different font (gothic?) would suffice.

UPDATE: I am experimenting with different font changes, but I consistently get no fonts in html/epub. What follows is current status:

Full header of my file.tex (I removed only comments):

\documentclass[10pt,ebook,italian,onecolumn,oneside,titlepage,extrafontsizes]{memoir}
\usepackage[italian]{babel}
\usepackage{graphicx}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ucs}
\usepackage{makeidx}
\usepackage{quotmark}
\newcommand{\gqt}[1]{\tqt{\fontfamily{pzc}\selectfont #1}}
\newcommand{\stars}{\begin{center} * * *\\ \end{center}}
\makeatletter
\def\@partimage{}
\newcommand{\partimage}[2][]{\gdef\@partimage{\includegraphics[#1]{#2}}}
\renewcommand{\printparttitle}[1]{\parttitlefont #1\vfil\@partimage\vfil\gdef\@partimage{}}
\makeatother
\setlength\cftpartnumwidth{2em}
\author{Mauro Condarelli}
\title{Cronache della Nuova Terra}
\begin{document}
\frontmatter
\maketitle
\mainmatter
\chapterstyle{companion}
\tableofcontents
\partimage[width=210pt]{old_mage.png}
\part{In cerca di un Mondo Nuovo}
\chapter{La Missione}
...
\gqt{Perché sei così triste? Erano secoli che non mi divertivo tanto. Vieni ad abbracciarmi, figlio mio!}\\
Audagor si girò e in un lampo volò fra le braccia del suo Dio.\\
\gqt{Da oggi sarai conosciuto anche come "\textit{guds morder}": uccisore di Dei}, furono le ultime parole che sentì.\par
...
\backmatter
\appendix
\end{document}

This is a TeXstudio snapshot showing font change in .PDF enter image description here

My full tex4ebook.cfg is:

\Preamble{xhtml}
\DeclareGraphicsExtensions{.svg,.png,.jpg,.pdf}
\CoverMetadata{thano.png}
\Configure{AddCss}{blitz-lite.css}
\makeatletter
\Configure{part}
{\ifvmode\IgnorePar\fi\EndP\HCode{<h1 class="partHead"><span class="titlemark">}\partname \ \thepart \HCode{</span>}}
{}
{\ifvmode\IgnorePar\fi\EndP\HCode{<aside class="partimage">}\@partimage\HCode{</aside>}}
{\HCode{</h1>}\IgnoreIndent\par\OpfRegisterFile}
\makeatother
\Css{.partimage{margin:0 auto;text-align:center;}}
\Css{.partimage img{max-width:100\%;}}
\Css{.partHead .titlemark{display:block;}}
\DeclareGraphicsExtensions{.svg,.png,.jpg,.pdf}
\begin{document}
\EndPreamble

Compilation is done with a rather terse tex4ebook -c tex4book.cfg Cronache_della_Nuova_Terra.tex.

The same page, in ebook-viewer does not show any font change, but has some "strange artifacts" (no close guillemots and other char substitutions): .epub in ebook-viewer

This is completely consistent with what I see if I open the .html version of the chapter in Firefox. Generated HTML is:

</p><!--l. 89--><p class="indent" >   Da sotto di un masso particolarmente grosso spuntava una mano e
una lacera manica rossa.<br 
class="newline" />Audagor crollò in ginocchio.<br 
class="newline" />Aveva veramente ucciso il suo Dio?<br 
class="newline" />Gli occhi gli si velarono di lacrime.<br 
class="newline" />Com’era possibile?
</p><!--l. 95--><p class="indent" >   «<span 
class="pzcmi8t-">Perch</span><span 
class="pzcmi8t-">é</span> <span 
class="pzcmi8t-">sei cos</span><span 
class="pzcmi8t-">ì</span> <span 
class="pzcmi8t-">triste? Erano secoli che non mi divertivo tanto. Vieni ad</span>
<span 
class="pzcmi8t-">abbracciarmi, øglio mio!ˇ</span><br 
class="newline" />Audagor si girò e in un lampo volò fra le braccia del suo Dio.<br 
class="newline" />«<span 
class="pzcmi8t-">Da oggi sarai conosciuto anche come ”guds morder”: uccisore di Deiˇ</span>, furono le
ultime parole che sentì.
</p><!--l. 99--><p class="indent" >   I suoi amici rovesciarono ogni masso, in quel canalone devastato, ma
non trovarono nulla.<br 
class="newline" />Dovettero fare il funerale all’unica cosa che era rimasta: il suo mantello.
</p>

"Strange artifacts" are already in place and relevant lines have attribute class="pzcmi8t-"... which does not appear in any .css.

I am available to do any required test.

As said I have no problem in using other means to use different means to visually differentiate direct speech from "normal" people from that uttered by "non-humans".

Any hint welcome!

  • this command generates small-caps for me. does your ebook reader support CSS? – michal.h21 Apr 23 at 13:09
  • @michal.h21: I'm currently testing with ebook-viewer which comes with Calibre, but final target would be a "real" kindle (I'm preparing for self-publication on Amazon). I am currently trying to convert to \newcommand{\gqt}[1]{\tqt{\fontfamily{pzc}\selectfont #1}}, bu that doesn't seem to play fair with \textit{}. – ZioByte Apr 23 at 13:36
  • I can see the small caps with ebook-view. which TeX distribution do you use? It is possible that older tex4ht versions didn't support small caps well. – michal.h21 Apr 23 at 13:51
  • I am on Debian Sid, this means texlive-2018.20190227, but I'm never sure I have all needed packages as Debian likes to split things in zillion pieces. I'm now in the process of installing everything having "tex" in its name. – ZioByte Apr 23 at 16:50
  • I think this is fairly recent installation. You don't get the small caps even when you look at the generated HTML codes in a web browser? – michal.h21 Apr 23 at 18:41
1

It is better to use custom tags in this case. It will give you a full control over the formatting. In this case, I would just simply redefine the \qgt command in the configuration file:

\renewcommand\gqt[1]{\HCode{<span class="smallcaps">}\tqt{#1}\HCode{</span>}} 

as you can see the HTML tags are inserted directly around the whole contents passed to the redefined command. It needs to be configured using CSS then:

\Css{.smallcaps{font-variant:small-caps;}}  

The full config file:

\Preamble{xhtml}
\DeclareGraphicsExtensions{.svg,.png,.jpg,.pdf}
\CoverMetadata{thano.png}
\renewcommand\gqt[1]{\HCode{<span class="smallcaps">}\tqt{#1}\HCode{</span>}}
\Css{.smallcaps{font-variant:small-caps;}}
\Configure{AddCss}{blitz-lite.css}
\makeatletter
\Configure{part}
{\ifvmode\IgnorePar\fi\EndP\HCode{<h1 class="partHead"><span class="titlemark">}\partname \ \thepart \HCode{</span>}}
{}
{\ifvmode\IgnorePar\fi\EndP\HCode{<aside class="partimage">}\@partimage\HCode{</aside>}}
{\HCode{</h1>}\IgnoreIndent\par\OpfRegisterFile}
\makeatother
\Css{.partimage{margin:0 auto;text-align:center;}}
\Css{.partimage img{max-width:100\%;}}
\Css{.partHead .titlemark{display:block;}}
\DeclareGraphicsExtensions{.svg,.png,.jpg,.pdf}
\begin{document}
\EndPreamble

This is the result:

enter image description here

  • Is there some way to use some kind of "conditional compilation" so that I can use the same sources to generate both PDF (using lualatex) and epub (using tex4ebook)? – ZioByte May 5 at 15:25
  • @ZioByte sure, the redefinition in the config file is used just for the tex4ebook compilation. it is not necessary to modify the source file – michal.h21 May 5 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.