LaTeX:Packages
LaTeX |
About - Getting Started - Diagrams - Symbols - Downloads - Basics - Math - Examples - Pictures - Layout - Commands - Packages - Help |
This article has information about a few common packages, as well as instructions on how to make your own package.
Contents
General Information
In the Commands pages, we discussed building your own commands. Fortunately, many, many people have built their own commands already and made them available to LaTeX users in packages. Packages allow us to use extra commands without having to include tons and tons of code in the preamble of a document. Instead, we just add the line
\usepackage{package name}
and we have access to all the commands, symbols, environments, etc., that are in the package.
Common Packages
This section will cover the packages released by the [American Mathematical Society], as well as xypic and fancyhdr.
AMS Math packages
The American Mathematical Society has produced several packages for use with LaTeX. These packages allow much of the mathematical formatting we have introduced on these pages, as well as much, much more. The packages are included with the installation of MiKTeX. In order to be able to use the commands and symbols in these packages, they must be included in each document in which you require them. To include the packages, include the following in the preamble of your document:
\usepackage{amsmath} \usepackage{amssymb} \usepackage{amsthm}
Most of the basic parts of these packages which will be useful to you are covered somewhere on these pages. If you'd like to read about more options these packages provide, read the documentation for them at the following links:
Note that including these packages can slow down the compilation of your document, so you may not want to include them unless you really need them.
xypic
The xypic package allows you to make tricky diagrams such as ones which include various items connected by arrows or lines. Take a look at the xypic home page to see what xypic can do. The package comes with MiKTeX. To use it, include the following in your preamble:
\usepackage{xy}
fancyhdr
The fancyhdr package provides an easy way to place text on the top and/or bottom of every page. The fancyhdr package does not come with MiKTeX, but assuming that you installed MiKTeX using our recommendations, it should prompt you to install it the first time you try to use it. You include it in your source file in the usual way:
\usepackage{fancyhdr}
The fancyhdr user's guide has detailed instructions on how to use the package. Here's an example that illustrates most of the basics you'll need:
\documentclass[11pt]{article} \usepackage{fancyhdr} \pdfpagewidth 8.5in \pdfpageheight 11in \pagestyle{fancy} \headheight 35pt \rhead{Right top} \chead{Middle top} \lhead{Left top} \rfoot{Right bottom} \cfoot{\thepage} \lfoot{Left bottom} \begin{document} First page \pagebreak Second page \pagebreak Third page \end{document}
\pagestyle{fancy} tells LaTeX that you'll be using the fancy style which allows you to use the header and footer commands.
The \headheight command makes space at the top of the page for the header. Try compiling without it and look through the errors to see what happens.
The \rhead, \chead, \lhead, \rfoot, \cfoot, and \lfoot commands create headers and footers in the obvious places (you'll see them in the output when you create the example).
The \pagebreak forces new pages so you can see how the headers and footers appear on every page.
If introducing headers and footers makes you want to resize the dimensions of the text portion of your page, consult the Layout article. Note that if you do resize the dimension of the text portion of your page, you should execute those commands before executing the header and footer commands.
Finding Other Packages
Many, many packages have been created for LaTeX. If there's something unusual that you want to do, there's a good chance that there's already a package out there that does it.
The TeX Catalogue Online has a very comprehensive list of all the LaTeX packages out there.