This is a follow-up to Converting MS Word .doc to LaTeX by command line.

Do any of those utilities, or any others, have a mechanism to preserve the font when converting from .doc to tex? I'm dealing with a document in which source code is indicated by Courier font, and all of the approaches I've attempted (e.g., textutils -> html -> pandoc) preserve some of the formatting but ignore the font. I've found no clear way to pull out source code by other means (e.g., regexp).

  • If you are willing to use xetex or luatex as the engines, any system font should be available to you for the converted project. I've only done .doc to .tex conversions once or twice (many years ago), but I found then that post-processing was sorely needed! Won't this be the case for your documents as well? In that case, I'd add 'setting the font' to the list of things that will need some extra attention.
    – jon
    Commented Aug 14, 2012 at 15:10
  • That's true, post-processing is needed. I've gone the route of writing my own python script to parse the textutils-created html file into my style of tex. Line breaks are the current headache...
    – keflavich
    Commented Aug 14, 2012 at 15:16

1 Answer 1


Not sure how it will work, as a large majority of the fonts in Word will not be available in LaTeX. I would probably try to export the Word document, if per chance it was correctly formatted, to XML. Converting the XML to any other markup format should be a much easier task.

  • I've exported to html and rtf with no problem - both formats preserve font. I don't actually care about the font being preserved exactly, but SOME markup indicating a different font is essential.
    – keflavich
    Commented Aug 10, 2012 at 17:04
  • Wouldn't HTML use pre or code? Commented Aug 10, 2012 at 17:12
  • You'd think so, but no: it uses <span> with a css class definition and font: 12.0px 'Courier New';
    – keflavich
    Commented Aug 10, 2012 at 19:40
  • I knew Word HTML was messy, but not to this point.... In any case, there you go, you can easily parse the HTML to replace any span with these attributes by a code block. Commented Aug 12, 2012 at 14:53
  • 1
    Note that all fonts available to Word are easily accessible using either LuaLaTeX or XeLaTeX. Commented Aug 13, 2012 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .