对 htlatex 使用“mouseover”选项会出现错误:“缺少文件 xhtex”:

对 htlatex 使用“mouseover”选项会出现错误:“缺少文件 xhtex”:

我想使用 htlatex 的鼠标悬停选项,但 texlive 发行版中似乎缺少该文件。我试图找到它,但它似乎不再存在。有人知道我可以在哪里找到它或有替代品吗?

答案1

似乎该mouseover选项需要使用xhtex命令对生成的文件进行后处理,该命令是 的 Plain TeX 变体htlatex。此命令不包含在 TeX Live 中,但可以使用 来模拟mk4ht xhtex

幸运的是,mouseover可以使用各种选项来配置选项:

--- Note --- Option `mouseover' is powered by the overlib.js utility of Erik Bo
srup (http://www.bosrup.com/web/overlib/).
--------------------------------------

The option requires two compilations of the source file.

Use \Configure{mouseover-XXX}{...} to introduce extra arguments into the overli
b function call `return overlib(...)'. XXX stands for `cite', `footnote', or 'g
loss'. The default body is at tex4ht.body, and the default caption at tex4ht.ca
ption. An empty parameter requests no sensitivity of the mouse for the specifie
d type of entries.

The variant \Configure{mouseover-XXX}[labels]{...} of the above command restric
ts the outcome just to the listed labels (i.e., the values listed in tex4ht.cap
tion).

The \Configure{mouseover-script}{variable-name} {javascript-code} command may b
e used to introduce code into the javascript file, as a content of a global var
iable when a name is given and as a bare code when the name is not given. To be
 referenced, the name must be prefixed by ``tex4ht.'.

The \Configure{mouseover-vars}{XXX} {variable-list} command introduces local va
riables, to be referenced with the prefix ``tex4ht.' on their names. In additio
n, for each variable YYY it introduces a construct \moYYY{label}...\endmoYYY fo
r selecting a value for the variable at the specified label.

Example:
 \Configure{mouseover-script}{var}{\relax \special {t4ht=<hr />}}
\Configure{mouseover-vars}{cite}{Author,Title}
\Configure{mouseover-cite} {tex4ht.body,CAPTION,tex4ht.caption+tex4ht.var,FULLH
TML}.
 \moAuthor{bb}A name\endmoAuthor

The compilation indirectly invokes the command 'xhtex \jobname-js'. An alternat
ive format for the command can be requested within a configuration of the form 
\Configure{mouseover-Needs}{\Needs{"..."}}. The default setting is due to \Conf
igure{mouseover-Needs}{\Needs{"xhtex \jobname-js"}}
In case \Configure{mouseover-Needs} is undefined, introduce the instruction \Ne
wConfigure{mouseover-Needs}{1} before that command. 

从这些选项中,mouseover-Needs似乎最重要的是,因为它使我们能够为后处理定义不同的命令。您可以创建一个简单的配置文件,mycfg.cfg

\Preamble{xhtml,mouseover}
\Configure{mouseover-Needs}{\Needs{"mk4ht xhtex \jobname-js"}}
\begin{document}

\EndPreamble

你还需要overlib.js到包含 HTML 文件的目录。然后,您可以使用以下方法编译文件:

make4ht -c mycfg.cfg filename.tex

示例文件:

\documentclass{article}

\begin{document}
Some text\footnote{this is a footnote}.
\end{document}

它将呈现如下形式:

在此处输入图片描述

相关内容