25

Are there general rules for when to create a document class vs. creating a package to customize LaTeX? Does one have benefits over the other?

My specific need is to create a customized page layout, but I'm interested in the general response to this question as well.

I did quite a bit of poking around for an answer to this, but surprisingly couldn't find much information.

2

3 Answers 3

29

Maybe one could say a package is for extending possibilities, a class is for restricting possibilities.

If you want to add new features which can help users create specific effects in a lot of different document types, a package is for you.

If you want to set sensible defaults and create an optimal environment for efficiently creating documents of a specific type without having to do a lot of customisation, make a class.

There are a lot of fringe cases, of course ;-)

19

In most cases a package is to be preferred. A package allows other people to use your package in combination with different classes. For example the geometry package assists many users across many different classes to change the page geometry of a document.

In your case if all you interested is to change a page layout, you probably better off with a package.

However, a class can be considered if for example you are developing a layout to be used over and over in as for example, Department reports or theses. In this case you do not want your users to have to remember loading the package, but rather load a specific class.

6

Like Stephan writes

Maybe one could say a package is for extending possibilities, a class is for restricting possibilities.

But now you need to make a point : I you need a lot of extending possibilities and to add a restricting possibilities of the class perhaps you need to create a class.

I think if you need specific document like 'homework notebook' or Cookie Recipes . It's perhaps interesting to create a class. The class in this case is to use only for a specific format (layout) and you dont need all the tools like a classic class gives.

Now there is two cases. You can create a class based on another class (a lot of people do this) or you can create a new class from nothing. I do this to create exams and courses because I needed to modify a lot of things ( every things )

Final remark : If you create a class, this document must be very simple. The only purpose is to give a special layout. It's not necessary to do every thing with this document.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .