# How to prevent a tex4ht or pdftohtml html document from breaking justification?

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:


\documentclass[twocolumn]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{fancyhdr}
\setlength{\columnsep}{0.7cm}

\usepackage{lettrine}
\renewcommand{\footrulewidth}{0.4pt}
\title{bla bla}
\date{}
\begin{document}
\maketitle
\fontfamily{ptm}\selectfont

\begin{figure}
\includegraphics[width=0.45\textwidth]{/Path/to/file}
\end{figure}

\cfoot{}
\thispagestyle{fancy}\blindtext

\lettrine[lines=2,slope=2pt,findent=2pt,nindent=3pt,loversize=0.1]{B}{}\blindtext

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

\end{document}



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.

-
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: