Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

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

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:

http://code.google.com/p/hyphenator/wiki/en_HowToUseHyphenator

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

 
discard

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.