# Change document class per page

Let's say I have a document that has many pages and some pages have different formats. For example, most of the pages are fine with \documentclass{article} but there may be pages in the middle that I want to be \documentclass{letter}. I want my letter pages to be numbered inline with the other pages and have them show up in the Table of Contents.

Is it possible to change the class used for an individual or range of pages while still keeping things like page numbering consistent across them?

EDIT I'm trying to create a "welcome to the company" sort of document that has a cover page, table of contents, welcome letter, then various sections of information. I've never tried this in anything other than a word processor where it's easy to set "master pages" or "template pages" for individual pages in the document. So I could use a letterhead template page for the welcome letter part and a standard article-type template for the rest and still have the letter numbered/referenced in the ToC.

So the idea was to take advantage of the classes written, if possible, rather than have to format a single page by hand differently from the rest.

-
You can't change the class in between. You can, however, change certain settings. If you specify why exactly you would want to change the class, we might find ways to change corresponding settings. –  mafp Jan 8 '13 at 0:37
Alternatively, if you don't mind the pages starting on a new page, you can insert the PDF versions of the letters into your document with pdfpages. These can have the same header and footer as your main document etc. –  Alan Munn Jan 8 '13 at 0:40
@mafp I updated to explain a little more the type of document I'm trying to create. –  tpg2114 Jan 8 '13 at 0:41
@AlanMunn How do I ensure that the page numbering would be consistent if I want the letters to be numbered in series with the rest? Would I have to build the main document telling it to skip a number, then see what that number is and hardwire it into the page I want to insert? –  tpg2114 Jan 8 '13 at 0:43
If this is acceptable I can post an example. –  Alan Munn Jan 8 '13 at 0:43

Using the pdfpages package it's easy to build documents from many different sources (and therefore created with different classes) The only limitation of this approach is that the inserted pages will start on a new page (i.e. it's not possible to insert a PDF starting at the middle of a page of the main document.)

The pdfpages package has a pagecommand key which allows you to add material such as headers and footers to the included pages. Here's a small example. First, let's create the included document. I've made this red and with big margins just to show it clearly. Compile this and you will end up with myletter.pdf.

myletter.tex

\documentclass{article}
\usepackage[margin=2.5in]{geometry}
\usepackage{xcolor}
\usepackage{kantlipsum}
\pagestyle{empty}
\begin{document}
\color{red}
\kant
\end{document}


Now let's make our main document. In this document, we use the fancyhdr package to set the pagestyle for the entire document. We then use pdfpages and the pagecommand={\pagestyle{fancy}} to add the footers to the included pages. TeX keeps track of the page numbering correctly.

main document

\documentclass{report}
\usepackage{kantlipsum}
\usepackage{pdfpages}
\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}
\lfoot{\emph{My footer}}
\rfoot{\thepage}
\begin{document}
\tableofcontents
\chapter{A chapter}
\section{Introduction}
\kant[1-4]
\includepdf[pages=1-,pagecommand={\thispagestyle{fancy}}]{myletter.pdf}
\section{Another section}
\kant[5-8]
\end{document}