tex4ht 和 theorem 样式采用粗体和小写字母

tex4ht 和 theorem 样式采用粗体和小写字母

我正在尝试创建一种自定义定理样式,其中标题同时采用粗体和小写字母。(我知道“双重强调”是应该避免的。)然而,这在 tex4ht 中产生了奇怪的结果。请考虑以下示例:

\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
  {\bfseries\scshape}% name of head font
  {.}% 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}

如果用htlatex samplefile.tex 'xhtml,charset=utf-8' ' -cunihtf -utf8'它编译会产生以下输出:

<div class="newtheorem">
<!--l. 21--><p class="noindent" ><span class="head">
<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>

注意,定理标题的字母不是小写,而是全部大写。

现在,让我们对此示例进行以下微小的更改:将字体编码从 T1 更改为 T2A,将“Theoremę”更改为“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
  {\bfseries\scshape}% name of head font
  {.}% 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}

这将产生一个输出,其中定理标题的字母是普通的(没有粗体也没有大写),并且西里尔字母 ш 消失(或者更确切地说,它被保留为一个奇怪的非 UTF8 字节):

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

这些结果是由于一个或多个错误造成的吗?

答案1

这两个问题都是由于对 中的小型大写西里尔字体的错误支持或缺失而引起的tex4ht。我已经更新了tex4ht源代码,但 TeX Live 需要一些时间才能更新。

您需要创建两个文件,第一个是拉丁小型大写字母ecxc.htf

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

第二个是针对西里尔字母的laxc.htf

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

这些文件告诉tex4ht如何解释字符并将其输出为 Unicode 文本以及应对它们使用哪种 CSS 样式。

现在结果看起来好多了:

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

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

渲染也更好:

在此处输入图片描述

相关内容