# Lawtex

LawTeX (pronounced Law-Tech) is a set of tools and templates that was designed to facilitate the use of the LaTeX typesetting and document preparation system in a law school environment. The system, however, should be of use to anyone looking to convert rapidly composed, text-based notes into beautifully typeset documents.

Use of this system requires a working knowledge of TeX, LaTeX, and the *nix environment. The remainder of this page assumes as much about the reader.

## Overview

For those of us who grew up in the computer age, taking notes by hand has reached the point of near obsolescence. It’s slower, it’s not searchable, it’s not portable, and often times, it’s not even legible. Equally offensive for us computer nerds,1 however, is the notion of taking notes in a WYSIWIG editor that writes to a proprietary format (think Microsoft® Word®). Though it might be faster than handwriting and allow for some limited searching, it’s often still not pretty and it’s definitely not portable.

If only it was possible to take notes rapidly in LaTeX; then the notes could be portable, searchable, and easily generated into a beautifully typeset document. But LaTeX is too complicated a syntax to take notes in, right?

That’s where LawTeX comes into the picture. The idea of this system is to take notes in plain-text with very limited markup (for instance, to indicate emphasis) and then compile that marked up text into TeX for processing by LaTeX.

The LawTeX workflow proceeds in three stages:

1. Notes are taken in plain-text using a standard editor (such as Emacs or Vim) and LawTeX’s very lightweight markup language (modeled on wiki markdown).
2. Those notes are compiled—converted, in other words—to TeX code.
3. The raw TeX from stage two is combined with a template and a stylesheet, and compiled using standard LaTeX tools (such as pdflatex) to generate a typeset document.

Voilà! Fast, searchable, portable, beautiful notes!

## Components

### Markup Language

To provide structure for notes, LawTeX provides a lightweight markup language. In fact, it only supports the following: (1) sections (up to three levels deep); (2) itemized lists (up to four levels deep); (3) enumerated lists (only one level); (4) emphasis; (5) section (§) and paragraph (¶) symbols; (6) math mode (for input of special characters and symbols); and (7) the ability to input raw TeX code (for complicated things such as tables). That’s it.

The point isn’t to replicate every last feature of TeX; it is to provide the most commonly used features that would be relevant in a notetaking context in a very simple, memorable syntax. This syntax is described below.

1. Sections. Indicated by an asterisk (*) at the start of the line; one asterisk for a \section heading, two asterisks for a \subsection heading, and three asterisks for a \subsubsection heading.
2. Itemized Lists. Indicated by a hyphen (-) at the start of the line. One hyphen (-) indicates top level, two hyphens (--) indicates second level, and so forth up to four levels of nesting.
3. Enumerated Lists. Indicated by a number and period at the start of the line (e.g., 1.)
4. Emphasis. Indicated by encapsulating the text to be emphasized in square brackets (e.g., [This would be emphasized]).
5. Section and Paragraph Symbols. Indicated by a \S and \P respectively.
6. Math Mode. Indicated by the text wrapped in dollar signs (e.g., $\rightarrow$).
7. Raw TeX Code. Indicated by a hash mark (#) at the start of the line.

An example should make things clear. Below is a sample of notes taken in LawTeX markup.

* Example of Notes

** Lists

Listing things in LawTeX is a snap!

*** Itemized Lists

This is an example of an itemized list.
- First level of itemized list.
-- Second level of itemized list.
--- Third level of itemized list.
---- Fourth level of itemized list.

*** Enumerated Lists

You can also use numbers for listing things. How do I love thee?
Let me count the ways:

1. I love thee to the depth and breadth and height.
2. I love thee freely.
3. I love thee purely.
4. I love thee with a passion put to use.

** Other Neat Features

You can also [emphasize] certain words, and refer to, say,
\S 90 of Rest 2d Contracts. And if you're feeling
especially reckless, you can even mention the the hanging \P;
that is, \S 1325(a)(*) of the Bankruptcy Code.

Finally, you can even insert raw TeX code!

# \begin{tabular}{|c|c|}
# \hline
# 1 & 0\\
# 0 & 1\\
# \hline
# \end{tabular}


### Compiler

At the outset of this section, it is important to clarify here what I mean by compiler. For those not versed in compiler theory, compiler is often taken to mean converter, but unhappily, things are not that simple (they never are). At least two types of software could do the work that above is described as compiling the LawTeX markup to TeX: either the software could merely transliterate the LawTeX markup; or it could actually lex and parse the markup and then generate TeX.

So what’s the difference? The second approach is decidedly more complicated, both to implement and to run, but provides the user with an assurance that everything is in order for running the output through a LaTeX document generator like pdflatex. The first approach is much simpler, but can lead to obscure errors in LaTeX itself if the notes were not syntactically correct as typed by the user (and that’s highly possible if the notes are being rapidly composed!).

Luckily, LawTeX does not constrain you on this front; it allows you to pick your poison. If you are looking for the quick and dirty approach, and are comfortably debugging LaTeX parser errors, you can opt for the transliteration; if, on the other hand, you prefer up front syntax checking, you can use a full-fledged compiler.

The transliterator comes in the form of a Perl script (available here). Usage is simple:

lawtex.pl notes.txt notes.tex

The output file (notes.tex in the above example) can then be combined with a template and used to generate a LaTeX document.

The compiler, on the other hand, is a C program and must be compiled from source. Once built, however, it too operates simply:

lawtex notes.txt notes.tex

Again, the output file can be combined with a template, but in this instance, the LaTeX parser will not barf since the TeX will be syntactically correct (assuming there are no bugs in the LawTeX compiler, of course).

### Templates

For those well-versed in LaTeX, I imagine a template will not be necessary. Simply build out your document as you would with any other work, and when it comes time to insert the notes, use the LaTeX command \input{notes}, where notes.tex is the file created using LawTeX (and where notes.tex resides in the same directory as your template).

If, however, you would like to see an example, I have made the template I used in law school for class notes available here. Please note that this template should be used in conjunction with the stylesheets below.

### Stylesheets

Style is a matter of personal preference, and I imagine those of you familiar with LaTeX will have a stylesheet that you prefer. For sake of example, however, I have made available the stylesheets I created during law school for notes, outlines, and papers.

### Build Scripts

(Coming sometime.)

## System Requirements

(Coming sometime.)