Text is ragged to the left, hyphenation is off. Furthermore, the lettrine package otherwise perfectly indented types are misaligned as a result. Rules and graphics are in an image of its own.

So, for example:



\title{bla bla}




\begin{tabular}{ l l l }
\multicolumn{3}{c}{Bla bla bla)} \
& \multicolumn{1}{c}{blu}
Test & 18.5 \% \
Test & 17.4 \% \
Test & 17.5 \% \
Test & 13.6 \% \


Then run in a terminal: tex4ht [filename.tex] or pdftohtml -c [filename.pdf] that will convert it to html.

As a result, the graphics and rules and lines end up as an image file of its own. (*.png)

The lettrine type is misaligned. and the text of the document, which in this case, had been specified earlier with the twocolumn option, is no longer justified.

enter image description here enter image description here

  • Justification and hyphenation in a HTML document? Commented Sep 9, 2013 at 19:25
  • @Qrrbrbirlbel have a look at code.google.com/p/hyphenator it's quite good it uses the hyphenation algorithm of a system called TeX that you might have heard of... Commented Sep 9, 2013 at 19:34

1 Answer 1


By default HTML pages are not justified. It is however possible on modern browsers to use a JavaScript implementation of TeX's hyphenation algorithm which actually works pretty well.

You would need to download the file and configure tex4ht to add a script element to reference the script and add class="hyphenate" where you want to turn on hyphenation.

Basically just follow the simple instructions here:


  • sorry hehe. But I think there is a misunderstanding. I converted the pdf image using: pdftohtml and converted the tex document using tex4ht, which pretty much gives me the same thing: the image in html, with the exception that the new html file or image's text is not justified.
    – doed
    Commented Sep 9, 2013 at 19:47
  • The purpose is to have an image in html.
    – doed
    Commented Sep 9, 2013 at 19:56
  • rules, lines, and graphics are in their own as an image, whereas the text isn't.
    – doed
    Commented Sep 9, 2013 at 20:11
  • @doed image? I understood the question to be how to get text justified in the generated HTML as it would be if you processed the document with TeX. Commented Sep 9, 2013 at 20:13
  • yes. Sorry if I couldn't make the point across or describe it better. Pretty much the document has a footrule and headrule and graphics and table's rules in an image of its own. The text isn't justified though. And to make matters worse, the lettrine type (indented before and sloped just right) is misaligned. I could remove lettrine types and lettrine commands, but the text of the document would still be misaligned.
    – doed
    Commented Sep 9, 2013 at 20:18

You must log in to answer this question.

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