Testing HTML Export with make4ht
Abstract
Your abstract. Ça va? (Yes accented characters work.)
1 Overview of Steps
- I tweaked the latexmkrc file so that make4ht is run along with pdflatex, so the HTML export is done only if you set your project to be compiled with pdflatex.(make4ht doesn’t work well with fontspec; I haven’t time to try this workflow with XeLaTeX nor LuaLaTeX yet. So let’s just leave it at pdflatex first, yeah?)
- my.cfg contains the settings I usually use in my workflow:
- Output math as MathML, and render it in browsers using MathJax.
- When \includegraphics uses .jpg, .png, .jpg, .svg, use the files directly for the HTML without conversion.
- When \includegraphics uses .eps and .pdf, convert them to .png using ImageMagick convert, and use those for the HTML.
- Tikz drawings are output as .svg.
- I’ve included some CSS styling. You can add a separate .css file for further styling.
- When compilation is complete, use the steps at View generated files to
download each generated file required. There’s also a
allfiles.zipthat contains all generated files.
1.1 Caveats
- This is an experimental hackety hack – things may just not work! More a proof-of-concept rather than a stable solution on Overleaf at present.
- tex4ht doesn’t work well with fontspec nor authblk.
- Avoid \mathbf – this broke MathML and MathJax for me.
- Avoid, or re-define the multicol environment to do nothing – tex4ht will really export text in two or three columns by PDF page, and it’s not the most readable.
2 Introduction
Your introduction goes here!3 Some LATE X Examples
3.1 How to Include Figures
First you have to upload the image file (JPEG, PNG or PDF) from your computer to writeLaTeX using the upload link the project menu. Then use the includegraphics command to include it in your document. Use the figure environment and the caption command to add a number and a caption to your figure. See the code for Figure 1 in this section for an example.
.jpg
file will be used as-is in the HTML export.
3.2 How to Make Tables
Use the table and tabular commands for basic tables — see Table 1, for example.| Item | Quantity |
|
|
|
| Widgets | 42 |
| Gadgets | 13 |
3.3 How to Write Mathematics
LATE X is great at typesetting mathematics. Let X1,X2,… ,Xn be a sequence of independent and identically distributed random variables with E[Xi] = μ and Var[Xi] = σ2 < ∞ , and let Sn = X1 + X2 + ⋯ + Xn n = 1 n∑ inX i denote their mean. Then as n approaches infinity, the random variables n(S n − μ) converge in distribution to a normal ?(0,σ2) . In this HTML export example, math is output as MathML, and will be rendered using MathJax.3.4 How to Make Sections and Subsections
Use section and subsection commands to organize your document. LATE X handles all the formatting and numbering automatically. Use ref and label commands for cross-references.3.5 How to Make Lists
You can make lists with automatic numbering …- Like this,
- and like this.
- Like this,
- and like this.
- Word
- Definition
- Concept
- Explanation
- Idea
- Text
