Skip to content

Commit 044cfef

Browse files
authored
Generate HTML via make4ht (#20)
This patch generates HTML files with "make4ht" in the "html" directory. Known issues with "make4ht": Running "make4ht -suf html5 -d html lkmpg.tex" will cause the following flaws: 1. The layout was unsatisfying. 2. After parsing TeX, it stoped at "\tableofcontents" with errors. 3. Several unneeded files were generated. 4. No way to specify the destination filename for HTML generation. Solutions/workaround: 1. Use customized configuration file "html.cfg" to specify the layout style. 2. Turn off the \tableofcontents section when using make4ht. However, this results in the lack of table of contents in HTML. It can be fixed by appending "\Configure{tableofcontents*}{chapter,section,subsection}" to configuration file. 3. The build system removes the temporary files. 4. Use a symbolic link "index.html" to "lkmpg.html".
1 parent d097d0c commit 044cfef

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,15 @@ _minted-lkmpg
1515
*.out
1616
lkmpg.pdf
1717
*.toc
18+
19+
# make4ht
20+
*.html
21+
*.svg
22+
*.tmp
23+
*.css
24+
*.4ct
25+
*.4tc
26+
*.dvi
27+
*.lg
28+
*.idv
29+
*.xref

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ all: lkmpg.tex
44
bibtex main >/dev/null || echo
55
pdflatex -shell-escape $< 2>/dev/null >/dev/null
66

7+
html: lkmpg.tex html.cfg
8+
make4ht --shell-escape --utf8 --format html5 --config html.cfg --output-dir html lkmpg.tex
9+
ln -sf lkmpg.html html/index.html
10+
rm -f lkmpg.xref lkmpg.tmp lkmpg.html lkmpg.css lkmpg.4ct lkmpg.4tc lkmpg.dvi lkmpg.lg lkmpg.idv lkmpg*.svg lkmpg.log lkmpg.aux
11+
712
clean:
813
rm -f *.dvi *.aux *.log *.ps *.pdf *.out lkmpg.bbl lkmpg.blg lkmpg.lof lkmpg.toc
914
rm -rf _minted-lkmpg
15+
rm -rf html
16+
17+
.PHONY: html

html.cfg

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
\Preamble{xhtml}
2+
3+
\Configure{tableofcontents*}{chapter,section,subsection}
4+
5+
\Css{* :not(img) {
6+
max-width: 100\%;
7+
width: 50vw;
8+
height: auto;
9+
margin: 0 auto;
10+
}}
11+
12+
\Css{* {
13+
font-size: 1vw;
14+
}}
15+
16+
\Css{.ecrm-0500 {
17+
font-size: 70\%;
18+
font-style: italic;
19+
color: gray;
20+
-webkit-user-select: none;
21+
-moz-user-select: none;
22+
-o-user-select: none;
23+
user-select: none;
24+
}}
25+
26+
\Css{.ecrm-0500:after {
27+
content:" ";
28+
white-space: pre;
29+
-webkit-user-select: none;
30+
-moz-user-select: none;
31+
-o-user-select: none;
32+
user-select: none;
33+
}}
34+
35+
\begin{document}
36+
\EndPreamble

lkmpg.tex

+4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
\begin{document}
4141

4242
\maketitle
43+
\ifdefined\HCode
44+
% turn off TOC
45+
\else
4346
\tableofcontents
47+
\fi
4448

4549
\section{Introduction}
4650
\label{sec:introduction}

0 commit comments

Comments
 (0)