[texhax] class file vs style file

Brian Papa bpapa at ametsoc.org
Wed Jun 20 16:06:05 CEST 2007

Thank you very much for the feedback.  You are right, I am fairly new to 
Latex. I've developed a template using a style file, but I've seen 
numerous people asking about developing their own class file and a few 
articles on the subject, so I was wondering if developing a new class 
(or modifying the existing article.cls) might be a better way to go. 
It sounds like using a style file is the easier route, and so far I have 
not had any problems with this method.  Thanks again.


Niall Mansfield wrote the following on 6/20/2007 6:04 AM:
> Brian,
>    Brian Papa wrote:
>    > In developing a template for a journal article, I'm
>    > wondering if there is a significant advantage to creating an
>    > entirely new class file as opposed to using the existing
>    > article.cls and then making any necessary modifications
>    > though the .sty file? The general consensus seems to be to
>    > create a new class file
>  From our own experience, we'd disagree: writing your own class
> file is very hard.  We've found it's much easier to use a standard
> class file, and apply the changes we need via our own xxx.sty file.
> Here's why:
> 1. Changing only the bits that need to be changed is a lot less work.
> 2. It's usually people who are relatively inexperienced in
>     LaTeX who ask this question.  (That's not a put down,
>     just objective.)  But if you're a LaTeX newbie you won't
>     know what you have to include in a class file to get a
>     professional result.  You'll face a lot of trial and error.
> 3. The standard class files have had years of debugging and are
>     very robust.
> 4. Lots of very useful packages assume that certain actions
>     are performed by certain named functions ("hooks") and change the
>     behavior by re-defining these functions.  If you write your
>     own class file, you won't know which names you have to
>     preserve.
> 5. Most class files use TeX code in addition to LaTeX code.
>     (We have found that) TeX code is much harder to write and
>     understand, or at least requires much more effort up
>     front to become proficient with.
> Some facts and figures: our standard style file now uses the
> following 25 packages:
> 	babel
> 	caption			
> 	chngpage
> 	color
> 	colortbl
> 	courier
> 	crop
> 	endnotes
> 	fancyvrb
> 	framed
> 	framed
> 	geometry
> 	graphicx
> 	helvet
> 	ifthen
> 	latexsym
> 	layout
> 	makeidx
> 	mathpazo
> 	nextpage
> 	relsize
> 	sidecap	
> 	ulem
> 	url
> 	wrapfig
> Ignoring comments, our additional style file contains 300
> lines.  The old class file that it replaces had 850 lines,
> ignoring comments.  But these figures don't tell the full story:
> * The new style file has more functionality and is more
>    sophisticated.
> * The old class file was very difficult to maintain, not
>    least because it uses lots of TeX code.
> * The new style file is much simpler: most of it uses
>    standard LaTeX, and a lot of that is very simple stuff
>    such as:
> 	\newenvironment{...}
> 	\newcommand{...}
>    to impose a consistent style, but which we could live
>    without by typing a lot more in the documents being
>    typeset, plus a few lines to set options for the various
>    packages used.
> * The new style file lets us use all the standard packages,
>    which the old class file didn't.
> Whichever route you go, we've found the following invaluable:
> * CTAN online catalog: http://www.ctan.org/tex-archive/help/Catalogue/alpha.html
> * "The LaTeX Companion" book, published by Addison-Wesley.
> We've have got nowhere without them.
> 	Niall Mansfield
> 	UIT Cambridge Ltd.
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org

Brian Papa
Technical Editor
American Meteorological Society
45 Beacon Street
Boston, MA 02108-3693 USA
phone: 617.227.2426 ext 279
fax: 617.973.0468
e-mail: bpapa at ametsoc.org

More information about the texhax mailing list