Class and package construction (LaTeX2e unofficial reference manual (November 2018))

Previous: Additional packages, Up: Document classes [Contents][Index]

### 3.3 Class and package construction

You can create new document classes and new packages. For instance, if your memos must satisfy some local requirements, such as a standard header for each page, then you could create a new class `smcmemo.cls` and begin your documents with `\documentclass{smcmemo}`.

What separates a package from a document class is that the commands in a package are useful across classes while those in a document class are specific to that class. Thus, a command to set page headers is for a package while a command to make the page headers say `Memo from the SMC Math Department` is for a class.

Inside of a class or package file you can use the at-sign `@` as a character in command names without having to surround the code containing that command with `\makeatletter` and `\makeatother`. See \makeatletter & \makeatother. This allow you to create commands that users will not accidentally redefine. Another technique is to preface class- or package-specific commands with some string to prevent your class or package from interfering with others. For instance, the class `smcmemo` might have commands `\smc@tolist`, `\smc@fromlist`, etc.

Unofficial LaTeX2e reference manual