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.

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).

share|improve this question
    
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 Aug 14 '12 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 Aug 14 '12 at 15:16
add comment

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.

share|improve this answer
    
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 Aug 10 '12 at 17:04
    
Wouldn't HTML use pre or code? –  Timothée Poisot Aug 10 '12 at 17:12
    
You'd think so, but no: it uses <span> with a css class definition and font: 12.0px 'Courier New'; –  keflavich Aug 10 '12 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. –  Timothée Poisot Aug 12 '12 at 14:53
1  
Note that all fonts available to Word are easily accessible using either LuaLaTeX or XeLaTeX. –  Ian Thompson Aug 13 '12 at 14:32
add comment

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.