I have a need to use \catcode`\^^M=12 % in a Latex file for other purposes.

The file compiles OK with lualatex but gives an error in tex4ht lua mode.

Is there a way to make it work in tex4ht also? Here is a MWE


\catcode`\^^M=12 %
\endlinechar=`\^^M %

Now lualatex foo6.tex compile OK. but make4ht --lua foo6.tex does not:

make4ht --lua foo6.tex
Output dir:     
Compiler:   dvilualatex
Latex options:   -jobname=foo6 
tex4ht.sty :    xhtml,
build_file  foo6.mk4
Cannot open config file foo6.mk4
setting param correct_exit
setting param correct_exit
setting param correct_exit
setting param ext
Adding:     ext dvi
LaTeX call: dvilualatex  -jobname=foo6  '\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 foo6'
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
LaTeX2e <2016/03/31> patch level 1
! Missing number, treated as zero.
<to be read again> 
l.9 \catcode`\^^
              M=12 %

This is TL 2016 on Linux.


is just a complicated way of writing 13, so if you do not want to disable tex4ht's use of ^ then you could use


It seems that \^^M clashes with ^ which is redefined by tex4ht to produce superscripts. You can try to disable it using no^ command line option:

make4ht -l foo6.tex no^
  • oh, I just found now all superscripts no long work? $x^3$ comes out as x3 ? I did not realized this the price to pay. I am sorry but this will not work. I have lots of math in the documents and can't lose superscripts ofcourse. Do you have any other magic solution to try? Thanks., – Nasser Jun 19 '16 at 9:05
  • @Nasser you can also change catcode of ^ to 7 before the ^^M use. Or use David's solutions, which seems easiest – michal.h21 Jun 19 '16 at 9:21

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.