3.3 Class and package creation

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 be Memo from the SMC Math Department is for a class.

Inside of a class or package definition 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 allows you to create commands that users will not accidentally redefine.

It is also highly desirable to prefix class- or package-specific commands with your package name or similar string, to prevent your definitions from clashing with those from other packages. For instance, the class smcmemo might have commands \smc@tolist, \smc@fromlist, etc.


Unofficial LaTeX2e reference manual