The arXiv now lets us read html versions of new papers. They are built using latexml. Thus, when writing our latex papers for the arXiv, we are now targeting two outputs: pdf and html.

  • What gotchas do we need to be aware of when writing latex that should be built with both these targets?
  • Are there interesting features of latexml that we can exploit? E.g., can we embed video or add interactive content etc?
  • Can we indicate code that is to be used only for the latexml target? E.g., \IfCompilerLatexML{% do this}{% else do that}

2 Answers 2


The goal of LaTeXML is to convert all LaTeX accurately, so that there are no gotchas ;). Probably the most important thing to be aware of is that not all packages are supported: https://math.nist.gov/~BMiller/LaTeXML/manual/included.bindings/

Since it aims to convert LaTeX accurately, you can't get new output by default. What you can do if provide a file <mytexfile>.latexml, which will be loaded before your file. This file can contain LaTeXML specific definitions, which means that you need to know TeX and LaTeXML's various functions (which are written in Perl). The contents of the .latexml file would be from https://math.nist.gov/%7EBMiller/LaTeXML/manual/customization/latexml/ and the links within. It's probably easiest to think of a package that does what you want and find LaTeXML's implementation at https://github.com/brucemiller/LaTeXML/tree/master/lib/LaTeXML/Package. But if you're aiming for new content like embedded video or interactivity, then you won't find that in the packages. In that case, one other possible source would be a few definitions I wrote for converting a textbook, including a function that embeds a Youtube video within an iframe.

LaTeXML provides its own package, latexml. If you load that package, then you can access the boolean \iflatexml, so that you can say \iflatexml do this\else do that\fi, or the other various ways to access TeX booleans.

  • Having seen almost for two decades,on this site, how people fuss about how their documents and even symbols look , time will tell how they will react to this change. LaTeXML is now almost 20 years old! Anyway it is a good chance for @egreg to get his second million reputation!
    – yannisl
    Commented Jan 23 at 16:19
  • 1
    @yannisl For decades I have seen many LaTeX users not care at all about even obvious typographical things so I would estimate the world of LaTeX users goes far beyond the world of typographically literate people, in fact in the world at large, LaTeX is not much more than Knuth input notation for math.
    – user691586
    Commented Jan 23 at 18:09

You may want to examine arXiv's current recommendations:


For some time longer the main focus will be to increase coverage. Just working on regular LaTeX submissions getting healthy HTML versions. arXiv is (at least today) not the ideal venue for experimentation with interactive figures and video. There are many possible futures, of course.

As to making the most of LaTeXML, the best advice I can offer would be "write with it in mind".

The tool is actively developed, and it is really worthwhile to reach out on github when you encounter valuable features that aren't supported yet. I can second Tim's reply. And to readers that find mapping LaTeX constructs to modern HTML exciting - we welcome contributions for yet-to-be-supported packages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .