编译此示例文件时,从为我的基本乳胶模板文本和数学建议一个不错的字体系列
它给出了一个错误
(/usr/local/texlive/2017/texmf-dist/tex/latex/mweights/mweights.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
Runaway argument?
{ \RequirePackage {fontaxes} \fa@naming@exception {figures}{{superior\ETC.
! Paragraph ended before \IfFileExists was complete.
<to be read again>
\par
l.25
?
仅当使用编译make4ht --lua foo.tex
但没有错误时lualatex foo.tex
这是为什么?这是预料之中的事情吗?还是有其他事情发生?
以下是示例
\documentclass{article}
%taken from answer by @Mico
%https://tex.stackexchange.com/questions/59702/suggest-a-nice-font-family-for-my-basic-latex-template-text-and-math
\usepackage[T1]{fontenc}
\usepackage{ntheorem}
\newtheorem{theorem}{Theorem}
\usepackage{amsmath}
\usepackage{XCharter}
\DeclareMathOperator{\Res}{Res}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\blindtext
\pagestyle{empty}
\begin{theorem}[Residue Theorem]
Let $f$ be analytic in the region $G$ except for the isolated
singularities $a_1,a_2,\dots,a_m$. If $\gamma$ is a closed
rectifiable curve in $G$ which does not pass through any of the
points $a_k$ and if $\gamma\approx 0$ in $G$, then
\[
\frac{1}{2\pi i}\int_\gamma\! f = \sum_{k=1}^m
n(\gamma;a_k)\Res(f;a_k)\,.
\]
\end{theorem}
\end{document}
现在
>make4ht --lua foo_before.tex
Output dir:
Compiler: dvilualatex
Latex options: -jobname=foo_before
tex4ht.sty : xhtml,
tex4ht
build_file foo_before.mk4
Cannot open config file foo_before.mk4
setting param correct_exit
setting param correct_exit
setting param correct_exit
setting param ext
Adding: ext dvi
LaTeX call: dvilualatex -jobname=foo_before '\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_before.tex'
This is LuaTeX, Version 1.0.4 (TeX Live 2017)
restricted system commands enabled.
LaTeX2e <2017-04-15>
(using write cache: /home/me/.texlive2017/texmf-var/luatex-cache/generic)(using read cache: /usr/local/texlive/2017/texmf-var/luatex-cache/generic /home/me/.texlive2017/texmf-var/luatex-cache/generic)
luaotfload | main : initialization completed in 0.130 secondsBabel <3.18> and hyphenation patterns for 1 language(s) loaded.
(./foo_before.tex
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo(load luc: /home/m
e/.texlive2017/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc))
) (/usr/local/texlive/2017/texmf-dist/tex/generic/tex4ht/tex4ht.sty)
(/usr/local/texlive/2017/texmf-dist/tex/generic/tex4ht/usepackage.4ht)
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/t1enc.def)
(/usr/local/texlive/2017/texmf-dist/tex/latex/lm/t1lmr.fd))
(/usr/local/texlive/2017/texmf-dist/tex/latex/ntheorem/ntheorem.sty
Style `ntheorem', Version 1.33 <2011/08/15>
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/local/texlive/2017/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2017/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2017/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2017/texmf-dist/tex/latex/xcharter/XCharter.sty
`XCharter' v1.112, 2017/12/19 Text macros for XCharter, an extension of Charter
(msharpe) (/usr/local/texlive/2017/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/cyrillic/t2aenc.def)
(/usr/local/texlive/2017/texmf-dist/tex/latex/ly1/ly1enc.def)
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/t1enc.def)
(/usr/local/texlive/2017/texmf-dist/tex/latex/psnfss/t1ptm.fd))
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/local/texlive/2017/texmf-dist/tex/latex/mweights/mweights.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
Runaway argument?
{ \RequirePackage {fontaxes} \fa@naming@exception {figures}{{superior\ETC.
! Paragraph ended before \IfFileExists was complete.
<to be read again>
\par
l.25
?
使用最新的 texlive,昨天更新。在 Linux 上。
答案1
似乎XCharter
包中包含的\IfFileExists
命令的参数中有一些空行。此命令由 重新定义tex4ht
,但使用\def
命令。这看起来可能无害,但当使用 定义的命令\def
的参数中包含段落时,它会产生错误。由于XCharter
包的参数中有空行(这会产生新的段落)\IfFileExists
,因此会导致 TeX 报告错误。要解决此问题,\IfFileExists
必须使用 重新定义\long\def
,它支持参数中的段落。
我已在tex4ht
源代码中修复了此问题,但更新仅在 TL 2018 中可用,因为当前 TL 已冻结。因此,目前最好的解决方案是制作本地副本tex4ht.sty
并替换以下行:
\def\IfFileExists#1#2#3{%
和
\long\def\IfFileExists#1#2#3{%
还需要添加XCharter字体的支持文件:
XCharter-Bold-tlf-t1--base.htf:
.lm-ec
htfcss: XCharter-Bold-tlf-t1--base font-weight:bold; font-family: Charter, serif;
XCharter-Italic-tlf-t1--base.htf:
.lm-ec
htfcss: XCharter-Italic-tlf-t1--base font-style: italic; font-family: Charter, serif;
XCharter-Roman-tlf-t1--base.htf:
.lm-ec
htfcss: XCharter-Roman-tlf-t1--base font-style:normal; font-family: Charter, serif;
结果如下: