Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Could someone explain the difference between classes and packages? We call prosper a class and amsmath a package. I couldn't find out the difference.

share|improve this question
add comment

2 Answers

up vote 24 down vote accepted

See section 2.3 of LaTeX2e for class and package writers, "Is it a class or a package?" It states the following "rule of thumb":

If [new] commands could be used with any document class, then make them a package; and if not, then make them a class.

The following quote is somewhat more enlightening:

[A] company might have a local ownlet class for printing letters with their own headed note-paper. Such a class would build on top of the existing letter class but it cannot be used with any other document class, so we have ownlet.cls rather than ownlet.sty.

The graphics package, in contrast, provides commands for including images into a LaTeX document. Since these commands can be used with any document class, we have graphics.sty rather than graphics.cls.

share|improve this answer
5  
+1 Nice quotes, lockstep. @user3984: As you can see it doesn't make sense to have prosper or the similar beamer as package, because you have either an article, book, etc. or a presentation, but never both at the same time (as one document). However, all of these different documents can include math and therefore amsmath is a package. –  Martin Scharrer Jun 29 '11 at 14:36
add comment

First of all: there can be only one class but multiple packages for a document.

A class sets the overall document format like the available sectioning structure (e.g. \chapter is provided by book and report but not by article) and also defines some basic font related macros.

A package is, in general, just some packaged LaTeX code with an interface. It can add and modify the style of the document but also can just add more functionality. For example tikz is a package which allows you to draw diagrams, but does not modify the document style at all (why should it?).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.