Friday, June 17, 2011

Why create customized commands and environments in LaTex?

LaTex is meant to be used to separate form (essentially, formatting) from content. It contains plenty of commands for formatting -- otherwise you couldn't format your content at all. The quickest path to formatted content is to combine your formatting and content. Basically, to format as you go along. So I often see people just use the formatting commands provided throughout their paper. (My sample is purely academic users, who are using LaTex almost exclusively to produce papers for academic publication.) It doesn't take too much thinking to figure out that this goes against the entire basis for using LaTex. Not only that, it's inefficient, especially for academic papers.

Papers typically need to be an extremely certain length, and meet other very specific formatting criteria. As a result, the last step to producing almost any paper is to make sure those criteria are met. One common result is that some time is wasted going through the paper adding and removing \small{}s and other size-related commands.

Also, many papers have multiple coauthors. This can result in formatting inconsistencies. You may choose to italicize natural language input, while your coauthor puts it in a verbatim environment.

The key to using LaTex efficiently and consistently is to create commands that describe the type of content, and apply the formatting. This allows you to format consistently by changing it in one place. It also effectively separates form and content. For example, in my papers, I use a lot of dialogues, essentially scripts describing what the human said to the robot and vice versa. This is how I format them generically:


and this is how I formatted them in the case of a specific paper with specific formatting requirements:


No comments:

Post a Comment