19

I wrote my thesis in LaTeX and now my advisor would like to go in and manually make changes. I had assumed he would mark up a pdf or printed document, and then hand those changes to me to make, but he insists on actually making the changes himself. However, he does not know how to use LaTeX and does not want to deal with editing a plain text file with all the LaTeX markup everywhere.

What is the best way to convert my LaTeX document into something he can edit (preferably something he can open in Microsoft Word) so that it will still be in a format that I can easily convert it back into a LaTeX document?

Martin Scharrer
  • 262,582
Spike
  • 315
  • 2
    @Spike would this help http://tex.stackexchange.com/questions/8836/producing-doc-docx-from-latex? – yannisl Apr 21 '11 at 21:52
  • 7
    You're going to loose lot of information in the conversion to a Word-like format and then even more in the conversion back to TeX. Marking up the PDF or editing the plain text is seriously the route of least pain for everyone involved. – Sharpie Apr 21 '11 at 21:52
  • 1
    "I started to write it in LaTeX, but then had to convert it to Word so that my supervisor could edit it." I heard that way to often! – Martin Scharrer Apr 21 '11 at 21:57
  • There is no way you convert it into something Word-editable and then back again. All what you can hope for is something which looks similar in Word and then you have to replicate all changes by yourself in your LaTeX code! The simplest way would be PDF annotations using some PDF editor. – Martin Scharrer Apr 21 '11 at 22:00
  • 5
    Would giving a LaTeX book to your advisor help ? – raphink Apr 21 '11 at 22:04
  • 3
    @Martin: And I usually ask "whose thesis is it?" – egreg Apr 21 '11 at 22:21
  • @egreg: Good point! I was thinking the same. – Martin Scharrer Apr 21 '11 at 22:25
  • 5
    Would LyX be an option? I've never used it, but it would be a WYSIWYG alternative so that he wouldn't be editing the plain text... – TJ Ellis Apr 21 '11 at 22:29
  • 2
    Speaking from the advisor's side, I certainly wouldn't advise suggesting the advisor read a LaTeX book. However, I agree that it is your thesis, and a compromise involving some sort of PDF annotation would probably be the best route. Alternatively, perhaps sitting down with your advisor and showing him that editing the source isn't so hard (depending on the kinds of changes he wants to make) might also be an idea (although I can understand the resistance to that too.) What's the ratio of text to math in the document? – Alan Munn Apr 21 '11 at 23:22
  • @Sharpie, I couldn't agree with you more, and that was my thought going into this. – Spike Apr 22 '11 at 08:45
  • @TJ, great suggestion! – Spike Apr 22 '11 at 08:46
  • @Alan, the ratio of text to math is very high. Plus, I am confident my advisor won't even look at my equations since I'm in an interdisciplinary program and my advisor is not big on math. – Spike Apr 22 '11 at 08:47
  • @Martin: the only solution to allow annotations in a PDF is to use Adobe's official suite though, right? – raphink Apr 22 '11 at 20:53
  • @Raphink: No, I think there are free/cheaper PDF editors which can do annotations as well. – Martin Scharrer Apr 22 '11 at 20:55
  • @Martin: Do annotations, sure, but you need the PDF to be annotations-enabled for that, and it seems only Adobe LifeCycle Reader Extensions can do that. If that isn't the case, do you know the name of a program that can enable it? – raphink Apr 22 '11 at 20:59
  • @Raphink: There are normal pdfLaTeX packages which do annotations. Technically simple hyperlinks are already annotations. But I never marked annotations myself. – Martin Scharrer Apr 22 '11 at 21:59
  • @Raphink: I can confirm what Martin said about pdfLaTeX creating PDFs that have annotations enabled. Using the regular "Preview" app on OSX, you can easily create annotations. – Spike Apr 23 '11 at 16:21
  • @Spike: Ah, interesting. Is there an option in PDFLatex to activate that? The PDFs I generate don't have annotations activated it seems. – raphink Apr 23 '11 at 16:25
  • Note: With okular, I can create annocations in a PDF, but they're not embedded, they're only local and cannot be exported in the PDF, so it's not very useful for reviewing a document. – raphink Apr 23 '11 at 16:38

7 Answers7

16

Pandoc can convert between quite a few formats. Extract from the manual:

Pandoc converts files from one markup format to another. It can read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it can write plain text, markdown, reStructuredText, HTML, LaTeX, ConTeXt, Texinfo, groff man, MediaWiki markup, RTF, OpenDocument XML, ODT, DocBook XML, and S5 HTML slide shows.

It can convert to ODT, which is close enough to DOC, but you'll loose quite a bit by doing so.

To make it easy enough without loosing your soul, I'd convert it to markdown, which is both easy and efficient.

Keep in mind that if you're using tricky things in LaTeX (specific packages, your own macros or environments), you won't get any good conversion results.

raphink
  • 31,894
  • This looked promising, and I installed it to try it out. For some reason, the conversion didn't like my .tex document and I ended up with a bunch of random characters in the files that made them impossible to read... – Spike Apr 22 '11 at 08:48
  • Actually, the ODT format worked ok, but the other ones such as RTF did not. I then used an online ODT to Docx converter and sent that docx to my advisor. I'm planning on just taking the changes he makes and copy/pasting them into my LaTeX document. Thanks for your help! – Spike Apr 22 '11 at 09:03
  • 1
    pandoc understands a basic subset of LaTeX. Even footnotes might not work great. Like I and others said, you're very likely to loose formatting information (if not more) by converting LaTeX to anything else than PDF with annotations. – raphink Apr 22 '11 at 09:04
  • 1
    @Spike: The important thing here is the word "subset". Pandoc is not a TeX-to-anything converter. – Andrew Stacey Apr 22 '11 at 19:20
  • @Andrew: indeed. In fact, whatever pandoc can produce, it will understand, but you shouldn't expect it to know about any additional packages, and even less so about personal macros. It doesn't interpret TeX, it just translates it as is. When working from markdown or rst down to LaTex in order to produce PDF, you can easily get back to markdown since the LaTeX was produced by pandoc itself. – raphink Apr 22 '11 at 20:50
10

You can edit Latex sources directly in Word, which is by far the most unproblematic route if you want to convert back to Latex again. A possible issue with doing this is that the Word user has to know what not to touch. By passing the text through a highlighter, you can make this easier to do, by ensuring that Latex markup looks different to regular text; additionally chapter and section headings can be set in a larger size, emphasis is shown in italics, &c. Here is a workflow I use when doing this:

  1. Convert the Latex into highlighted HTML, using Pygments. The following short shell script, which I call quote-latex2html, achieves this:

      #!/bin/bash
      #quote-latex shell script: use Pygmentize to turn a Latex file into an
      #HTML file whose text content is the original file.
      pysty=colorful
      die () { echo "$@"; exit 1; }
      test -f "$1" || die "$1 isn't a regular file"
      cat <<EOF
      <HTML>
      <HEAD>
      <TITLE>$1 (style=$pysty)</TITLE>
      <STYLE type="text/css">
      EOF
      pygmentize -f html -S $pysty
      cat <<EOF
      </STYLE>
      </HEAD>
      <BODY>
      EOF
      pygmentize -f html -O style=$pysty "$1"
      echo "</BODY></HTML>"
    
  2. Import the HTML document into Word, and then save it as a Word format. Word 2007 or later handles the conversion best, but most Word users still seem to prefer Word 2003: check with your supervisor.

  3. Switch on change tracking, send off manuscript, and wait for responses.
  4. Work through changes.
  5. Export as plain text. The result is hopefully a working Latex document; if not, consider looking over the changes at stage 4 to find out what change went wrong.

Of course, you need access to Word for stages 2-5, and some familiarity with Word for stage 4. But you supervisor can work with the output of stage 1 in any case.

Charles Stewart
  • 21,014
  • 5
  • 65
  • 121
  • Woah cool. Thanks for the suggestion. I already went with another one, but I appreciate this idea. Hopefully it'll be useful for someone else. – Spike Apr 23 '11 at 16:27
5

I used the Latex2rtf to deal with this. You cannot expect to get a 100% correct conversion. However, from my experience, it should be sufficient enough for your advisor to use MS-Word to review your thesis. Just let him or her realize that he or she only need care about the content but not formatting. You can proudly claim that Latex will take care of formatting.

Leo5188
  • 151
  • I had a bunch of custom stuff in my Latex file, and some not so common includes, and I think these things made Latex2rtf not want to work for me. It just gave me some errors so I gave up on this solution quickly. – Spike Apr 22 '11 at 08:50
  • 1
    You may think about separating your content writing and final formatting in this case. Just use Latex article style to write one and convert to RTF->Word and work with your adviser on content. Then, after content is finalized, switch to your custom style and add fancy eye candy. – Leo5188 Apr 22 '11 at 19:30
  • Yeah, I ended up converting to Word using Pandoc so my advisor could edit the content and then will be copying the revised content back into my LaTeX doc. – Spike Apr 23 '11 at 16:25
3

I would second LyX. Very little code to be seen although nothing is formatted before you compile (but you can track changes as well).

Dominik
  • 352
  • LyX is pretty awesome and is exactly what I need. Thanks for pointing that out! It easily converts a LaTeX file to the LyX format, gives a gui editor for editing LyX, and can then export a file right back into LaTeX. The problem with this solution was that after I converted it from a LyX file back to LaTeX file, LyX renamed all of my refs throughout the file, breaking all the custom stuff I wrote... Thus it wouldn't compile again. It'd be a pain for my current situation. In the future, I'll definitely be using this, especially for smaller files with little to no customization. – Spike Apr 22 '11 at 08:54
3

I'll add a suggestion I've yet to see here: use tex4ht. It can convert to OpenOffice (see here for instructions) which can then be further converted to word, and as it works by hooking in to TeX's output then it is much closer to the original than the other converters around.

(And I'd also recommend taking the changes and manually importing them back in to the thesis, so I'm not considering the question of conversion back again.)

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751
  • Very cool. If I didn't already use Pandoc for this I would have definitely tried this first. – Spike Apr 23 '11 at 16:30
1

I would convert to a format your advisor will accept. Let him make changes. Then put his changes in the latex file yourself.

BWW
  • 1,213
0

What a strange behaviour from your advisor! Did his/her own advisor do the same ?

I would advise the following: converting the TeX file to plain text or rtf (and make sure with your advisor he does not want to make typesetting and page layout changes), then use a diff utility (there are many freeware on all platforms) to outline and check all the edits made when the modified file is back and enter them yourself in your thesis according to your own judgment.

If he wants to suggest page layout changes, warn that this cannot be done on plain text and discuss those changes on typical pages printout with pencil then implement what you believe is sound or mandatory for the submission of your thesis.

ogerard
  • 1,031