I used SimpleTeX4ht to convert a LaTeX file to HTML. The file is fine except that square roots are rendering badly in juxtaposition with the rest of the text, e.g. like:
Any suggestions on how to get the square roots to render better? (Whether by using a different converter, using different LaTeX, etc.)
My LaTeX code is
\noindent \textbf{Example:} Failure of unique prime factorization in $\mathbb{Z}[\sqrt{-5}\hspace{0.1 cm}]$:\\
$6 = (1 + \sqrt{-5})\cdot (1 + \sqrt{-5}) = 2 \cdot 3$.\
and the corresponding HTML is something like
<!--l. 269--><p class="noindent" ><span
class="cmbx-12">Example: </span>Failure of unique prime factorization in <span
class="msbm-10x-x-120">ℤ</span>[<img
src="Fermat10x.png" alt="√ --5" class="sqrt" > ]:<br
class="newline" />6 = (1 + <img
src="Fermat11x.png" alt="√ ---
- 5" class="sqrt" >) <span
class="cmsy-10x-x-120">⋅ </span>(1 + <img
src="Fermat12x.png" alt="√ ---
- 5" class="sqrt" >) = 2 <span
class="cmsy-10x-x-120">⋅ </span>3.<br
class="newline" />
Best Answer
The previous two answers have already addressed your immediate query. However, I would like to add that may be you should try
pandoc
Homepage. It can convert various formats likelatex
, html, xhtml, html5, docx, odt, epub,conTeXt
etc. into each other. My experience has been pleasant. However, installation of pandoc requireshaskell platform
which took nearly 350MB of space onubuntu 12.04
.For a good rendering of math in
html
, I think thatmathjax
is the way to go. It is supported by most browsers. It can handle most of thelatex
math environments. One drawback though is the slow loading of the webpages with a lot of math.I used:
to get
Personally, I have converted my PhD Thesis with a lot of math into html using
pandoc
which also handles bibliographies.EDIT: Major bugs regarding math environments have been addressed in pandoc v1.9.2. The example above uses the latest version 1.9.4.5. Ubuntu repository has older versions. Hence, it is recommended that the latest versions be installed from
haskell
repository for best results.