From the LaTeX file machin.tex, produce a machin.html file whose visual appearance is almost identical to the visual appearance of the machin.pdf file produced by PDFLaTeX.
The file machin.html must be autonomous, incorporating all its resources (style sheet, images, etc ... .).
History: I started with existing LaTeX files, compiling with PDFLaTeX. It was only later that I had the idea to compile them in html as well. I tried LaTex2html, pandoc, and finally I chose TeX4ht. Then I realised that I could make the .html files stand alone.
Note: I do not exclude that I will also use an html compilation with pandoc.
The aim is to define and use LaTeX resources that adapt to the case of compilation by PDFLaTeX or TeX4ht, with schemes like :
\ifdefined\HCode \newcommand{\machin}[1]{\HCode{<div ... >} #1 \HCode{<\div>} }
\else \newcommand{\machin}[1]{ ... }
\fi
The written LaTeX environments and commands are not completely finished. There is still a bit of tinkering, but the results are already quite satisfactory. It remains to refine, to put some order, to have a clearer, more rigorous source code. For the moment, being far from being able to write a "manual", I will give examples of LaTeX files "as is", where
the preamble, common to all my files, contains a bunch of packages and definitions that are useless here (one day, I'll tidy things up ...)
the body of the document contains few specific alternatives for distinguishing between PDFLaTeX and TeX4ht.
Below are .zip files, containing LaTeX (.tex), pdf and html files resulting from compilations, and possibly other files, e.g. images (.png, .svg, ... ), needed for the compilation.
A. Compile to .pdf, with PDFLaTeX
pdflatex -shell-escape -synctex=1 -interaction=nonstopmode %source
B. Compile to html, with TeX4ht, in this order:
make4ht %source "xhtml,charset=utf-8,mathjax" " -cunihtf -utf8"
htlatex %source "xhtml,charset=utf-8,mathjax,css-in" " -cunihtf -utf8"
make4ht compiles and creates the .html file and the .css file, then
htlatex recompiles and incorporates the previous .css file into the .html file.
A bidule.zip document, contains the LaTeX source file bidule.tex, possibly the files needed for compilation (e.g. .png .svg images, ... ), as well as the bidule.pdf and bidule.html files resulting from the compilations.
These are elements that complement what can be found in other sections of this site, selected from among the most significant.
Cordic: Cordic-cosh-sinh-EN.zip
Python xx décimales: Decimal-pi-EN.zip
Python fichiers / LaTeX: Python-fichier-dep-to-csv-EN.zip
Python tkinter, ttk: Python-autoscroll-ListBox-Text-EN.zip
LaTeX: Latex-python-EN.zip
Pivot de Gauss: Pivot-de-Gauss-AB-to-PVV-EN.zip
Algorithmes: France-C-EN.zip
Logique: Beth-ELQuasiTP-TP-EN.zip
Maths: PolynomesCreux-EN.zip