0

I am trying to export a TeX file to HTML. However, I am encountering problems because the resulting HTML file is just plain text without any structure or format, so it is unusable. I am using MiKTeX distribution and TeXMaker.

My code looks as follows (taken from http://www.xm1math.net/doculatex/epub.html)

\documentclass[10pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage[french]{babel}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\section{Une section}
\subsection{Une sous-section}
\lipsum[1]
\subsection{Une deuxieme sous-section}
\lipsum[2]
\end{document}

I then use "Tools">"Export via TeX4ht">"as HTML" to produce the HTML document. This goes well but when I open the HTML in any browser, it is only plain, unformatted text:

Table des matières 1 Une section 1 1.1 Une sous-section . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Une deuxieme sous-section . . . . . . . . . . . . . . . . . . . . . . 1 1 Une section 1.1 Une sous-section Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vesti- bulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et ne- tus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tel- lus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. 1.2 Une deuxieme sous-section Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris. 1

Any ideas what is exactly going wrong here?

  • Welcome to TeX.SX! – strpeter Mar 27 '17 at 9:25
  • Does it work when you try on the command line? E.g., "C:\Program Files (x86)\MiKTeX 2.9\scripts\tex4ht\htlatex.bat" test.tex as in tex.stackexchange.com/questions/197913 ? – Marijn Mar 27 '17 at 9:43
  • how does the source code of the HTML page look like? does it contain tags, or is it just a plain text as well? – michal.h21 Mar 27 '17 at 9:52
  • @Marijn - Thanks for your reply. I now tried this. I encountered the following issues: The location you mentioned does not exist. I can only find C:\Program Files\MiKTeX 2.9\miktex\bin\x64\htlatex.exe. If I then run the code on this location, I get the message I can't find the file test.tex. – deca Mar 27 '17 at 11:40
  • @michal.h21 - Thanks for your reply. I opened the file in a text editor, and there are no tags whatsoever - only plain text. – deca Mar 27 '17 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.