Rohit's Realm

// rohitsrealm.com / archive / 2011 / 10 / 24 / introducing-lawtex

October 24, 2011

Introducing LawTeX

Well, dear readers, it has been a long while—almost two months to be precise—and if it were not to ring utterly hollow, I might even be willing to apologize for my absence. But, as with many things in this (necessarily futile) life of mine, I am over apologies. Having last left you with a discussion of video games, moreover, I see no reason why I shouldn't mark my return with a discussion of something far more esoteric: LaTeX, or more specifically, the software I developed in law school to facilitate the use of LaTeX in a world dominated by (loathsome) WYSIWIG products. (That, by the way, would be the cue for most—if not all—of you to stop reading if you hadn't already.)

For those who are still with me after that (and I sincerely hope, for your sake, that you're not), allow me to turn back the clock a few years—four to be precise—when I was just entering law school. One of the first problems I confronted as a 1L was how I was going to take notes in class and on my reading assignments. Well aware of the horrors of the Socratic method, I wanted a note system that was searchable, portable, and pretty. Unfortunately, these criteria essentially ruled out almost all extant methods of note taking: handwritten notes did not meet any of the criteria, and after having switched to LaTeX (which for the thoroughly uninformed is a typesetting and document preparation system based on Donald Knuth's TeX) in my junior year of college, the thought of returning to the bad old days of Microsoft products was thoroughly revolting. What was a *nix-minded person to do?

Taking notes directly in LaTeX was, of course, not an option—the markup was far too complicated given the pace that lectures moved. And using strictly ASCII text for notes seemed untenable—text documents, though portable and searchable, are ugly and difficult to read. What I needed was a system to take notes rapidly in LaTeX. The Internet, however, provided no guidance and all I was left with, as is often the case in this necessarily futile life of mine, was an overwhelming sense of dejection and despair. And from that dejection and despair was born LawTeX, a set of tools and templates to facilitate the use of LaTeX in a law school environment.

As I set out in greater detail on the project page, note taking in LawTeX essentially consists of three steps: (1) notes are rapidly composed in a standard text editor (I like Emacs, though I wouldn't begrudge you if you were a vim person) using a limited markup language modeled on Wiki markdown; (2) these notes are compiled (more on this below) into LaTeX source code; and (3) the LaTeX source code is combined with templates and stylesheets and processed using standard LaTeX tools (such as pdflatex) to create beautifully typeset documents. Simply, yes? Well, at least in theory.

Those versed in compiler theory might have paused at Step 2 above. And with good reason: the term compile is ambiguous there. Did he mean compiling as in converting or transliterating the markdown text to LaTeX or did he mean compiling as in the Dragon Book? And, for the love of all that is holy, why would anyone ever mean the latter?

Actually, with LawTeX, I mean both. Having decided to take notes in an (evolving) subset of markdown in my first week of 1L, I had to quickly formulate a mechanism for converting these marked down notes into something useful. And by quickly, I mean a matter of days. Writing a full fledged compiler was not an option at the time, so I took the quick and dirty approach, using my first lovePerl. What came out of that effort was a fairly functional script that transliterated the marked down text into LaTeX.

As my law school career progressed, however, I came to find the transliteration approach to be problematic. Rapidly composing text made the likelihood of typos in the raw note text (and with the markdown) much more likely. And since the transliteration didn't attempt to check syntax or grammar of the raw text file, the errors would instead be passed into the LaTeX source, which would then have to be debugged when pdflatex choked.

Around the fall of my 2L year, therefore, I decided to start work on a compiler for LawTeX's markup language. This project (as much else in that time) quickly stagnated. After picking up some steam last fall, it again fell by the wayside as (Wall Street) work began to occupy more of my time.

And that's where things remained until last week when I got an e-mail from a current law student inquiring about the status of this project. Realizing that I should at least make available the bits that were functional (and the real compiler is definitely not), I finally posted: the transliteration Perl script, lawtextr; a template for incorporating the converted source code; and a couple stylesheets. All are available under a BSD-style license, which makes them free—as in beer.

Chances are, very few will find use of this stuff. But if you do and especially if you find any bugs, do drop me a line. And maybe some day when I finish that damn compiler, I'll have more to add to page.

Comments

All the cool kids use markdown.

Add Comment


 


 


 


 


* required field

E-mail addresses will never be displayed. The following HTML tags are allowed:
a abbr acronym address big blockquote br cite del em li ol p pre q small strong sub sup ul