Using LaTeX to describe logical structure

When you are typesetting in LaTeX (how do I pronnounce that?) you should put the focus of your attention on describing the logical structure of the document as clearly as possible, and leaving LaTeX itself to do the visual formatting, the choice of fonts and the positioning of characters on the page.

Remember that the most important thing about your document is its content, so leaving LaTeX to deal with the fiddly stuff like visual formatting lets you concentrate on the most important thing of all. However, for longer or more complex documents, or documents that are being developed and will be the subject of many changes and revisions over the course of months or years this approach becomes more and more important.

For example, it may be that a key definition you introduce in chapter 3 as "definition 3.1" is needed in chapter 2 of a later version of your document. You move it to chapter 2 and need to change all the labels of all your definitions. If you were careful to start with, LaTeX can do all this for you automatically. Or perhaps you chose a notation for a certain mathematical function, and at a later time decided that that notation is not appropriate. Depending on how you set up your LaTeX source, you might be able to do this by changing a single line of code only.

Here are a few golden rules about describing logical structure in LaTeX:

(Some of these activities are somewhat "advanced", and I will help Birmingham Maths students with these if you would like me to.)

LaTeX has environments describing the type of the current part of the document. (In fact, the whole document is itself and environment called document.) The real power of environments is that they can be nested. You can have a quotation environment in item 2 of a description environment, and so on.

In fact, the best LaTeX code is when these environments are nested in the most logical way possible. Not only is the source easier to read, but LaTeX itself is much more successful at formatting it in a pleasing way.

These features of LaTeX should be familiar to anyone who knows HTML or XML well. (In fact, XML is designed to describe document structure in a similar way, and—mainly because XML is designed to do essentially nothing else—XML is somewhat better at document description.)


Go to: Menu page.