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 many of you will think this elementary - but I would like opinions. I need to know if I'm doing it horribly wrong before I continue doing 45+ chapters! I apologize if this isn't the proper place - but I'm really trying to learn!

I'm trying to convert a novel that has been typed in Word -- no equations -- just text with some light formatting, lots of dialogue etc.... So in my VERY limited knowledge of LaTeX I have done this. Can you please tell me if I'm on the right track?

My method:

  1. Open Chapter in Open Office
  2. Export using Writer2LaTeX extension
  3. Open the exported file in WinEdt
  4. Delete all preamble coding and just have \chapter{} for the preamble
  5. Delete \end{document} from the end of the document
  6. Replace {\textquoteright} with ' (it puts this on all conjunctions and just for neatness and readability I'd rather just see the ' than the code)
  7. Save

In my master document I insert the chapters using the \include command (at the suggestion of someone here)

So.... I know it seems like it's a very round about way of doing it... but is it okay? My reasoning for using Writer2LaTeX extension is because it seems to take care of the opening and closing quotations using {\textquotedblleft} and {\textquotedblright} and it also uses \textit for italics. Otherwise I think I'd have to go find all those and enter coding by hand correct?

My master file has the following code:

\documentclass[10pt]{memoir}


\usepackage{mathpazo}
\usepackage[margin=1in, paperwidth=6in, paperheight=9in]{geometry}
\usepackage{indentfirst}
\pagestyle{plain}

\emergencystretch=1.5em


\renewcommand*{\chapnamefont}{\normalfont\HUGE\bfseries\sffamily}
\renewcommand*{\chapnumfont}{\normalfont\HUGE\bfseries\sffamily}
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchaptertitle}[1]{}


\begin{document}

\include{Chapter1v2}

\include{chapter02}

\end{document}
share|improve this question
1  
sounds like a good plan (but avoid leaving \end{document} in the chapters:-). Converting from Word to LaTeX can be painful or relatively straightforward, depending on the document features used and the converter. If you are finding openoffice is making a reasonable first conversion of your text, stick with that. –  David Carlisle Nov 8 '12 at 20:01
3  
As Word/OpenOffice should (default settings) use the correct quotation marks (and what not) there's really no need to let those be replaced by TeX commands, if you use \usepackage[utf8]{inputenc}. –  Qrrbrbirlbel Nov 8 '12 at 20:21
3  
I am not familiar with conversion form Word, but one thing I would recommend is that you make use of the standalone package. The each chapter can be a complete document (which means you leave the end{document} in each chapter). This will allow you to be able to typeset each chapter separately for review, and yet also be able to import them into a master document. Numerous examples on this site of the standalone package. –  Peter Grill Nov 8 '12 at 20:25
1  
Which version of WinEdt do you use? Only Version 7 can display utf8-encoded input correctly. BTW, using UTF8 as the input encoding method won't do anything for you in terms of LaTeX recognizing Word's formatting-related directives. –  Mico Nov 8 '12 at 22:40
2  
BTW, writer2latex can be convinced not to create a preamble to every file with the option no_preamble... Check the manual and think about creating a template file if you're going to use it a lot... I'd also suggest working with pandoc, but you'd have to get the files saved as .html or DocBook before converting to .tex –  henrique Nov 9 '12 at 15:23
show 6 more comments

4 Answers

From Word to LaTeX via Writer2LaTeX

I will not repeat the manual of Writer2LaTeX, which you should read. But after some years I've got some practical experience:

  • It is usefull to delete as much of the layout in Word as possible.
  • The whole text should be in one language, make sure that Open/LibreOffice gets that as well. Otherwise you'll end with hundreds of \foreignlanguage-commands or similiar.
  • Experiment with the different possibilities of Writer2LaTeX. But I found the option "very tidy article" (my translation from German "sehr aufgeräumter Artikel") produces the best output.
  • Find the most complicated chapter, and really experiment with it until you are satisfied.
  • Clutterd, complicated code after \begin{document} indicates that something is going wrong.
  • Usually UTF8 is a good encoding. Depending on your editor on the LaTeX-side be carefull that the editor recognises UTF8 and that you really got that encoding.
  • If you have to change or delete a mass of, let's say, \\ \\ \\, this is a very good moment to learn a bit about "regular expressions". Doing deletions and changes manually, especially with 45 chapters, will probably take much longer than learning regexp.

Often it is faster to learn something about LaTeX by reading an introduction and the manual of a package (you get the manual by typing texdoc packagename on the command line), than wildly guessing how something could work.

share|improve this answer
add comment

... just text with some light formatting, lots of dialogue etc.

Many times, trying to save some time, we end up spending more. Personally, I had to convert lots of documents and the quickest in the end, was "cut-paste-edit." Even with documents as long as 300 pages it does not take more than a few hours.

On the way, you correcting the manual and you creating any macros that you might need. On the first pass, don't over worry about formatting, but rather getting the structure right, adding indexing and bibliography commands etc and correcting encoding mistakes. If you have a lot of those, it may pay you to open the text files first using an editor such as note++ and try and fix them automatically there.

share|improve this answer
    
This is good advice. Long ago I archived an email correspondence (of a thousand pages!) by copy-pasting from my reader into Word, and later into TeX. I only went for writing a perl script to do this when I got tired of manually implementing the various substitutions ($ to \$, and so on) necessary. Maybe an addendum to this answer is that you should start by hand, building as you go a list of generic changes to make. Once you're sure the list is pretty complete, write a script to do it all. (Unless you're already pretty much done.) –  Ryan Reich Apr 30 '13 at 20:33
    
Your advice is sound in the general case (though I would shift it a little towards script-assisted manual work). In the OP's case though, this is a much simpler document than many hardcore TeX users are used to, so I would be more hopeful of the tools that already exist. –  Chris H Oct 10 '13 at 7:18
    
@ChrisH I think it depends on the case and the skills, agreed that some scripting can be very useful. –  Yiannis Lazarides Oct 10 '13 at 9:19
add comment

Via pandoc

writer2latex is a great tool and I love it, but I'd recommend using pandoc because it can convert from many markup formats to even more of them.

From Libre/OpenOffice to HTML to LaTeX via pandoc

Although it can't handle OpenOffice ODT files as input (it does can export to ODT), pandoc does a great job with HTML inputs. Open- and LibreOffice have a built-in HTML exporter that you can use as an intermediary step.

The process is as simple as

  1. Export the ODT file in HTML format;

  2. Convert the HTML file to LaTeX

    You have two options from here:

    1. Create simple files to be \included in a master file, like in your example, via

       pandoc <input.html> -o <output.tex>
      
    2. Create a full, compilable LaTeX file. This requires you to use a LaTeX template file (called via the --template=</path/to/template-file> option) or to call the --standalone flag (which implies in loading the default template file that ships with pandoc). So:

       pandoc <input.html> --standalone -o <output.tex>
       pandoc <input.html> --template=</path/to/template-file> -o <output.tex>
      

      A template file is a regular LaTeX file with input variables (marked as $<var>$) that are replaced by the converted content of the input file (unlike writer2latex, but works with XML templates). If you want to take a look at the default latex template file used by pandoc, check it out on github.

From Libre/OpenOffice to DocBook to LaTeX via pandoc

The process is pretty much the same as above, except that instead of export your ODT to HTML, you'll save your file in DocBook XML.

From Libre/OpenOffice to HTML/DocBook to markdown to LaTeX via pandoc

It's just to convert your HTML to markdown before converting to LaTeX.

I like this setup because I feel markdown markup much more readable than anything else. When you need to change something (specially typos), it loads fast, is easily searchable, and reader-friendly. I'd recommend you to archive your chapter files in this format.

As a side note, I was convinced to switch to markdown (in the middle of the writing of a master's thesis) by this post in PhilTeX blog. [Link down, probably forever]

share|improve this answer
    
It used to be good PhiTeX blog(colloborative LaTeX writing by Philosophy guys ) unfortunately it's down (may due to spam). Thanks for adding links via wayback machine. –  texenthusiast May 1 '13 at 22:35
    
The link is down, once again, now due to a robots.txt file (which makes the previous versions saved in waybach machine inaccessible and which is so, so sad.) –  henrique Oct 9 '13 at 15:50
    
Can't pandoc handle .docx directly? Or is that only as output? If the OP is using one of the recent versions of Word like almost every else who has to put up with it then the chapters should already be in docx. (not me, the UI change has me stuck on an old version) –  Chris H Oct 9 '13 at 16:10
    
@ChrisH, pandoc can't handle docx as input, but it handles "markdown and (subsets of) Textile, reStructuredText, HTML, LaTeX, MediaWiki markup, Haddock markup, OPML, and DocBook". It can only handle docx as output. –  henrique Oct 9 '13 at 16:35
    
@henrique, thanks for making that clear - I had tried it the other way round without much luck and put it to one side. –  Chris H Oct 10 '13 at 7:14
add comment

To be honest when you have critical work to be done like what you are doing (novel writing) you should simply use a conversion service such as Gauss-Newton

Trust me, when you write a fairly large document (I have written a thesis with 250 pages!), converting from Word to LaTeX is PITA! Converting fairly large documents is no jokes! I find that it is easier to write in Word and then just get it converted when I need to.

I have answered something similar before on stackexchange - might be worth for you to have a look.

share|improve this answer
    
I find that it is easier to write in Word and then just get it converted when I need to, apart from easier you will find it much more expensive, isn't it? In my case I would do it myself and learn (which will make you richer in both ways, about money and about knowledge). –  Manuel Jan 11 '13 at 14:24
    
What's the problem with just using the right tool from the start if you haven't started yet? Just write your thesis in LaTeX, perhaps using a front-end like LyX. Worked fine for me, many times. –  Kuba Ober Oct 9 '13 at 16:09
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.