What are the advantages/disadvantages of defining a class over a package and environment?
I have recently started to clean up some of the cruft in the preamble of my letters. The simplest solution might be creating a package with all my "standard" settings resulting in:
\documentclass{letter}
\usepackage{myletter}
\begin{document}%
\begin{letter}{To Name\\To Address}
\opening{Dear}
A letter based on the letter class and a package.
\closing{Sincerely,}
\encl{Some enclosure}
\end{letter}%
\end{document}%
But I could also making a custom letter class, which is built on the letter class, giving me:
\documentclass{myletter}
\begin{document}%
\begin{letter}{To Name\\To Address}
\opening{Dear}
A letter based on a custom class.
\closing{Sincerely,}
\encl{Some enclosure}
\end{letter}%
\end{document}%
Finally, it seems I could make a a package that copies a lot of the letter class and defines an environment named letter which would allow something like:
\documentclass{anyclass}
\usepackage{myletter}
\begin{document}%
\begin{letter}{To Name\\To Address}
\opening{Dear}
A letter based on a package that works in any class.
\closing{Sincerely,}
\encl{Some enclosure}
\end{letter}%
\end{document}%
where the package myletter could be used in any, or almost any, document class.
I don't understand what the differences are between packages and classes and when each should be used. To me it seems the first two solutions are basically identical and the code for myletter.sty would be very similar to the code for myletter.cls. In the final case, I think the code for the pacakge would need most of the code from letter.cls. The advantage of this approach would be I could include a letter in any document class. Are there other differences that I am missing?