I was told by Latex experts to use \usepackage{fontspec}
with Lualatex. It works ok with lualatex, but now my files do not compile with make4ht any more after I changed to \usepackage{fontspec}
. Before I used to use
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
But now I only use \usepackage{fontspec}
as recommended to do. So I do not know why make4ht gives an error when compiling in lualatex mode:
\documentclass[11pt]{article}%
\IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
\usepackage{fontspec}
\begin{document}
test
\end{document}
error
>make4ht --lua foo7_1.tex
Output dir:
Compiler: dvilualatex
Latex options: -jobname=foo7_1
tex4ht.sty : xhtml,
tex4ht
build_file foo7_1.mk4
Cannot open config file foo7_1.mk4
setting param correct_exit
setting param correct_exit
setting param correct_exit
setting param ext
Adding: ext dvi
LaTeX call: dvilualatex -jobname=foo7_1 '\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 foo7_1'
This is LuaTeX, Version 0.95.0 (TeX Live 2016)
restricted system commands enabled.
LaTeX2e <2016/03/31> patch level 1
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(./foo7_1.tex (/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/tex4ht.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/usepackage.4ht)
(/usr/local/texlive/2016/texmf-dist/tex/generic/luatex85/luatex85.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/fontspec/fontspec.sty
.
.
(/usr/local/texlive/2016/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(./foo7_1.aux) (/usr/local/texlive/2016/texmf-dist/tex/latex/tipa/t3cmr.fd)
! LaTeX Error: Command `\acute' already defined in `'.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.6 \begin{document}
?
When I tried the suggestion in fontspec-package-accents-bezos-latex-error-command-acute-already
\documentclass[11pt]{article}%
\IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
\usepackage[no-math]{fontspec}
\usepackage{accents}
\begin{document}
test
\end{document}
I get new error
---------------------------------------------------
--- error --- Can't find/open file `file:lmroman10-regular:script=latn;+trep;+tlig;.tfm'
Make4ht: Fatal error. Command tex4ht returned exit code 256
but lualatex still compiles ok.
Only when I go back to
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
will now lualatex and make4ht are happy.
I really do not know anything about all these packages, and fonts and all that, I simply want to know what is the correct thing to use, that is all so I do not get errors.
TL 2016 on Linux. I am only using lualatex now. Not pdflatex.
Best Answer
Edit:
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.
If you use non-latin scripts, you need to use a correct
Script
option in your font declaration, because all Unicode characters used in the document must be declared first. It is done automatically when you use theScript
option.The resulting HTML document:
[Old answer] The convertor from
DVI
toHTML
doesn't support OpenType fonts, which is automatically selected when theFontspec
package is loaded. This is well knowntex4ht
bug and also one which is hardest to fix.There are two possible workarounds, both of them require modification of the document, unfortunately.
First is to use conditionally
luainputenc
package:the other option is to use
alternative4ht
package from helpers4ht bundle, which contains special configuration forfontspec
withtex4ht
:you can see more features in this document