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'm in the process of converting some Word documents to latex. I decided to go the following route:

Word -> ODF (with odf export or via libreoffice) -> latex (writer2latex).

The documents generated by writer2latex do look quite good, unfortunately, writer2latex creates what seems like a million different styles for every individual text element. Is there a way that I can minimize the amount of styles created? I understand that using the option clean or ultraclean will remove any styling, however, then I end up having to go through the entire document again, and apply styling manually. Is there a clever way around this?

And also: is there a way to convince writer2latex to use \chapter and not \section as the top level category?

Any advice regarding these issues is greatly appreciated!!

EDIT: The entire project is ~ 250-300 pages, made of 10 independent word documents.

share|improve this question
    
How big and how many documents do you have? If the answer is "Small and not many." then I'd recommend a copy and paste job into a book class that you like. This is a bit of a naff solution though, so just a comment. ;) –  qubyte Dec 4 '11 at 9:44
    
250 pages in total. roughly 10 documents. that's why copy & paste isn't the most straightforward solution. –  memyself Dec 4 '11 at 9:46
    
Ouch, that would be a rubbish way to do it then! –  qubyte Dec 4 '11 at 9:47
    
What kinds of styles do your odt documents use? –  Erik Dec 4 '11 at 19:30
    
nothing fancy. I tried to clean up the document as much as possible in word, using the predefined styles (header 1, header 2, ...) –  memyself Dec 4 '11 at 20:36
add comment

1 Answer

To use \chapter instead of \section you could do a simple search&replace with sed or an editor that supports regular expressions. Here is the command you need for sed:

sed -e 's/^\\section{\([^}]*\)}$/\\chapter{\1}/' whatever.tex
sed -e 's/^\\subsection{\([^}]*\)}$/\\section{\1}/' whatever.tex
# etc.
share|improve this answer
    
that's not a solution, because it means that I then need to replace all sections with subsections, all subsections with subsubsections, etc. –  memyself Dec 4 '11 at 19:45
    
@memyself, what's wrong with doing that? You can apply the same principle to all heading levels -- until you reach the lowest one latex can handle, but you obviously cannot translate those properly anyway. Just make sure to replace the higher levels first. –  Erik Dec 4 '11 at 20:08
1  
A better regex would be sed -e 's/\\section\>/\\chapter/g; s/\\\(sub\)*subsection\>/\\\1section/g' which takes care of all levels (except paragraph) in one go. –  Aditya Dec 4 '11 at 23:35
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.