TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
Justification and hyphenation in a HTML document? – Qrrbrbirlbel Sep 9 '13 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... – David Carlisle Sep 9 '13 at 19:34

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:


share|improve this answer
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 Sep 9 '13 at 19:47
The purpose is to have an image in html. – doed Sep 9 '13 at 19:56
rules, lines, and graphics are in their own as an image, whereas the text isn't. – doed Sep 9 '13 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. – David Carlisle Sep 9 '13 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 Sep 9 '13 at 20:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.