ClassStyle
From PCTeXWiki
Class & Style
An introduction to TeX document classes and styles
by The Editors
A reader wrote, An article that I would certainly read with enormous interest would have the title "Compleat Idiot's guide to using .class and .sty files". In other words a blow-by-blow description of how to use those types of files for someone very new to LaTeX.
In this short piece, we will introduce the notions of class and style in a LaTeX document. Consider this short document, probably written by a physicist:
\documentclass{article}
\begin{document}
A Pascal (Pa) is equal to a Newton per square meter, $N/(m^2)$.
\end{document}
Class. This document uses the article document layout, also called the article documentclass. A documentclass defines the general appearance of a document. It sets margins, the type size for section heads, the placement of page numbers, and other document design features.
Style. If you were a scientist and wanted a professional looking document you would want the scientific units, $N/(m^2)$, in the above article to format correctly. There are standards for this, and you could look them up and try to get LaTeX to format them. Fortunately, there is an easier way. Another LaTeX user developed a package or style called SIunits that you can use to format scientific units.
If you use a style package your LaTeX document will look like the following:
\documentclass{article}
\usepackage{SIunits} % Scientific units package
\begin{document}
A Pascal (\pascal) is equal to a Newton per square meter,
\newton\per\square\metre.
\end{document}
Notice that a new command, \usepackage{SIunits}, appears in the document preamble. Also notice that now you can use some new commands: \pascal, \newton, \per, etc. These were introduced by the style package SIunits. If this document is formatted, you will see that the scientific units are formatted correctly. (It's nice that someone else figured this out so that you don't have to!)
In the above example, we have shown how to format a LaTeX document using a documentclass, and how to add new LaTeX commands by the use of a style package.
Class & Style. To tie this in to the theme of this issue, Class & Style: the article documentclass is found in a file called article.cls and is sometimes called a Class (.cls) file; the package SIunits is found in a file called SIunits.sty and is sometimes called a Style (.sty) file.
Changing the Class
One way to change the appearance of a LaTeX document is through the \documentclass command options. To change the type size, for example, add an option to \documentclass:
\documentclass[12pt]{article}
This will change the text type size from 10 point (the default) to 12 point.
Another way to change the appearance of a document is to change to another documentclass. For example, change \documentclass{article} to
\documentclass{memoir}
Format the document and notice that the overall appearance is slightly different. Some alternate Classes are shown at TeX Catalogue. Note that the TeX Catalogue has an easy way to view documentation for Classes and Styles.
Finding Styles
In the above example we used a package SIunits to format scientific units. You can find this in the TeX Catalogue Topic Index under Science and then Typesetting Physical Units.
There are more than 2,000 LaTeX Style packages. The TeX Catalogue is a good starting point to locate the package you need. Another resource is CTAN. You can also try an online search engine. Try typing LaTeX physical units package into Google.com, for example, and it will find a few references to the SIunits package.
