超链接内的小型大写字母使 tex4ht 将开双引号渲染为反斜杠

超链接内的小型大写字母使 tex4ht 将开双引号渲染为反斜杠

在将我刚读完的一本书转换成电子书时,我遇到了两个(我认为不相关的)问题。最令人恼火的是,在很早的时候,一个点之后的左双引号就变成了反斜杠。第二个问题是,在某个时候,字体变得很奇怪,我在<span>书的大部分内容中都得到了字符级的 s,我能够使用出色的答案来解决这个问题这里与 \Configure{htf} 相关。在为这篇文章设计 MWE 时,我发现它们是相关的。

\documentclass[10pt]{book}

\usepackage{hyperref}

\begin{document}
``This renders correctly''

{\sc Do small caps break it?} ``No"

\hyperlink{a}{How about hyperlinks?} ``No"

\hyperlink{a}{\sc But... small caps inside hyperlinks} make everything afterwards render as
small caps, and break the ``double quotes,'' though not the `single quotes.'

\end{document}

这在 LaTeX 中渲染得很好……“但是……超链接内的小型大写字母”以小型大写字母呈现,之后的文本是正常的,带有正常的双引号。但是,使用编译它会htlatex test.tex "xhtml"产生在超链接后持续存在的字符级跨度的 HTML,并且开头的双引号呈现为反斜杠。

我发现可以通过\normalfont在超链接文本末尾添加一个来解决这个问题。它仍然会以字符级跨度呈现小型大写字母,但我想我应该将其作为另一个问题发布。

因此,我将把此问题标记为“已回答”,但我想发布此问题以指出 tex4ht 中的一个错误,以防有人遇到类似的问题

答案1

使用\textsc而不是弃用的命令\sc

\documentclass[10pt]{book}

\usepackage{hyperref}

\begin{document}
``This renders correctly''

\textsc{Do small caps break it?} ``No''

\hyperlink{a}{How about hyperlinks?} ``No''

\hyperlink{a}{\textsc{But... small caps inside hyperlinks}} make everything afterwards render as
small caps, and break the ``double quotes,'' though not the `single quotes.'

\end{document}

这是之后的输出htlatex test.tex "xhtml"

<?xml version="1.0" encoding="iso-8859-1" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->  
<html xmlns="http://www.w3.org/1999/xhtml"  
> 
<head><title></title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> 
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)" /> 
<!-- xhtml,html --> 
<meta name="src" content="kuhn.tex" /> 
<meta name="date" content="2014-08-31 19:32:00" /> 
<link rel="stylesheet" type="text/css" href="kuhn.css" /> 
</head><body 
>
<!--l. 6--><p class="noindent" >&#8220;This renders correctly&#8221;
</p><!--l. 8--><p class="indent" >   <span 
class="cmcsc-10">D<span 
class="small-caps">o</span> <span 
class="small-caps">s</span><span 
class="small-caps">m</span><span 
class="small-caps">a</span><span 
class="small-caps">l</span><span 
class="small-caps">l</span> <span 
class="small-caps">c</span><span 
class="small-caps">a</span><span 
class="small-caps">p</span><span 
class="small-caps">s</span> <span 
class="small-caps">b</span><span 
class="small-caps">r</span><span 
class="small-caps">e</span><span 
class="small-caps">a</span><span 
class="small-caps">k</span> <span 
class="small-caps">i</span><span 
class="small-caps">t</span>? </span>&#8220;No&#8221;
</p><!--l. 10--><p class="indent" >   <a 
href="#a">How about hyperlinks?</a> &#8220;No&#8221;
</p><!--l. 12--><p class="indent" >   <a 
href="#a"><span 
class="cmcsc-10">B<span 
class="small-caps">u</span><span 
class="small-caps">t</span>... <span 
class="small-caps">s</span><span 
class="small-caps">m</span><span 
class="small-caps">a</span><span 
class="small-caps">l</span><span 
class="small-caps">l</span> <span 
class="small-caps">c</span><span 
class="small-caps">a</span><span 
class="small-caps">p</span><span 
class="small-caps">s</span> <span 
class="small-caps">i</span><span 
class="small-caps">n</span><span 
class="small-caps">s</span><span 
class="small-caps">i</span><span 
class="small-caps">d</span><span 
class="small-caps">e</span> <span 
class="small-caps">h</span><span 
class="small-caps">y</span><span 
class="small-caps">p</span><span 
class="small-caps">e</span><span 
class="small-caps">r</span><span 
class="small-caps">l</span><span 
class="small-caps">i</span><span 
class="small-caps">n</span><span 
class="small-caps">k</span><span 
class="small-caps">s</span></span></a> make everything afterwards
render as small caps, and break the &#8220;double quotes,&#8221; though not the &#8216;single
quotes.&#8217;
</p>

</body></html> 

您会看到小写字母被正确分隔。

答案2

正如我在上面的文字中指出的那样,\normalfont在超链接文本末尾插入可以解决这个错误。

我欢迎其他答案。

相关内容