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.

[I know, this question has popped up several times, but let me clarify my situation.] I have to edit certain books and the authors send me their documents as .doc, .odt or .rtf files. I want to convert those files to LaTeX, but the only structure and format I want to keep is:

  • italic
  • footnotes
  • ordered and unordered lists

So, what I usually do, is to convert those documents to .rtf using Libreoffice (because I get rid of many formats I don't want to keep this way), and then with the famous LibreOffice extension I convert it to LaTeX. This works well, but sometimes the result is not clean, for example many times there are colour tags or some other formats within the LaTeX document.

Does anybody know a better way to achieve that goal? How to convert those documents, keeping only footnotes, italic, and lists?

share|improve this question
3  
Are you sure that's all you want to keep? (Tables?) If it's this simple, perhaps pandoc is an option (I've never used it, unfortunately). –  Sean Allred Jun 11 '13 at 19:53
    
It's philosophy, so in most cases there are no tables. I there would be one, I could convert in manually. But You are right, I forgot about ordered and unordered lists. I will have a look at pandoc –  user5950 Jun 11 '13 at 20:22
2  
I've had very good success with rtf2latex2e which has various options for the amount of stuff in the RTF it will bother to convert. You can set it to produce a very minimally marked up document. –  Alan Munn Jun 11 '13 at 21:39
    
Have you tried the -ultraclean switch of w2l? –  krlmlr Jun 11 '13 at 23:09
    
Thank you, I will try that tools. –  user5950 Jun 12 '13 at 9:31

2 Answers 2

I know what a typical document looks like in the field of philosophy and thus I understand that the formatting is usually not very complex, but works of philosophy are, ideally speaking, structured and semantically-rich documents. It might be worth it to consider e.g. whether the italics are meant to convey emphasis or distinguish a book title and mark them up accordingly. Also, keeping the outline and hierarchy of the headings intact might be beneficial. Which brings me to Writer2LaTeX.

I personally do not see any advantage in using RTF in this day and age and my work revolves around OpenDocument. When I have to integrate different documents and produce a clean typeset version with LaTeX (which happens more and more often), I usually rely on a combination of Pandoc and Writer2LaTeX. Here are some observations on the latter:

  • In order to preserve all the different kinds of styles and structural elements, one has no choice but to choose a “print” profile; for what I do, the “clean” and “ultraclean” profiles are inadequate. One reason is that I often have multi-column text sections in my ODT documents (I mean actual sections (div’s or environments if you like), not section-level headings) and these sections are not preserved in Writer2LaTeX’s output when a “clean” profile is selected. Then again, even with the “print” profile what gets produced is a multicols environment and not a custom environment with its own name, which is not as semantic as I’d like.

  • The results of the conversion are usually better when all manual formatting is removed and replaced with styles, even for character styles, which is why I suggest replacing italics with styles like e.g. “Emphasis” and “Work-title”. That way, every style has its own definition in the generated LaTeX preamble.

  • Even when trying to be as disciplined as possible, there is always cruft to remove. Writer2LaTeX respects the way that LibreOffice writes its ODF files, which means that many automatic styles are produced, even when a named style was applied. It is as though LibreOffice “instantiates” the applied styles and replaces them with automatically numbered ones (P1, P2 etc. for paragraphs, T1, T2 etc. for text spans). I find this very irritating, especially because this behavior is only present in recent versions of LibreOffice and is not present in OpenOffice 3.4.1.

  • In most cases, you will want to modify the command and environment definitions in the generated preamble, because they are not at all optimal (obviously, the use of an automated tool cannot replace actual knowledge of LaTeX).

Discipline and patience are required, but it is definitely possible to produce beautiful documents with OpenDocument, LibreOffice, Writer2LaTeX and some careful manual editing of the resulting LaTeX source.

Update: I forgot to mention that the Writer2LaTeX extension does not work for me in LibreOffice 4.0 on OS X. I suspect some API changes in 4.0 made the current Writer2LaTeX 1.2 beta incompatible. My solution is to use the “standalone” version of Writer2LaTeX, available from the project’s website. This standalone version is operated from the command line, but I actually find it simpler to configure that way.

share|improve this answer

You may want to try the latex function in Abi word, I know it is not as clean as you might like, but it may give you some ideas.

share|improve this answer
    
Welcome to TeX-SX! You can have a look on our our starter page to familiarize yourself further with our format. –  Claudio Fiandrino Jun 14 '13 at 6:23

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.