# tex4ht and theorem style in bold face and small caps

I am attempting to create a custom theorem style where the header is simultaneously in bold face and in small caps. (I know that "double emphasis" is something to be avoided.) This, however, produces strange results with tex4ht. Consider the following example:

\documentclass{article}

\usepackage{amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\newtheoremstyle{mystyle}
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{0pt}% measure of space to indent
{.}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}

\theoremstyle{mystyle}
\newtheorem*{mytheorem}{Theoremę}

\begin{document}
\begin{mytheorem}Some text.\end{mytheorem}
\end{document}


If compiled with htlatex samplefile.tex 'xhtml,charset=utf-8' ' -cunihtf -utf8' it produces the following output:

<div class="newtheorem">
<span
class="ecxc-1000">T<span
class="small-caps">H</span><span
class="small-caps">E</span><span
class="small-caps">O</span><span
class="small-caps">R</span><span
class="small-caps">E</span><span
class="small-caps">M</span><span
class="small-caps">Ę</span>.</span>  </span><span
class="ecti-1000">Some text.</span>
</p>
</div>


Notice that the letters of the theorem header are not in small caps but all capitalized.

Now, let us make the following trivial change to this example: change the font encoding from T1 to T2A and "Theoremę" to "Theoremщ":

\documentclass{article}

\usepackage{amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}

\newtheoremstyle{mystyle}
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{0pt}% measure of space to indent
{.}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}

\theoremstyle{mystyle}
\newtheorem*{mytheorem}{Theoremщ}

\begin{document}
\begin{mytheorem}Some text.\end{mytheorem}
\end{document}


This will produce an output where the letters of the theorem header are plain (no bold and no caps) and the Cyrillic letter ш disappears (or rather it is preserved as a strange non-UTF8 byte):

<div class="newtheorem">
<span
class="laxc-1000">Theorem■.</span>  </span><span
class="lati-1000">Some text.</span>
</p>
</div>


Are these results because of one or more bugs?

Both of these issues are caused by wrong or missing support for small-caps Cyrillic fonts in tex4ht. I've updated the tex4ht sources, but it will take some time before TeX Live gets the update.

You need to create two files, first is for the Latin small caps, ecxc.htf:

.lm-ec
htfcss: ecxc font-weight: bold; font-variant: small-caps;


The second one is for Cyrillics, laxc.htf:

.larm
htfcss: laxc  font-variant: small-caps; font-weight: bold;


These files tells tex4ht how to interpret the characters and output them as Unicode text and which CSS style should be used for them.

The result now looks much better:

<!--l. 24--><p class="noindent" ><span class="head">
<span
class="ecxc-1000">Theoremę.</span>  </span><span
class="ecti-1000">Some text.</span>
</p>


and

<!--l. 24--><p class="noindent" ><span class="head">
<span
class="laxc-1000">Theoremщ.</span>  </span><span
class="lati-1000">Some text.</span>
</p>


The rendering is better too:

• you really a great support for TeX4ht... – MadyYuvi Sep 20 '17 at 7:05
• Thanks, I didn't know about the hyper fonts before. Unfortunately I can't find information about the file format of the .htf files. For example in the file lacc.htf I found a wrong line '&#x0415;' '' 229 where &#x0435 should be used instead and I don't understand why this file contains a translation map at all. It seems to me that it could be something as simple as this: .larm htfcss: lacc font-variant: small-caps; – A. Zinoviev Sep 20 '17 at 14:52
• @A.Zinoviev I collected some information I collected about htf fonts here. It is possible that the current htf files contains bugs, especially the non-latin ones. It would be best if you could report the issues you found on tex4ht issue tracker – michal.h21 Sep 20 '17 at 16:20