Turning a book I just finished into an ebook, I ran into two (I thought unrelated) problems. The more vexing one was that the open-double-quote was being turned into a backslash after a point very early on. The second was that at some point the font went wonky and I was getting character-level <span>
s for the bulk of the book, which I was able to work around using the excellent answer here related to \Configure{htf}. Coming up with an MWE for this post, I discovered that they are related.
\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}
This renders just fine in LaTeX... "But... small caps inside hyperlinks" is rendered in small caps, and the text afterwards is normal, with normal double quotes. However, compiling it with htlatex test.tex "xhtml"
gives HTML with character-level spans that persist after the hyperlink, and the opening double quote is rendered as backslash.
I discovered that I could work around this by putting a \normalfont
at the end of the hyperlink text. It still renders the small caps with character-level spans but I should post that as another question, I suppose.
So I will mark this as "answered," but I wanted to post it to point out what looks to be a bug in tex4ht, and in case anyone has a similar problem