Sign up ×
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

3 Answers 3

up vote 34 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
+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

I found this FAQ (What are LaTeX classes and packages?) might help understanding this question.

Here I just quote the whole text as follow:

What are LaTeX classes and packages?

LaTeX aims to be a general-purpose document processor. Such an aim could be achieved by a selection of instructions which would enable users to use TeX primitives, but such a procedure is considered too inflexible (and probably too daunting for ordinary users). Thus the designers of LaTeX created a model which offered an abstraction of the design of documents. Obviously, not all documents can look the same (even with the defocussed eye of abstraction), so the model uses classes of document. Base LaTeX offers five classes of document: book, report, article and letter. For each class, LaTeX provides a class file; the user arranges to use it via a \documentclass command at the top of the document. So a document starting

may be called “an article document”.

This is a good scheme, but it has a glaring flaw: the actual typographical designs provided by the LaTeX class files aren’t widely liked. The way around this is to refine the class. To refine a class, a programmer may write a new class file that loads an existing class, and then does its own thing with the document design.

If the user finds such a refined class, all is well, but if not, the common way is to load a package (or several).

The LaTeX distribution, itself, provides rather few package files, but there are lots of them, by a wide variety of authors, to be found on the archives. Several packages are designed just to adjust the design of a document — using such packages achieves what the programmer might have achieved by refining the class.

Other packages provide new facilities: for example, the graphics package (actually provided as part of any LaTeX distribution) allows the user to load externally-provided graphics into a document, and the hyperref package enables the user to construct hyper-references within a document.

On disc, class and package files only appear different by virtue of their name “extension” — class files are called *.cls while package files are called *.sty. Thus we find that the LaTeX standard article class is represented on disc by a file called article.cls, while the hyperref package is represented on disc by a file called hyperref.sty.

The class vs. package distinction was not clear in LaTeX 2.09 — everything was called a style (“document style” or “document style option”). It doesn’t really matter that the nomenclature has changed: the important requirement is to understand what other people are talking about.

This answer last edited: 2013-10-21

This question on the Web:

share|improve this answer

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
Thanks for the nice answer, @MartinScharrer. Just a small clarificatory question. Why doesn't one see the tikz.sty in the TDS folder ( for pgf) then? Rather all I see are .tex files...are .sty files thing of the past and these days we have new file formats for packages? – Abhimanyu Arora Jun 11 '14 at 20:32
@AbhimanyuArora: PGF/Tikz is written as general packages for LaTeX, Plain-TeX and Context and therefore doesn't use the normal LaTeX way for packages. AFAIK there are only LaTeX package stubs which load the general packages. – Martin Scharrer Jun 14 '14 at 19:16

Your Answer


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.