The lwarp package converts LaTeX to HTML by using LaTeX to process the user’s document and directly generate HTML tags. External utility programs are only used for the final conversion of text and images. Math may be represented by SVG images or MathJax. More than 500 LaTeX packages and classes are supported, of which more than 60 also support MathJax.
Documents may be produced by DVI or PDF LaTeX, LuaLaTeX, XƎLaTeX; by several CJK engines, classes, and packages; or by customized systems such as perltex and pythontex. A texlua script automates compilation, index, glossary, and batch image processing, and also supports latexmk. Configuration is semi-automatic at the first manual compile. Support files are self-generated. Print and HTML versions of each document may coexist.
Assistance is provided for HTML import into EPUB conversion software and word processors.
Requirements include the commonly-available Poppler utilities (included with MiKTeX) and Perl. Detailed installation instructions are included for each of the major operating systems and TeX distributions.
A quick-start tutorial is provided, as well as extensive documentation for special cases, a general index, and a troubleshooting index. Automatic testing of package load order and image generation offers useful advice for resolving errors.
SVG math and many other generated images include LaTeX expressions in the alt tags. MathJax may be used with advanced equation numbering under the direct control of lwarp.
Complicated tables are supported, which copy/paste well into LibreOffice Writer.
Supported classes and packages include memoir and koma-script, cleveref, caption, mdframed, siunitx, and many popular packages for tabulars, floats, graphics, theorems, the title page, bibliography, indexing, footnotes, and editorial work.
TeX is a self-modifying tokenized macro-expansion language. Since lwarp is written directly in LaTeX, it is able to interpret the document’s meaning at a deeper level than external conversions which merely approximate TeX. HTML5 and CSS3 are leveraged to provide advanced features such as booktabs trim, multicolumns, side-by-side minipages, and JavaScript-free navigation.
Lwarp technology white paper
For an introduction to the technology used by the lwarp package to convert HTML to LaTeX, please see the publication Producing HTML directly from LaTeX: the lwarp package.
Latest News
Fixed \ref*, \chaptername, starred macros for cleveref and varioref, xfakebold. Improved varioref. Added option for various ways to display index links. Added gindex, xindex. Verified to work as-is with varindex. Added fbox, shadethm, tcolorbox, termcal, thmbox, thmtools.
MathJax improvements for physics, mathtools, nccmath, mhchem, cancel. Added citeref, drftcite, jurabib, multibib, splitbib. Verified to work as-is with bibtopic, collref, mciteplus.
MathJax: Updated to v3. Fixed forward references. Improved equation numbering. Added support for starred macros, and starred macros for mathtools, nccmath, physics. Improved filename generation. Fixed labels in eqnarray and lateximage. Fixed nccmath, xcolor.
Fixed fontspec for non-Latin languages. Fixed idxlayout, mathtools, titlesec, url.
Added optional previous/next page links. Numerous fixes.
Fixes for memoir, update for physunits.
Improved footnotes with MathJax. Added MathJax emulation for endnotes, marginnote, nccfoots, pagenote, parnotes, sidenotes. xpinyin: Added pinyin with modern HTML. luatexko: Added \dotemph, \ruby, \uline, etc. Fixed amsmath, soul, ulem, endnotes. Updated chemfig, draftwatermark. Verified to work as-is with tocvsec2, tableof. Added etoc (nullified).
Improved MathJax emulation processing speed. Added MathJax emulation for accsupp, axessibiltiy, colonequals, decimal, dotlessi, econometrics, engtlc, multiobjective, physunits, SIunits, stackrel, statmath. Updated axessibility to 2020/01/08 version. Updated gridset to v0.3. Fixed SIunits for math mode. Added DotArrow, nolbreaks, luamplib, returntogrid, statex2, tagpdf. Verified to work as-is with icomma, mathpunctspace, textualicomma.
biblatex and url now create hyperlinks. Added docs and warning messages about slow MathJax. Added MathJax emulation for accessibility, autobreak, centernot, extarrows, fouridx, gensymb, leftidx, mathcomp, mathdots, mathfixs, mismath, nccmath, noitcrul, pdfcomment, relsize, rmathbr, subsupscripts, xfrac. Improved MathJax emulation for unicode-math. Added fewerfloatpages, ghsystem, hhline, mismath, nccmath.
Now supports nested tabulars. Added or improved MathJax emulation for amsmath, ar, arydshln, bm, bigdelim, bigstrut, booktabs, braket, mathtools, multirow, physics, siunitx, slashed, unicode-math, xfakebold. Fixed minor issues with graphicx, caption, multirow, siunitx, booktabs, transparent, subcaption, floatrow. Updated epigraph, xurl. Added widetable, witharrows, steinmetz, awesomebox, catoptions, svg, supports svg-extract, parcolumns, pdfcolparcolumns, parallel, pdfcolparallel, pdfcol, pdfcolfoot, pdfcolmk.
Fixed support files, graphics alt tags, babel-french hyperlinks, media9, media15, and multimedia. Added accessibility.
Updated booktabs, chemformula.
Updated MathJax, xr, xr-hyper, acro. Verified to work as-is with xcite. Improved documentation regarding multiple projects in the same directory.
Fixes for \normalcolor, minipage \linewidth. Fixes for keyfloat and wrapfig.
Added to tutorial. Improved support for HTML alt text. Improved SVG math. Improved lyluatex. Tested to work as-is with mathspec, unicode-math.
Sample Output
• Check the HTML code of these web pages for examples of the lwarp generator’s output.
• Download a 7 MB PDF print version of this website, to compare with the online HTML version.
Download
Download the lwarp package from the lwarp page on CTAN — the Comprehensive TeX Archive Network, or use your TeX distribution’s update tools.
The lwarp v0.88 manual is also available here.
Table 1 lists some of the various LaTeX features which may be used. Hundreds of packages have been adapted for lwarp, and many more work without modification.
Package names are colored according to their support level:
Supported as-is.
Modifed to work with HTML output, and also as print output in SVG math or lateximage environments.
Emulated for HTML output.
Ignored for HTML output, but provides source-level compatibility.
Supported as-is for MathJax, subject to limitations.
Emulated for MathJax using custom macros, subject to limitations.
Ignored by MathJax, but may be used in the document source.
Category |
Status and supported features. |
Engines: |
DVI LaTeX, pdfLaTeX, XƎLaTeX, LuaLaTeX, upLaTeX |
Compiling: |
latexmk, perltex, pythontex, make, etc. |
Classes: |
article, book, report, scrartcl, scrbook, scrreprt, memoir, CJK-related as listed below. |
Koma-script: |
scrextend, scrhack, scrlayer. Others as listed below. |
Memoir: |
memhfixc |
Languages: |
babel, polyglossia. cjkpunct, xeCJK. |
Chinese: |
CTeX, ctex, upzhkinsoku, xpinyin, zhlineskip, zhspacing. |
Japanese: |
upLaTeX, LuaTeX-ja, gentombow, lltjext, plarray, plarydshln, plautopatch, plext, plextarray, plextarydshln, plextcolortbl, plextdelarray, pxatbegshi, pxeveryshi, pxftnright, pxgentombow, pxjahyper, pxpdfpages, pxpgfrcs, pxpgfmark, tascmac, zxjatype. bxjsarticle and related, ltjsarticle and related, luatexja, luatexja-fontspec, ujarticle and related, utarticle and related. |
Korean: |
kotex, luatexko, xetexko. |
Page layout: |
2in1, 2up, a4, a4wide, a5comb, addlines, anysize, atbegshi, blowup, booklet, bophook, bounddvi, bxpapersize, canoniclayout, changelayout, changepage, chngpage, clrdblpg, continue, draftcopy, draftfigure, draftwatermark, ebook, everyshi, fancyhdr, fancytabs, flippdf, fullminipage, fullpage, fwlw, geometry, gmeometric, grid, grid-system, gridset, layaureo, layout, layouts, leading, ltxgrid, nccfancyhdr, notespages, nowidow, pagegrid, pagesel, parallel, parcolumns, pdfcolparallel, pdfcolparcolumns, pdfcrypt, pdfprivacy, preview, ragged2e, returntogrid, rmpage, scrlayer-scrpage, scrpage2, setspace, textarea, threadcol, thumb, thumbs, titleps, tocenter, turnthepage, twoup, typearea, underlin, vmargin, watermark, widows-and-orphans, zwpagelayout. |
Sectioning: |
Adds FileDepth for splitting the HTML output. Files may be numbered sequentially or named according to section name. Common short words and punctuation are removed from the filenames. anonchap, bsheaders, fncychap, hypbmsec, indentfirst, quotchap, section, sectionbreak, secdot, sectsty, titlesec, tocvsec2. |
Table of contents, figures, tables: |
Supported, with hyperlinks. etoc, minitoc, multitoc, shorttoc, tableof, titletoc, tocbasic, tocbibind, tocdata, tocloft, tocstyle, tocvsec2. |
Title page: |
\maketitle, titlepage, authblk, titling. |
Front & back matter: |
abstract, appendix. |
Indexing: |
makeindex, xindy, and xindex are supported, with hyperlinks. gindex, hvindex, idxlayout, imakeidx, index, makeidx, repeatindex, splitidx, varindex, xindex. |
Glossary: |
gloss, glossaries and xindy, nomencl. |
Bibliography: |
babelbib, bibtopic, backref, biblatex, bibunits, chapterbib, cite, citeref, collref, drftcite, hypernat, jurabib, mcite, mciteplus, multibib, natbib, notes2bib, splitbib, showtags. |
Cross-references: |
bookmark, breakurl, cleveref, fancyref, hypdestopt, hyperref, perpage, prettyref, titleref, url, varioref, xcite, xr, xr-hyper, xurl. |
Margin notes: |
marginal, marginfit, marginfix, scrlayer-notecolumn, versonotes. |
Footnotes: |
Adds FootnoteDepth to print footnotes at section breaks. MathJax emulation for \footnote, and also as marked in the following: bigfoot, dblfnote, endheads, endnotes^{MJ}, fixfoot, fnbreak, fnpara, fnpos, footmisc, footnote, footnotebackref, footnoterange, footnpag, manyfoot, marginnote^{MJ}, nccfoots^{MJ}, pagenote^{MJ}, parnotes^{MJ}, pdfcolfoot, pfnote, sepfootnotes, sidenotes^{MJ}, tablefootnote. |
Math: |
Converted to SVG images with HTML <alt> tags containing the LaTeX source for the math expression. MathJax supported as an alternative. amsmath^{MJ}: AMS environments are supported. User-defined macros are available during converson, due to native LaTeX processing. |
Theorems: |
Native LaTeX theorems, amsthm, ntheorem, shadethm, theorem, thmbox, thmtools. |
Additional math: |
Math fonts via SVG images, amscd, autobreak^{MJ}, autonum, backnaur, bm^{MJ}, braket^{MJ}, breqn, cases, centernot^{MJ}, colonequals^{MJ}, decimal^{MJ}, delarray, DotArrow^{MJ}, dotlessi^{MJ}, dotlessj^{MJ}, extarrows^{MJ}, fouridx^{MJ}, guass, icomma^{MJ}, jkmath, leftidx^{MJ}, mathcomp^{MJ}, mathdots^{MJ}, mathfixs^{MJ}, mathpunctspace^{MJ}, mathspec, mathtools^{MJ}, mismath^{MJ}, multiobjective^{MJ}, nccmath^{MJ}, nicematrix, noitcrul^{MJ}, pb-diagram, resizegather, rmathbr^{MJ}, stackrel^{MJ}, statex2^{MJ}, statmath^{MJ}, subsupscripts^{MJ}, textualicomma^{MJ}, unicode-math^{MJ}, witharrows^{MJ}, xfakebold^{MJ}, xy. Many others work as-is. |
Display math with \displaymathother: |
Complicated math objects in display math, such as tikz-cd, etc. |
Units and fractions: |
nicefrac^{MJ}, SIunits^{MJ}, siunitx^{MJ}, units^{MJ}, unitsdef, xfrac^{MJ}. |
Floats: |
Appear where declared. capt-of, caption, cutwin, dblfloatfix, endfloat, fewerfloatpages, fix2col, flafter, float, floatflt, floatrow, fltrace, ftcap, hypcap, keyfloat, morefloats, multicap, newfloat, nonfloat, placeins, rotfloat, stfloats, subcaption, subfig, subfigure, subfloat, topcapt, trivfloat, wrapfig. |
Tabular: |
tabular environment, array^{MJ}, arydshln^{MJ}, bigdelim^{MJ}, bigstrut^{MJ}, booktabs^{MJ}, colortbl, ctable, diagbox, hhline^{MJ}, longtable, ltablex, ltxtable, multirow^{MJ}, supertabular, tabularx, tabulary, threeparttable, threeparttablex, widetable, xltabular, xtab. |
Graphics: |
graphics and graphicx. \includegraphics supports width, height, origin, angle, and scale tags, and adds class. References to PDF files are changed to SVG, other image types are accepted as well. \rotatebox and \scalebox are supported as well as HTML can handle. rotating is emulated but all objects are unrotated. picture, tikz, and xy are converted to an SVG image. asymptote, curves, datatool, eepic, epsfig, epstopdf, figsize, fitbox, grffile, luamplib, media9, movie15, multimedia, overpic, pict2e, psfrag, psfragx, pst-eps, pstool, pstricks, rviewport, svg, svg-extract, tikz-3dplot. |
xcolor: |
Full package color names, any color models, and mixing. \textcolor, \colorbox, \fcolorbox. Enhanced for HTML compatibility. |
Lists: |
Standard LaTeX environments, enumerate, enumitem, eqlist, hang, listliketab, paralist. |
Environments: |
Standard LaTeX environments. |
minipage, \parbox: |
Some HTML5-imposed limitations. Nested minipages are supported. eqparbox, minibox, pbox, shapepar. |
Quotations: |
copyrightbox, csquotes, epigraph, quoting, verse. |
Verbatim: |
fancyvrb, moreverb, shortvrb, verbatim. |
Frames: |
boxedminipage, boxedminipage2e, fancybox, fbox^{MJ}, framed, mdframed, niceframe, shadow, tcolorbox^{MJ}, vertbars. |
Multi-columns: |
adjmulticol, multicol, multicolrule, vwcol. |
Margins: |
fullwidth, hanging, midpage. |
Line numbering: |
fnlineno, lineno. |
Direct formatting: |
\emph, \textsuperscript, \textbf, etc are supported. \bfseries, etc. are only supported in some cases. cancel^{MJ}, ellipsis, embrac, enparen, hyphenat, lettrine, lips, lua-check-hyphen, luacolor, magaz, nolbreaks, normalcolor, pdfcol, pdfcolmk, pdfrender, realscripts, relsize^{MJ}, scalefnt, soul, soulpos, soulutf8, stackengine, textfit, thinsp, trimclip, truncate, ulem, umoline, underscore, uspace, xellipsis. |
Acronyms: |
acro, acronym. |
Ordinals: |
engord, fmtcount, nth. |
Text ligatures: |
Ligatures for symbols are supported. Ligatures for f, q, t are intentionally turned off because many simpler browsers do not display them correctly. Modern full-featured browsers re-create these ligatures on-the-fly. |
Horizontal space: |
HTML output for thin-unbreakable, unbreakable, \enskip, \quad, \qquad, \hspace. |
Rules: |
\rule with width, height, raise, text color. |
HTML reserved characters: |
\&, \textless, and \textgreater are converted to HTML entities. |
Fonts: |
Used as-is. Appear in SVG math expressions or embedded image environments. fontaxes, nfssext-cfr, slantsc, tabfigures. Tested to work as-is: Special font macros in cfr-lm and others which use nfssext-cfr. |
Symbols: |
Native LaTeX diacriticals, academicons, amssymb^{MJ}, bbding, chemgreek, dingbat, euro, eurosym, fontawesome, fontawesome5, gensymb^{MJ}, latexsym^{MJ}, marvosym, mathcomp^{MJ}, metalogo, metalogox, pifont, textalpha, textcomp, textgreek, typicons, xunicode. |
Files: |
attachfile, attachfile2, hyperxmp, inputtrc, intopdf, pdfpages, pdfx, xmpincl. |
Science and engineering: |
algorithm2e, algorithmicx, ar^{MJ}, askmaps, axodraw2, bitpattern, blochsphere, bodegraph, bohr, bytefield, chemfig, chemformula, chemgreek, chemmacros, chemnum, circuitikz, econometrics^{MJ}, elements, engtlc^{MJ}, fast-diagram, ghsystem, hepnicenames, heppennames, karnaughmap, karnaugh-map, listings, listingsutf8, linop, mhchem^{MJ}, pgfgantt, phfqit, physics^{MJ}, physunits^{MJ}, qcircuit, register, simpler-wick, slashed^{MJ}, steinmetz^{MJ}, structmech, struktex. tikz-karnaugh, tikzcodeblocks |
Arts and humanities: |
foreign, forest, lyluatex, musicography, nameauth, octave, phonrule, piano, schemata, semantic-markup, tikz-dependency, vowel, xpiano |
Calendars: |
termcal |
Admonitions: |
awesomebox, notes. |
Editorial: |
changebar, changelog, changes, easy-todo, easyReview, ed, errata, fixme, fixmetodonotes, pdfcomment^{MJ}, pdfmarginpar, todo, todonotes, tram, xechangebar. |
Accessibility: |
accessibility^{MJ}, accsupp^{MJ}, axessibility^{MJ}, pdfcomment^{MJ}, tagpdf. |
Package handling: |
catoptions. |
Debug: |
chkfloat, cmdtrack, dprogress, lua-visual-debug, refcheck, srcltx, srctex, vpe, xbmks. |
Working as-is: |
Various utility, calculation, file, and text-only packages, such as calc, fileerr, somedefs, trace, xspace. Also, most math-only packages, including specialized typesetting for various fields of science and engineering. |