TeX - LaTeX Asked on December 11, 2020
I have installed make4ht
using the command tlmgr install make4ht
.
Now when I enter the command make4ht foo.tex
, I get this error:
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: foo.tex
...texmf-dist/scripts/make4ht/filters/make4ht-domfilter.lua:2: module 'luaxml-domobject' not found:
no field package.preload['luaxml-domobject']
[kpse lua searcher] file not found: 'luaxml-domobject'
[kpse C searcher] file not found: 'luaxml-domobject'
What else do I need to install before I can use make4ht
successfully?
Let me answer how I resolved this issue. The comment by @michal.h21 helped.
Note that points 2 to 6 show false starts or attempts that did not lead to good looking results. Only the last point led to nice results.
Create a file foo.tex
which I will use to test that make4ht
works successfully:
documentclass{article}
usepackage{amsmath}
title{Demo}
begin{document}
begin{align}
1 + 0 & = 1, label{eq1}
1 + 1 & = 2, label{eq2}
e^{i pi} = -1. label{eq3}
end{align}
Equation ( eqref{eq1} ), ( eqref{eq2} ) and ( eqref{eq3} )
describe eternal truths.
The equation ( e^{i pi} = -1 ) can also be rewritten as ( e^{i pi}
+ 1 = 0 ) which is known as Euler's identity.
end{document}
Install make4ht
and compile foo.tex
to foo.html
as follows:
sudo tlmgr install make4ht
make4ht foo
This led to the following error:
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: foo
...texmf-dist/scripts/make4ht/filters/make4ht-domfilter.lua:2: module 'luaxml-domobject' not found:
no field package.preload['luaxml-domobject']
[kpse lua searcher] file not found: 'luaxml-domobject'
[kpse C searcher] file not found: 'luaxml-domobject'
Install make4ht
and luaxml
and try again:
sudo tlmgr install make4ht luaxml
make4ht foo
This led to the following error:
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: foo
[ERROR] htlatex: Compilation errors in the htlatex run
[ERROR] htlatex: Filename Line Message
[ERROR] htlatex: ? ? LaTeX Error: File `tex4ht.sty' not found.
[ERROR] htlatex: ? 2 Emergency stop.
[FATAL] make4ht-lib: Fatal error. Command htlatex returned exit code 1
Install make4ht
, luaxml
, and tex4ht
, and try again:
sudo tlmgr install make4ht luaxml tex4ht
make4ht foo
The conversion succeeded this time:
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: foo
sh: dvipng: command not found
sh: dvipng: command not found
sh: dvipng: command not found
sh: dvipng: command not found
sh: dvipng: command not found
[STATUS] make4ht: Conversion finished
Here is how the output foo.html
looked:
<!DOCTYPE html>
<html lang='en-US' xml:lang='en-US'>
<head><title></title>
<meta charset='utf-8' />
<meta content='TeX4ht (https://tug.org/tex4ht/)' name='generator' />
<meta content='width=device-width,initial-scale=1' name='viewport' />
<link href='foo.css' type='text/css' rel='stylesheet' />
<meta content='foo.tex' name='src' />
</head><body>
<!-- l. 6 --><p class='noindent'>
</p><table class='align'>
<tr><td class='align-odd'>1 + 0</td> <td class='align-even'> = 1<span class='cmmi-10'>,</span></td> <td class='align-label'><a id='x1-2r1'></a>(1)
</td></tr><tr><td class='align-odd'>1 + 1</td> <td class='align-even'> = 2<span class='cmmi-10'>,</span></td> <td class='align-label'><a id='x1-3r2'></a>(2)
</td></tr><tr><td class='align-odd'><span class='cmmi-10'>e</span><sup><span class='cmmi-7'>iπ</span></sup> = <span class='cmsy-10'>−</span>1<span class='cmmi-10'>.</span></td> <td class='align-even'></td> <td class='align-label'><a id='x1-4r3'></a>(3) </td></tr></table>
<!-- l. 12 --><p class='noindent'>Equation <img alt='(1) ' src='foo0x.png' class='math' />, <img alt='(2) ' src='foo1x.png' class='math' /> and <img alt='(3) ' src='foo2x.png' class='math' /> describe eternal truths.
</p><!-- l. 15 --><p class='indent'> The equation <img alt='eiπ = − 1 ' src='foo3x.png' class='math' /> can also be rewritten as <img alt='eiπ + 1 = 0 ' src='foo4x.png' class='math' /> which is known
as Euler’s identity. </p>
</body>
</html>
The math rendered using HTML and images does not look great.
Render math using MathJax:
make4ht foo mathjax
The conversion fails:
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: foo
[ERROR] htlatex: Compilation errors in the htlatex run
[ERROR] htlatex: Filename Line Message
[ERROR] htlatex: ? ? LaTeX Error: File `environ.sty' not found.
[ERROR] htlatex: ? 22 Emergency stop.
[FATAL] make4ht-lib: Fatal error. Command htlatex returned exit code 1
Install make4ht
, luaxml
, tex4ht
, and environ
and try again:
sudo tlmgr install make4ht luaxml tex4ht environ
make4ht foo mathjax
It fails again:
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: foo
[ERROR] htlatex: Compilation errors in the htlatex run
[ERROR] htlatex: Filename Line Message
[ERROR] htlatex: ? ? LaTeX Error: File `trimspaces.sty' not found.
[ERROR] htlatex: ? 17 Emergency stop.
[FATAL] make4ht-lib: Fatal error. Command htlatex returned exit code 1
Install make4ht
, luaxml
, tex4ht
, environ
, and trimspaces
and try again:
sudo tlmgr install make4ht luaxml tex4ht environ trimspaces
make4ht foo mathjax
The conversion is successful:
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: foo
[STATUS] make4ht: Conversion finished
Here is the output foo.html
:
<!DOCTYPE html>
<html xml:lang='en-US' lang='en-US'>
<head><title></title>
<meta charset='utf-8' />
<meta name='generator' content='TeX4ht (https://tug.org/tex4ht/)' />
<meta name='viewport' content='width=device-width,initial-scale=1' />
<link href='foo.css' type='text/css' rel='stylesheet' />
<meta name='src' content='foo.tex' />
<script>window.MathJax = { tex: { tags: "ams", inlineMath: [ ["(",")"] ], displayMath: [ ['$$','$$'], ["[","]"] ], processEscapes: true, processEnvironments: true, packages: ['base', 'color', 'ams'] }, loader: { load: ['[tex]/color', '[tex]/ams'] } }; </script>
<script id='MathJax-script' type='text/javascript' async='async' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js'></script>
</head><body>
<!-- l. 10 --><p class='noindent'>begin{align} 1 + 0 & = 1, label{eq1} 1 + 1 & = 2, label{eq2} e^{i pi } = -1. label{eq3} end{align}
</p><!-- l. 12 --><p class='noindent'>Equation ( eqref{eq1} ), ( eqref{eq2} ) and ( eqref{eq3} ) describe eternal truths.
</p><!-- l. 15 --><p class='indent'> The equation ( e^{i pi } = -1 ) can also be rewritten as ( e^{i pi } + 1 = 0 ) which is known as Euler’s identity.
</p>
</body>
</html>
Here is an example JSFiddle that shows the output: https://jsfiddle.net/9xubrm47/.
Correct answer by Lone Learner on December 11, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP