使用 lua 时 TL 2016 下的 tex4ht 出错。字符串包含无效的 utf-8 序列

使用 lua 时 TL 2016 下的 tex4ht 出错。字符串包含无效的 utf-8 序列

我刚刚在新的 Linux mint OS 上安装了 TL 2016。

>which latex
/usr/local/texlive/2016/bin/x86_64-linux/latex
>which make4ht
/usr/local/texlive/2016/texmf-dist/scripts/make4ht/make4ht

我尝试编译的第一个文件出现错误。我想问一下用户需要更改或添加什么才能tex4ht在 TL 2016 下工作。我lua在所有构建中都使用 选项make4ht。这是 MWE

\documentclass[11pt]{article}%
\usepackage[utf8]{inputenc}
\begin{document}
test
\end{document} 

错误是

make4ht --lua foo.tex 
Output dir:     
Compiler:   dvilualatex
Latex options:   -jobname=foo 
tex4ht.sty :    xhtml,
tex4ht  
build_file  foo.mk4
Cannot open config file foo.mk4
setting param correct_exit
setting param correct_exit
setting param correct_exit
setting param ext
Adding:     ext dvi
LaTeX call: dvilualatex  -jobname=foo  '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode xhtml,.a.b.c.\input foo'
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(./foo.tex (/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/tex4ht.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/usepackage.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/inputenc.sty

Package inputenc Warning: inputenc package ignored with utf8 based engines.

) (/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/tex4ht.4ht
::::::::::::::::::::::::::::::::::::::::::
 TeX4ht info is available in the log file 
::::::::::::::::::::::::::::::::::::::::::
) (/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/tex4ht.sty
--- needs --- tex4ht foo ---
(./foo.tmp) (./foo.xref)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4-math.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/latex.4ht
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4.4ht
! String contains an invalid utf-8 sequence.
l.1267           
               \Configure{tableofcontents}
? 

如果删除--lua选项,它会起作用。但我需要使用此选项,并且它在 TL 2015 中有效。如果我删除\usepackage[utf8]{inputenc}

文件使用 lualatex 2016 编译成功

lualatex foo.tex
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo)) (./foo.aux)
[1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./foo.aux))
 346 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 7 glue, 39 glue_spec, 1 write nodes
   avail lists: 1:1,2:12,3:2,4:1,5:10,6:6,7:22,8:1,9:6
</usr/local/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on foo.pdf (1 page, 10400 bytes).
Transcript written on foo.log.

make4ht --lua文件在 TL 2015 下也编译通过:

make4ht --lua foo.tex
Output dir:     
Compiler:   dvilualatex
Latex options:   -jobname=foo 
tex4ht.sty :    xhtml,
tex4ht  
build_file  foo.mk4
Cannot open config file foo.mk4
setting param correct_exit
setting param correct_exit
setting param correct_exit
setting param ext
Adding:     ext dvi
LaTeX call: dvilualatex  -jobname=foo  '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode xhtml,.a.b.c.\input foo'
This is LuaTeX, Version beta-0.80.0.1 (TeX Live 2015) (rev 5863) 
 restricted \write18 enabled.
LaTeX2e <2015/10/01> patch level 2
......
parse_lg process file: foo.css
outdir: 
parse_lg process file: foo.tmp
tmp file

答案1

该文件的第 1267 行/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4.4ht包含虚假字符<A0>

1265 \let\sv:etoc\e:tableofcontents
1266 %
1267           <A0>\Configure{tableofcontents}
1268        {\IgnorePar\EndP\HCode{<div class="\sec:typ TOCS">}\IgnorePar}

输出结果如下:

LESSCHARSET=ascii less -N $(kpsewhich html4.4ht)

制作本地副本,编辑文件,将光标放在反斜杠处\Configure并删除前面的字符。

如果编辑的副本在工作目录中,则编译成功。

相关内容