4

When compiling this example file, obtained from suggest-a-nice-font-family-for-my-basic-latex-template-text-and-math

it gives an error

(/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 

?

Only when compiled using make4ht --lua foo.tex but no error with lualatex foo.tex

Why is that? Is this expected to happen or something else is going on?

Here is the example

\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}

Now

>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 

? 

Using latest texlive, updated yesterday. On Linux.

  • Just a comment, but I have to sleep after this: "updated yesterday" plus "linux" doesn't give the info you suppose it does. Many people use LTS editions with old or older or ancient "updated texlives"... You can find the version with latex --version command and replace that phrase until while waiting for answer... – koleygr Mar 28 '18 at 21:47
5

It seems that the XCharter package contains \IfFileExists command with some blank lines in its parameter. This command is redefined by tex4ht, but using \def command. This may look innocent, but when a command defined using \def contains paragraph in its parameter, it produces error. Because the XCharter package has blank lines (this produces new paragraphs) in parameter to \IfFileExists, it causes TeX to report an error. To fix this issue, the \IfFileExists must be redefined using \long\def, which supports paragraphs in parameters.

I've fixed this issue in tex4ht sources, but the updates will be available only in TL 2018, as current TL is frozen. So your best solution at the moment is to make a local copy of tex4ht.sty and replace line:

\def\IfFileExists#1#2#3{%

with

\long\def\IfFileExists#1#2#3{%

It is also necessary to add support files for XCharter fonts:

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;

And this is the result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.