Posted on August 22, 2008 at 8:14 pm

Scripting Beautiful Documents in Plain Text

A common complaint among lawyers and other users of word processor applications is that word processors get in the way of the user writing their text. Envision a legal professional drafting a brief. The professional will type the court caption, select the caption, and select “Center” from the “Alignment” palette. This workflow of writing, then formatting continues until the end of the document with the legal professional hoping that a change to the formatting of one section of the brief doesn’t mysteriously change another section. Auto-numbering of paragraphs, anyone? Other legal professionals type out their text, then hand it off to a colleague for formatting. Both workflows are cumbersome and both workflows duplicate work.

So what’s the solution? Before getting to that, let’s think about some requirements that we expect from a document production system. First, we want to focus on writing, not formatting. Second, we want the output to look great. No more mixing of fonts or strange leading. Third, we want to be able to incorporate our system into our overall workflow via scripting. We might also want the format to be portable, capable of versioning, and obsolescence-proof.

With these requirements, the choice for the format looks clear: plain text. Plain text allows you to focus on writing. Just open your text editor and start typing. But what about formatting? We can mark up our plain text to format our document. HTML is an example of marked up plain text. Plain text can also produce great looking output through a typesetting system called LaTeX. LaTeX files are marked up plain text files that, when typeset, look fantastic. Here’s an example of a document typeset in LaTeX: Answer Typeset in LaTeX. As you can see, LaTeX produces beautiful documents with consistent margins, consistent paragraph numbering, and output as PDF. I encourage you to download the PDF file above and zoom in to reveal the details.

Of course, plain text documents will easily incorporate into any scripted workflow. Indeed, your scripts will generally run faster with plain text documents because you will not incur the overhead of opening another application to format your text. In addition, you can take plain text documents to any computer and open them for editing. You can even install LaTeX on just about any operating system. Plain text documents are also capable of versioning, also known as “track changes” in Word. You can do simple versioning using the diff tool or more sophisticated versioning using software such as Subversion or Git. With Subversion and Git, you can upload your documents to a private server (”repository”) and allow others to view and edit the text. You then update your personal repository on your local computer and the changes appear. Don’t like the changes? Roll back to the last version. I have all of my LaTeX files in a Subversion repository. Note, too, that the offsite repository acts as a backup file system.

Finally, plain text is nearly obsolescence-proof. Unless a new way of computing appears soon and does away with plain text, then your documents are safe from becoming as useless as WordPerfect files on the Mac. (Yes, I know about WP3.5 and SheepShaver.)

So how can we incorporate these plain text documents into our workflows? I’ll show you in the next installment. Stay tuned!

One Response to “Scripting Beautiful Documents in Plain Text”

  1. Andrea Santilli on September 10th, 2008 at 3:58 says:

    Dear Larry,

    I am a Software Engineer running my own business as Licensor and I use LaTex all the time for my technical reports: it was quite easy to find LaTex templates to write this kind of things since LaTex is the standard tool in the technical scientific academic community while it seems to be much less popular among lawyers, finance, marketing, people.

    Anyway for reason that you seems to know pretty well I would like to write also my License Agreements and Invoices in LaTex but I could not find any specialized template: do you have anything ready ?

    Best Regards
    Andrea Santilli
    ASDSP Srl
    http://www.asdsp.com

Leave a Reply