I would like to convert a LaTeX document (in this case, a resume) to HTML for submission, since .pdf and .dvi are not allowed formats. How can I do this while maintaining the same formatting (e.g. spacing, line lengths, etc.)? I have ha the most success using tex4ht, but this still produces line lengths that stretch across the screen and are bothersome to read. How can I solve this problem? Thanks in advance for helping!

  • you can always add `<style>body{max-width: 70em;}</style> or whatever you want to the generated html to fix the width – David Carlisle Jan 31 '14 at 17:38
  • Thanks! That did solve the biggest problem. However, it would be nice if there was a more automated way of fixing this and the couple other style problems I encountered. – Eleutharios Jan 31 '14 at 19:58

Although it doesn't convert LaTeX directly into HTML, I can really recommend PDF2htmlEX. It's a free software project, which delivers stunning results from the output of PDFtex. Its available for all major platforms (Linux, Mac Windows).

  • I tried PDF2htmlEX sometimes ago, right after reading about it in in tugboat magazine, I even mambled about it in chatroom here chat.stackexchange.com/transcript/41?m=13262198#13262198 but after testing it more, I found a big problem. The generated HTML worked very well in Firefox, but did not work well at all in Chrome. I also found it hard to ask questions about it and get help about it, since there does not seem to be active forum for it. (can one ask questions about it here for example? most likely no). It does seem very promising though, and I hope it works out. – Nasser Feb 6 '14 at 6:49
  • Ok, I use Firefox, so I never had problems. The Githubpage has the email adress of the maintainer, I would simply drop him a few lines describing the problem. – Chris Feb 6 '14 at 9:00
  • You can embed a pdf in html using PDF.js – WYSIWYG Aug 14 '14 at 8:20

While I haven't tried it myself, it seems you can configure a lot in tex4ht, specifically you can use


or even


to change the appearance of the result.

From http://tug.org/applications/tex4ht/mn-commands.html#prvCfgFiles

Example The command ‘htlatex myfile "mycfg,2"’ requests the compilation of a file named myfile.tex, in the presence of a configuration file named mycfg.cfg. The configuration file might have the following content.

  \Css{body { color : red; 
   max-width: 70em;

You could also try pdftohtml

  • I edited your answer to highlight the beginning of the config file. – michal.h21 Feb 3 '14 at 14:35

Lu Wang and I wrote an article Online publishing via pdf2htmlEX on TUGboat, which answers your question exactly. Please check the Figure 3. HTML / PDF

  • 1
    Figure 3 merely represents the workflow in a broad sense. The question asks about how to maintain a consistent line length. Moreover, it would be advisable to make the post stand alone from the link(s) you provide (to avoid possible future link-rot). – Werner May 25 '15 at 16:41
  • Thank you very much! I have long since submitted the document using HTML version, but I'm really impressed with the quality of your solution. I'll definitely take a look at the paper for general interest and because I will probably have to do this again one day with a more complex document. – Eleutharios Jun 13 '15 at 7:09

Your Answer

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

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