I could not find exactly where the error is generated, but I've made a small example to reproduce it.
The example file is:
\documentclass{example}
\begin{document}
\keywords{ábaba \sep Abba2 \sep Ababa3}
\end{document}
Using the following example template:
\ProvidesClass{example}[2022/03/16 Example class]
\ProcessOptions\relax
\ExecuteOptions{}
\LoadClass{article}
\RequirePackage{mfirstuc}
% KEYWORDS % requires: mfirstuc
\def\sep{\unskip. }%
\newcommand{\capitalizekeywords}[2][\sep]{%
\def\dolist##1{\expandafter\@dolist##1#1\@eol}%
\def\@dolist##1#1##2\@eol{%
\begingroup\setbox0=\hbox{##1\unskip}\ifdim\wd0=0pt\endgroup\else\endgroup\ignorespaces\makefirstuc{##1}\unskip\sep\fi%
\ifx\@eol##2\@eol\else\@dolist##2\@eol\fi}%
\dolist{#2}%
}
\newcommand{\keywords}[1]{%
\emph{Keywords}: \capitalizekeywords{#1}\par
}
Compiling with XeLaTeX
works fine, but make4ht
crashes with the following error:
[ERROR] htlatex: ./example.tex 3 Missing \endcsname inserted.
[ERROR] htlatex: ./example.tex 3 Undefined control sequence.
[ERROR] htlatex: ./example.tex 3 Undefined control sequence.[ERROR] htlatex: ./example.tex 3 Undefined control sequence.
[ERROR] htlatex: ./example.tex 3 Undefined control sequence.
[ERROR] htlatex: ./example.tex 3 Use of \\capitalizekeywords doesn't match its definition.
[ERROR] htlatex: ./example.tex 3 Use of \\capitalizekeywords doesn't match its definition.
[ERROR] htlatex: ./example.tex 3 Use of \\capitalizekeywords doesn't match its definition.
[ERROR] htlatex: ./example.tex 3 Argument of \@dolist has an extra }.[ERROR] htlatex: ./example.tex 3 Paragraph ended before \@dolist was complete.[ERROR] htlatex: ./example.tex 3 Extra \else.
Note 1: When the commands are defined directly in the .tex
file, no error is generated.
Note 2: When there is no diacritical mark in the first character, for example: \keywords{abába \sep Abba2 \sep Ababa3}
, no error occurs.
Best Answer
Try this version of
example.cls
:It uses a new LaTeX internal command,
text_titlecase_first:n
. It seems to work better in this case. The sample file can be compiled with all LaTeX engines supported by TeX4ht without runtime error. With LuaLaTeX and LaTeX, you will also get correct uppercase words. With XeLaTeX though, you will not get uppercase for accented characters. This is caused by the way how TeX4ht handles accented characters with XeLaTeX, and I am not sure that it can be fixed.The result with
make4ht -l sample.tex
(LuaLaTeX):Result with
make4ht -x sample.tex
(XeLaTeX):