I'm a LaTeX beginner and I'm writing computer science documents. I carefully choose my algorithmic package considering the features I needed and that led me to pick algorithm2e (vlined and noend options, pretty much the only package capable of providing this unique combination). My algorithms will be using French keywords, but I doubt that is relevant to this question.

I will also need to publish my documents on the web. I have started looking around for tools to convert from LaTeX to HTML, but none of them seem to support the algorithm2e package properly (tried htlatex, pandoc and LaTeXML).

Is there a conversion tool that will convert LaTeX properly (found out that pandoc doesn't that good of a job with regular LaTeX) AND support algorithm2e?

EDIT: An example tex file of what I am trying to convert to HTML:





\section{Titre de section}

\subsection{Titre de sous-section}

This section provides a demo algorithm.

$max \gets a_1$\;
\For{$i \gets 2$ \textbf{to} $n$} {
  \If{$a_i > max$} {
    $max \gets a_i$\;

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Regarding your question, I really doubt there will be anything out there (though I would be glad to be proven wrong). It is very difficult for LaTeX to HTML converter to support packages other than by outright re-implementing that package entirely in the converter. There might be some tricks you can do with CSS and the HTML output, but that will depend on the converter. Alternatively, you could perhaps upload and embed the PDF.
    – JP-Ellis
    Feb 13, 2016 at 11:10
  • it would probably be useful if you provided a small test file then results of various possibilities are more likely to be tested. Feb 13, 2016 at 11:38
  • Your code does not compile in pdflatex nor in lualatex? How did you compile it?
    – Nasser
    Feb 13, 2016 at 12:02
  • I'm using texstudio with TexLive. What error are you getting?
    – binarez
    Feb 13, 2016 at 12:30
  • I am using TL 2015. with lualatex, I get this error: !Mathematica graphics and with pdflatex, I get this error !Mathematica graphics I just copied what you have above.
    – Nasser
    Feb 13, 2016 at 12:50

1 Answer 1


The structure created by algorithm would be quite hard to represent in HTML, it seems that more sensible approach is to convert it as image. Fortunately, we can convert any piece of code to image with tex4ht, using simple configurations. Save the following code as mycfg.cfg:




this is configutation file for tex4ht. Important commands are \ConfigureEnv, which inserts code before and after configured environment, algorithm, in our case. Command \Picture*{} ... \EndPicture converts enclosed content to a picture. \Configure{Picture}{.svg} requests SVG format for images, which is preferred format for textual pictures these days.

tex4ht doesn't know how to convert to SVG by default, we must use build file for make4ht (build system for tex4ht). Save the following code as yourtexfilename.mk4:

if mode=="draft" then

Make:image("svg$","dvisvgm -n -p ${page} -c 1.4,1.4 -s ${source} > ${output}")

this build file uses dvisvgm for conversion to SVG. Compile with:

 make4ht -uc mycfg.cfg yourtexfilename.tex

the result:

enter image description here


You must log in to answer this question.

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