0% found this document useful (0 votes)
69 views

Testing HTML Export With Tex4ht: 1 Overview of Steps

This document discusses exporting LaTeX documents to HTML using make4ht. It provides an overview of the steps involved, including tweaking the latexmkrc file to run make4ht with pdflatex. The document also provides examples of including images, making tables, writing mathematics, and more. TikZ drawings will be exported as SVG files and math is output as MathML to be rendered by MathJax. The export process has some caveats, such as fontspec and authblk not working fully with tex4ht.

Uploaded by

prleary
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Testing HTML Export With Tex4ht: 1 Overview of Steps

This document discusses exporting LaTeX documents to HTML using make4ht. It provides an overview of the steps involved, including tweaking the latexmkrc file to run make4ht with pdflatex. The document also provides examples of including images, making tables, writing mathematics, and more. TikZ drawings will be exported as SVG files and math is output as MathML to be rendered by MathJax. The export process has some caveats, such as fontspec and authblk not working fully with tex4ht.

Uploaded by

prleary
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Testing HTML Export with tex4ht

LianTze Lim

Abstract
Your abstract. Ça va? (Yes accented characters work.)

1 Overview of Steps
1. 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?)

2. my.cfg contains the settings I usually use in my workflow:

• Output math as MathML, and render it in browsers using Math-


Jax.
• 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 without any extra settings, but
you’ll need a patched pgfsys-tex4ht.def in your project.
• I’ve included some CSS styling. You can add a separate .css file
for further styling.

3. When compilation is complete, use the steps at View generated files


to download each generated file required.

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.

1
Figure 1: This frog was uploaded to Overleaf via the project menu. The
.jpg file will be used as-is in the HTML export.

Figure 2: PDF images will be converted to PNG when exported to HTML.

• 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 LATEX 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.

2
Item Quantity
Widgets 42
Gadgets 13

Table 1: An example table.

3.2 How to Make Tables


Use the table and tabular commands for basic tables — see Table 1, for
example.

3.3 How to Write Mathematics


LATEX 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
n
X1 + X2 + · · · + Xn 1X
Sn = = Xi
n n
i

denote their mean. Then as n approaches infinity, the random variables



n(Sn − µ) converge in distribution to a normal N (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. LATEX
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 . . .

1. Like this,

2. and like this.

. . . or bullet points . . .
• Like this,

• and like this.


. . . or with words and descriptions . . .
Word Definition

3
the journey
Origin Destination

Figure 3: TikZ drawings will be output as SVG, which should be rendered


by most modern browsers.

Concept Explanation

Idea Text

Testing some citations: [1, 2]

4 Tikz Drawings
TikZ drawings will be output as SVG, which should be rendered by most
modern browsers. However you need to use a patched copy of pgfsys-tex4ht.def
for things to work.

References
[1] NTLK Project. Natural Language Toolkit (NLTK) 3.0 documentation,
2015.

[2] Francis Bond, Lian Tze Lim, Enya Kong Tang, and Hammam Riza. The
Combined Wordnet Bahasa. NUSA: Linguistic studies of languages in
and around Indonesia, 57:83–100, 2014.

You might also like