in Editing, Programs

Editing Documents in LaTeX

Do you ever have to edit a document written in LaTeX? There’s recently been some discussion on Copyediting-L about how to do this. I know of three methods.

Method 1: Work in raw LaTeX

LaTeX looks like this:

chapter[On the Origin and Design of Government]{On the Origin and Design of Government in General, with Concise
 Remarks on the English Constitution}
 Some writers have so confounded society with government, as to leave
 little or no distinction between them; whereas they are not only
 different, but have different origins. Society is produced by our
 wants, and government by our wickedness; the former promotes our
 happiness emph{positively} by uniting our affections, the latter
 emph{negatively} by restraining our vices. The one encourages
 intercourse, the other creates distinctions. The first is a patron, the
 last a punisher.

As you can see, formatting and document structure are implemented with codes. That's okay; just don't mess with the codes unless you know what you're doing. You can open a LaTeX document in any text editor and start editing. When you're finished, save the file and return it to the authors.

But what if your authors need to see your revisions? In that case, a text editor isn't going to work. But Microsoft Word has revision tracking . . .

Method 2: Edit in Microsoft Word

There are ways to turn a LaTeX file into a Word document, but that's probably not what your authors want. Nevertheless, you can still edit in Word, using revision tracking. Here's how:

  1. Open the LaTeX file (extension .tex) in Word.
  2. Save the file as a Word file (extension .doc or .docx).
  3. Turn on Track Changes.
  4. Edit the text, being careful not to change any of the LaTeX coding.
  5. Don't use any of Word's formatting features (paragraph styles, italic, bold, and so on), which will be lost when the document is changed back to a text file (which, later, it will be).
  6. Save the Word file and send it back to your authors, who should review the file in Word so they can accept or reject your changes.

After all of the changes have been either (1) accepted or (2) rejected (in other words, so that all tracked changes have been taken care of), the authors should do this:

  1. Save the file as a text file (extension .txt).
  2. Change the .txt extension to .tex.

At that point, they should be able to compile the LaTeX file as usual.

Method 3: Edit in LyX

LyX is a graphical user interface for LaTeX, with its own version of revision tracking. Here's the procedure:

  1. You (the editor) install LyX. Unless you're planning to use LyX for typesetting, you just need the simple installer rather than the bundled version.
  2. Import the authors' LaTeX file into LyX (File > Import > LaTeX).
  3. Do your editing in LyX, using its revision-tracking feature (Document > Change Tracking > Track Changes).
  4. Ask your authors to review your changes in LyX and accept or reject as needed.

At that point, your authors can (1) export the file as LaTeX (File > Export > LaTeX) or (2) process the file from within LyX. If you want to use this method, you should do some back-and-forth testing with your authors before starting work on an actual manuscript.

If you find that you like working in LyX (I do), you may sometimes need a way to convert a Word document into a LyX document, which is not an easy task—unless you use my new Microsoft Word add-in, LyXConverter. I do not, however, recommend trying to round-trip a document—that is, convert a Word document into LyX and then back into Word. Again, there are ways to do it (via OpenOffice.org Writer), but how reliable the final conversion might be is open to question.

How about you? Do you get manuscripts in formats other than Word? If so, how do you handle them? Please let me know!