# User-Defined Document Templates

When writing homework sheets, I make use of a template whose preamble incorporates all of the LaTeX goodies that I typically require: packages, page parameters, user-defined commands and environments, etc.. To write a new homework sheet, I simply copy and paste the contents of this template into a new document and begin writing. This saves me time and helps ensure consistency across all of my many homework sheets. Unfortunately, this preamble information has grown quite extensive so that I have to scroll down a good deal to even see where my document begins. Moreover, much of the preamble content will not apply to a given homework sheet, and I don't want to have to weed it out on a case-by-case basis.

My question is: can this template be implemented more like a true template that can be invoked (like a document class) but whose preamble is otherwise "hidden" from view? Indeed, is this a simple example of a user-defined document class?

• Any style .sty file is 'hidden' from the user in direct view as it is stored in the tex tree or in a local user-defined directory, so the answer is yes – user31729 Dec 18 '14 at 22:11
• just move the entire preamble into mystuff.sty then your documents can be \docuemntclass{article}\usepackage{mystuff}\begin{docuemnt}... – David Carlisle Dec 18 '14 at 22:12
• @David Carlisle That worked perfectly. I wish I'd known about this a long time ago. My own .sty file...I feel elevated. If you care to post your response as an answer, I'd be happy to make it official. Thank you so much. – steven_nevets Dec 18 '14 at 22:59

You can just move the entire preamble into mystuff.sty then your documents can be of the form

\docuemntclass{article}
\usepackage{mystuff}
\begin{docuemnt}
...


That is the basic form of a package, later you can look into defining options and have

 \usepackage[something]{mystuff}


if you need that, but you can add that later, or you may not need it at all.