Skip to content

Commit

Permalink
Generate HTML via make4ht
Browse files Browse the repository at this point in the history
So the patch basically add some script for generating html files.

In html.cfg :
Add tables of contents
Specify the layout of lkmpg.html

In Makefile :
Add a new target `html` for generating html files and put them in html/
directory.
Add a symbolic link `index.html` linked to `lkmpg.html`

In lkmpg.tex :
Turn off the \tableofcontens section when using make4ht to prevent
from errors
  • Loading branch information
fennecJ committed Aug 1, 2021
1 parent 4639ca1 commit 4fbf305
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@ _minted-lkmpg
*.out
lkmpg.pdf
*.toc

# make4ht
*.html
*.svg
*.tmp
*.css
*.4ct
*.4tc
*.dvi
*.lg
*.idv
*.xref
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ all: lkmpg.tex
bibtex main >/dev/null || echo
pdflatex -shell-escape $< 2>/dev/null >/dev/null

html: lkmpg.tex
make4ht --shell-escape --utf8 --format html5 --config html.cfg --output-dir html lkmpg.tex
ln -sf lkmpg.html html/index.html
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

clean:
rm -f *.dvi *.aux *.log *.ps *.pdf *.out lkmpg.bbl lkmpg.blg lkmpg.lof lkmpg.toc
rm -rf _minted-lkmpg
rm -rf html

.PHONY: html
36 changes: 36 additions & 0 deletions html.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
\Preamble{xhtml}

\Configure{tableofcontents*}{chapter,section,subsection}

\Css{* :not(img) {
max-width: 100\%;
width: 50vw;
height: auto;
margin: 0 auto;
}}

\Css{* {
font-size: 1vw;
}}

\Css{.ecrm-0500 {
font-size: 70\%;
font-style: italic;
color: gray;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}}

\Css{.ecrm-0500:after {
content:" ";
white-space: pre;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}}

\begin{document}
\EndPreamble
4 changes: 4 additions & 0 deletions lkmpg.tex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
\begin{document}

\maketitle
\ifdefined\HCode
% turn off TOC
\else
\tableofcontents
\fi

\section{Introduction}
\label{sec:introduction}
Expand Down

0 comments on commit 4fbf305

Please sign in to comment.