A class file or package file typically has four parts.
\NeedsTeXFormat
and \ProvidesClass
or \ProvidesPackage
commands.
smcmemo
class might be called with an option to read in a file with a list of
people for the to-head, as \documentclass[mathto]{smcmemo}
, and
therefore needs to define a command
\newcommand{\setto}[1]{\def\@tolist{#1}}
used in that
file.
\documentclass[option list]{class
name}
, to modify the behavior of the class. An example is when you
declare \documentclass[11pt]{article}
to set the default
document font size.
Here is a starting class file, which should be saved as stub.cls where LaTeX can find it, for example in the same directory as the .tex file.
\NeedsTeXFormat{LaTeX2e} \ProvidesClass{stub}[2017/07/06 stub to start building classes from] \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax \LoadClass{article}
It identifies itself, handles the class options via the default of
passing them all to the article
class, and then loads the
article
class to provide the basis for this class’s code.
For more, see the official guide for class and package writers, the Class Guide, at https://ctan.org/pkg/clsguide (much of the description here derives from this document), or the tutorial at https://tug.org/TUGboat/tb26-3/tb84heff.pdf.
See Class and package commands, for some of the commands specifically intended for class and package writers.