1

I added \usepackage{fontspec} to my .tex file and the magic comment % !TeX program = lualatex in the preamble of my document.

Since I did so, I can no longer convert my document to HTML from a .bat script using make4ht. I receive the error message:

htlatex: ? 45 Fatal Package fontspec Error: The fontspec package requires either XeTeX or LuaLaTeX

I read the question after changing to \usepackage{fontspec} now make4ht do not compile my Latex file in lualatex mode and I still don't understand the problem. The answer to this question (from michal.h21) states that:

Fontspec support have been just added to tex4ht, you can get it after TL update. Both XeLaTeX and LuaLaTeX are supported, although the implementation is different for both engines.

Why does make4ht not recognize the use of LuaLaTex despite the magic comment?

5
  • 1
    the comment is just that, a comment. It has no special status to tex. Some editors read comments in that form but the syntax varies from editor to editor. make4ht has commandline options to tell it to use luatex make4ht -l Commented Nov 7, 2021 at 11:35
  • @DavidCarlisle That solves my problem! If you want to post it as an answer, I will accept it.
    – AlMa
    Commented Nov 7, 2021 at 11:41
  • make4ht also supports these comments, but not by default. You can try make4ht -f html5+detect_engine filename.tex.
    – michal.h21
    Commented Nov 7, 2021 at 11:53
  • @michal.h21 ooh I added that to my answer so it's more visible than in comments, thanks, Commented Nov 7, 2021 at 12:28
  • @DavidCarlisle I don't propagate this option too much, so it is no surprise that no one knows about it :)
    – michal.h21
    Commented Nov 7, 2021 at 13:11

1 Answer 1

2

The comment is just that, a comment. It has no special status to tex. Some editors read comments in that form but the syntax varies from editor to editor.

make4ht has a commandline option to tell it to use luatex: make4ht -l

make4ht also supports these comments, but not by default. You can try

make4ht -f html5+detect_engine filename.tex. 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .