I'm trying to clean up a documentclass for documents produced in a course I'm teaching. It's evolved over about 15 years of various novices "just adding a little something" until it's a complete mess. I'd like to restructure, but it'd be nice to do it in a way that's at least somewhat latex-like.
I'd like to know what should go in a .cls file, what should go in a .sty file, and what (if anything) should go in a .tex file.
The documentclass, which lives in a latex
directory where all latex-stuff is put, separate from the actual course content, is derived from "article"; it does a nice \ProvidesClass{courseclass}
and \LoadClass[11pt]{article}
, and then
"requires" various packages. Some of these are not part of our department's standard latex implementation, so they too are in that latex directory. I'm pretty sure that up to this point, things are OK.
There are several more things to be done:
Customize stuff. We use the
listings
package, and defining languages (like Ocaml) for which we want to typeset code has to happen via\lstdeginelanguage
.Define new environments like the "qa" environment for lecture notes, which we use to present questions and answers from lecture.
Do somewhat fancier stuff, like defining a bunch of macros like
\hw
and\lec
that get used in individual homework or lecture documents in the form\hw{02}{Syntax}
or\lec{07}{Recursion}
. These do things like declare that this document is Homework 2 or Lecture 7, and set the title of the homework or lecture, and look up the presentation date for the lecture or the due-date for the homework; these dates are all specified in one place (within the latex directory), and the lookup uses the first argument of the\hw
orlec
macro.
My question is whether any of this should be in .tex
files, or should it all be in the main .cls
file? And if it should all be in the main file, is there a way to "properly" break it up using include
or import
or something so that we can have a single file that does date-related stuff (which changes year to year) and a different one that does document-appearance stuff, like "styles for program listings", which is pretty constant?
Any recommendations? Any recommendations on someplace I could go read this without learning everything about all of Tex/Latex? :)
\author
or\title
, see thelatex.ltx
andarticle.cls
code, for example!