I have been looking around for an easy way to save my .tex into a .html file, but all the questions/answers are very technical, and I have not found one that is accessible to me/beginners. I have seen a bunch of names of presumably packages (hlatex? tex4ht?) but no basic explanation of 'how to', from A to Z. I mean, actually basic instructions (do i need to install anything? what? where do i run codes? etc..) Anyone available to do that for me? Thanks you SO much!! Giulia.
tex4ht: it is a system which use TeX itself for the conversion. It redefines TeX commands to insert special instructions, which can be configured to insert HTML or XML codes. Positive consequence of using TeX itself is that it supports all custom commands and packages to some degree - you need to provide configurations to get good markup, but basic stuff like font style and size should work even for unsupported custom commands.
The output files are extracted from the DVI file using
tex4ht command, another command
t4ht then creates CSS file and images.
So basically, to convert LaTeX file to HTML using
tex4ht, this sequence of commands must be called:
latex with special instructions for tex4ht tex4ht t4ht
To simplify the setup, several helper scripts exists. The basic script is
htlatex, which calls all necessary commands and pass optional arguments for them.
Nowadays, it is better to use make4ht (disclaimer: I am the author), which has several advantages over
- it has simpler command line interface
- it supports build files, where it is possible to call additional commands like
- it can post-process the output files and fix some issues, using Lua scripts or any XML processing tool such as XSLT
tex4ht and all necessary scripts are part of TeX distributions, most up to date version is in TeX Live 2018. It is not necessary to install anything.
In TL 2018, you can use it in this way:
Basic invocation, with HTML5 output in
make4ht -u filename.tex
Output in the
make4ht -f odt filename.tex