Four classes, one kernel, and what each option changes
article, report, book and letter are unpacked from one source file in the LaTeX base distribution, so they share the sectioning machinery and differ in a handful of settings. \chapter exists only in book and report; \part only in those two as well; \frontmatter, \mainmatter and \backmatter exist only in book. Choosing report instead of book is therefore not a styling decision but a statement about whether chapters are numbered by a switch and whether the class is expected to be printed double-sided.
Defaults tell the same story. book sets twoside and openright and starts with \pagestyle{headings}; report defaults to oneside with \pagestyle{plain}, and it does not number chapters unless you ask. article has no chapter at all and puts page numbers in the footer. If you find yourself re-implementing one class in another, you have picked the wrong one.
The options that matter at submission time: 10pt, 11pt, 12pt (the base classes only — beyond that use KOMA's fontsize=12.5pt), a4paper or letterpaper, oneside/twoside, openright/openany, titlepage/notitlepage, fleqn and leqno for equation placement, and draft/final. Every one of them changes a switch inside the class, and the class reads them once at \documentclass time — so \PassOptionsToClass from a wrapper file is sometimes the only way to reach them.
The two families worth knowing as alternatives: KOMA-Script (scrbook) exposes all of this as documented options and adds \addchap/\addsec for unnumbered-but-registered divisions, and memoir folds the chapter styles, headers, captions and tocbibind behaviour into one class with commands like \chapterstyle{header}. A university template that is secretly book plus forty lines of \makeatletter patching is usually reimplementing memoir.
\textstyle \sum_{n=1}^{\infty} \frac{1}{n^{2}} = \frac{\pi^{2}}{6} \qquad \displaystyle \lim_{N\to\infty} \sum_{n=1}^{N} \frac{1}{n^{2}}
What frontmatter, mainmatter and backmatter actually switch
Here are the three definitions verbatim from the class, because the folklore about them is wrong in a specific way. \frontmatter is \cleardoublepage, then \@mainmatterfalse, then \pagenumbering{roman}. \mainmatter is \cleardoublepage, \@mainmattertrue, \pagenumbering{arabic}. \backmatter is a conditional clear-page and \@mainmatterfalse, and it changes the page numbering not at all.
So: two of the three restart the page counter, all three move a switch called \if@mainmatter, and none of them touches the page style. The widely-repeated claim that the front matter gets a plain style and the main matter gets headings is backwards — book installs headings once for the whole document, which is why your contents pages have running heads unless you suppress them with \thispagestyle{empty} or set \pagestyle{plain} yourself.
What \if@mainmatter does is narrower and easy to miss: in \@chapter it gates \refstepcounter{chapter}, the \typeout message, and whether the contents entry gets a \numberline. That is why a \chapter in the back matter still appears in the contents — unnumbered — and still sets its mark. It is the right behaviour for an index or a bibliography, and the wrong one for an appendix chapter you want numbered, which is what \appendix is for.
The other consequence of restarting numbering is invisible until it bites: two pages are both number 1, one in roman and one in arabic. Page-reference machinery keys off the printed number, so a thesis with several \pagenumbering switches can produce links that land on the wrong page; hypertexnames=false is the blunt fix, and \frontmatter after \maketitle rather than before is the tidy one.
Parts and chapters, and the page each one opens on
\chapter begins with \if@openright\cleardoublepage\else\clearpage\fi, then \thispagestyle{plain}, then \global\@topnum\z@. The third of those is the one people spend an afternoon on: the class forbids floats at the top of a chapter-opening page, so a figure placed immediately after \chapter drifts to the next page. The fix is \afterpage{\clearpage}, an explicit [ht] float, or accepting the behaviour, which is what a printed book does.
The title block itself is \@makechapterhead: \vspace*{50\p@}, then a \huge\bfseries line with \@chapapp\space\thechapter, then \vskip 20\p@, then the title in \Huge\bfseries, then \vskip 40\p@, with \interlinepenalty\@M so a long title never breaks. All of it inside a group with \raggedright and \parindent\z@, followed by \@afterheading, which is why the first paragraph after a chapter title is not indented.
\part is the level above: it gets a page of its own with \thispagestyle{empty}, and in twoside plus openright the class closes it with \@endpart, which adds a blank verso page. That blank page is not a bug and it is not wasted paper in the printed count — it is the recto/verso discipline. If you want parts to start anywhere, the class option is openany, and it applies to chapters too.
\appendix is a switch, not a division: it sets \@chapapp to \appendixname and changes \thechapter to \Alph{chapter}, so subsequent \chapter commands produce Appendix A, B, C with their own numbering. Note where it belongs: in the main matter (or after \backmatter, where chapters stop being numbered — in which case the appendices silently lose their letters).
\int_{\Omega} \nabla u \cdot \nabla v\,\mathrm{d}x = \int_{\partial\Omega} v\,\frac{\partial u}{\partial n}\,\mathrm{d}s
Include, includeonly, and the page break that comes with them
\include{ch2} is not \input with a nicer name. It clears the page, and if openright is in effect it clears to a recto; it writes \@input{ch2.aux} into the main .aux; it reads the file; and it clears the page again afterwards. The two clear-pages are why a chapter never lets one of its floats wander into the next chapter, and why \include is also slower than you would like: every chapter forces all pending floats to be flushed.
The consequence is the layout convention: one file per chapter, \input for anything smaller. Nested \include is refused by the kernel, so a chapter file that itself \includes a section file is an error, while \input nests freely and adds no page breaks of its own.
Because each \included file has its own .aux, \includeonly{ch2,ch5} is a partial build that does not lie about the document: the skipped chapters are still read far enough to keep their stored labels, counters and contents lines from the previous build, so the chapter numbers and every \ref stay as in the full document. It is the difference between working on chapter 5 and working on a different document — which is what subfiles and standalone actually give you, at the price of numbering that no longer matches.
Two ways this goes wrong. A file that was once \included and later renamed leaves a stale \@input line in the main .aux, and LaTeX then asks you to confirm the missing file at each pass — delete the .aux files or let latexmk -C do it. And the \bibliography or \printbibliography call belongs after the last \include, in the back matter, not inside a chapter file that a partial build may skip.
Twoside geometry: inner and outer margins, the gutter, the running head
The base classes do not use the word margin; they set \oddsidemargin and \evensidemargin, and TeX adds one inch of unlisted offset from the paper edge. In book at 10pt the values are .5in and 1.5in; at 11pt and 12pt, .25in and 1.25in — the difference of exactly one inch being the gutter, which is why a book's inner margin is wider. \textwidth is 4.5in at 10pt and 5in above it, with \textheight measured in baselines rather than inches.
Those numbers are also why wide equations are the standard complaint about the book class: a bmatrix of five columns that fits an article at 6in does not fit a 5in text block, and the fix is to split the display, reduce the font of the equation alone, or widen the text block deliberately — not to let the Overfull \hbox stick into the gutter, where it will be trimmed away by the bindery.
With geometry you stop thinking in those registers: inner and outer map to the odd and even side margins in a twoside document, bindingoffset adds the physical allowance separately, and hcentering or marginpar do the rest. Load geometry after the class so its settings win, and pass twoside to it as well, since geometry has its own opinion about the parity of margins.
headheight is the other classic: the base classes set 12pt, which is smaller than the box a real running head needs, so fancyhdr prints headheight is too small at every page until you set it — and the honest fix is \setlength{\headheight}{14pt} plus a compensating reduction of \topmargin, not \raggedbottom or ignoring the warning. Marginal notes in a twoside book go to the outer edge by default because \@mparswitch is on; \reversemarginpar flips that.
R_{\mathrm{ext}} = \frac{1}{4\pi\varepsilon_{0}} \sum_{k=1}^{n} \frac{q_k}{\lvert \mathbf{r} - \mathbf{r}_k \lvert} \ne \mathrm{finite\ size}
Contents, lists and where the header text comes from
The contents file is written as the document is typeset: every sectioning command calls \addcontentsline{toc}{chapter}{…}, and the floats call \addcontentsline{lof}{figure}{…}. Two counters decide what reaches the printed list — tocdepth, which for book you will set to 1 (chapters) or 2 (sections), and secnumdepth, which decides what gets a number at all. They are independent: a division can be numbered but not listed, or listed but unnumbered, which is exactly what \chapter* combined with a manual \addcontentsline produces.
That pair is the standard answer to "an unnumbered chapter that shows up in the contents": \chapter*{Notes on notation}\addcontentsline{toc}{chapter}{Notes on notation}. KOMA shortens it to \addchap{…}. For an entry that must carry no page number or no dot leader, the \protect\numberline{} in the stored line is what you are fighting, and titletoc or tocloft restyle the whole list without kernel surgery.
Extra lists are the same mechanism with a different extension. Declare \@starttoc{sym} inside a \chapter*{List of Symbols}, write entries with \addcontentsline{sym}{symbol}{…}, and you have a list of symbols, of schemes or of abbreviations that survives \include exactly as the contents does — per-chapter .aux collecting, main .aux pulling them together. Wrap both ends in \makeatletter, because the helpers have @ in their names.
Running heads are a separate pipe. The headings page style reads \leftmark and \rightmark, which are \markboth/\markright values, which the sectioning commands set through \chaptermark and \sectionmark. So the header text is not the title, it is whatever those two macros were defined to produce — which is why a redefinition of \chaptermark is the fix for an all-caps header, and why headers are wrong on the first pages of chapters: TeX sets marks asynchronously, one page behind.
% 放在 preamble。改的是 book.cls 已经定义好的东西,所以要有 \makeatletter。
\makeatletter
% --- 1. chapter name and number format: no layout touched
\renewcommand{\chaptername}{Part chapter}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\@chapapp}{\chaptername} % the word printed above the title
% --- 2. a quieter chapter opening than the kernel default
\def\@makechapterhead#1{%
{\parindent\z@\raggedright\normalfont
\vspace*{24\p@}%
\Large\bfseries\@chapapp\space\thechapter\par\nobreak
\vskip 6\p@
\huge\bfseries #1\par\nobreak
\vskip 30\p@
\rule{3cm}{0.4pt}\par}%
}
% unnumbered chapters (\chapter*) go through \@schapter, style it too:
\def\@schapter#1{\if@twocolumn\@topnewpage[\@makeschapterhead{#1}]%
\else\@makeschapterhead{#1}\@afterheading\fi}
% --- 3. stop \chapter from forcing a right-hand start (or keep it)
\PassOptionsToClass{openany}{book}
% --- 4. running heads come from marks set by the sectioning commands
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\makeatother
% --- 5. headers need the room; 12pt default headheight triggers a warning
\setlength{\headheight}{14pt}
\addtolength{\topmargin}{-2pt}
Titles and the rest of the front-matter machinery
\maketitle in book with the default titlepage option builds a page from \@title, \@author, \@date, sets \thispagestyle{empty} and ends with \cleardoublepage. \and separates authors, \thanks{} produces the dagger footnote, and \dedication{} gives you a dedication page. The values are available after the fact as \thetitle and \theauthor, which is the clean way to reuse the title on a half-title or in a running head instead of typing it twice.
For anything the class does not provide — a series page, an imprint page with the ISBN and edition line, a blank verso with a printer's statement — do not fight \maketitle: use the titlepage environment yourself, one per page, each with \thispagestyle{empty}. That is what the second listing on this page does, and it keeps the roman numbering of the preliminaries intact because \frontmatter has already run.
One structural question resolves most of the ordering arguments: which page must be a recto? A chapter must, a part must, and a title page should. Everything after that — whether the copyright statement sits on the verso of the half title or after the title page — is house style, but it changes your page count, because each \cleardoublepage can insert a blank. Get it wrong and a reviewer sees a chapter starting on a left-hand page; get it right and nobody notices.
Finally, the parts of a book that live outside the class: hyperref options for the PDF outline, \hypersetup{pdftitle=…, pdfauthor=…} fed from the same \thetitle, an .ind index built by imakeidx or makeidx with \printindex in the back matter, and the bibliography. Each of those has a page of its own on this site; what belongs to the book class is the decision of which matter it falls in, and therefore what its page number and its contents entry will look like.
\documentclass[11pt,a4paper,twoside]{book}
\usepackage{tikz}
\usepackage{hyperref}
\makeatletter
% ---- a hand-built title page: book's \maketitle is a titlepage environment
\renewcommand{\maketitle}{%
\begin{titlepage}%
\thispagestyle{empty}%
\null\vfil\begingroup
\raggedright\Huge\bfseries\@title\par\vskip2em
{\Large\@author\par}
\vfill
{\large\@date\par}
\endgroup\vfil\end{titlepage}%
}
% ---- a custom list: register the extension, then write to it
\newcommand{\listofsymbols}{%
\chapter*{List of Symbols}%
\@starttoc{sym}%
}
\newcommand{\sym}[2]{%
\addcontentsline{sym}{symbol}{\textbf{#1}\hfill #2}%
}
\makeatother
\begin{document}
\frontmatter
% half title: a recto with one line on it, deliberately unnumbered-looking
\begin{titlepage}\thispagestyle{empty}\vspace*{2cm}
\begin{center}\huge Series in Applied Analysis \# 12\end{center}
\end{titlepage}
% verso of the half title: the copyright / impression statement
\clearpage\thispagestyle{empty}
\small
Boundary Value Problems. First edition, 2026.\\
Printed on acid-free paper. All rights reserved.
\cleardoublepage
\maketitle
\dedication{For my advisers.}
\tableofcontents
\listofsymbols
\mainmatter
\chapter{Existence}\label{ch:ex}
Let $\sym{L^{2}(\Omega)}{square-integrable functions on $\Omega$}$ and
$\sym{\nabla u}{the weak gradient}$ be as usual. The symbol list above was
written by \texttt{\string\sym}, not by hand.
\addcontentsline{toc}{chapter}{Notes on notation}
\chapter*{Notes on notation}
An unnumbered chapter that still appears in the contents: the pair of lines
above is the whole trick.
\end{document}
Lesson cheat sheet
One key line of code from each section — jump to it or copy it straight from here.
\textstyle \sum_{n=1}^{\infty} \frac{1}{n^{2}} = \frac{\pi^{2}}{6} \qquad \displaystyle \lim_{N\to\infty} \sum_{n=1}^{N} \frac{1}{n^{2}}
\int_{\Omega} \nabla u \cdot \nabla v\,\mathrm{d}x = \int_{\partial\Omega} v\,\frac{\partial u}{\partial n}\,\mathrm{d}s
R_{\mathrm{ext}} = \frac{1}{4\pi\varepsilon_{0}} \sum_{k=1}^{n} \frac{q_k}{\lvert \mathbf{r} - \mathbf{r}_k \lvert} \ne \mathrm{finite\ size}
\makeatletter
\documentclass[11pt,a4paper,twoside]{book}
Common mistakes
- Expecting
\frontmatterto change the page style. It changes numbering and\if@mainmatteronly;bookkeepsheadingsrunning through the contents pages until you set\pagestyle{plain}or suppress individual pages. - Putting
\appendixafter\backmatter: chapters are unnumbered in the back matter, so Appendix A quietly becomes an unnumbered heading with no letter. - Nesting
\includeinside an\included file — the kernel allows one level. Use\inputfor anything smaller than a chapter. - Renaming or deleting a chapter file and leaving its
\@input{…}line in the main.aux, which produces a missing-file prompt on every pass. Clear the aux files rather than guessing. - Ignoring the
headheight is too smallwarning; it silently shrinks the space allotted to running heads. Set\headheightand take the same amount off\topmargin. - Using
\chapter*{Title}and then wondering why it is not in the contents: the starred form never writes a contents line. Add\addcontentsline{toc}{chapter}{Title}, or use KOMA's\addchap. - Letting a figure float to the next chapter: it is the class, not you —
\chaptersets\@topnum\z@so no float appears above the chapter title. Move the float or break the page deliberately. - Setting
geometrymargins in\oddsidemarginterms and being surprised that the even pages look wrong in a twoside book: passinnerandouter, and give geometrytwosidetoo.
Questions about this lesson
What does \frontmatter actually do in the book class?
\cleardoublepage so the front matter starts on a right-hand page, \@mainmatterfalse so chapters stop being numbered, and \pagenumbering{roman} which restarts the page counter in lowercase roman. It does not change the page style, which is the usual source of surprise. \mainmatter is the mirror image with arabic numbering, and \backmatter only clears the page and turns chapter numbering off, leaving the arabic sequence running.Should I use the book or report class for a thesis?
\chapter and \part; \frontmatter, \mainmatter and \backmatter exist only in book, which is why report templates fake the front matter with \pagenumbering by hand.How do I stop every chapter starting on a right-hand page?
\documentclass[twoside,openany]{book}. The class then clears with \clearpage instead of \cleardoublepage, so no blank verso pages are inserted. Keep openright if your institution requires chapters to start recto, and use \includeonly while drafting instead of removing it, since openany changes every page break in the document.How do I make an unnumbered chapter appear in the table of contents?
\chapter*{Bibliography} followed by \addcontentsline{toc}{chapter}{Bibliography}. The starred form suppresses numbering but not the contents entry, so the two are independent. In KOMA-Script the same thing is \addchap{...}, and in memoir \chapter*{...} with \addcontentsline{toc}{chapter}{...}; if the entry loses its number formatting entirely, the problem is the \protect\numberline in the stored entry rather than your \chapter call.What are the real differences between book, report and memoir?
\chapterstyle{header} replaces twenty lines of @-command patching. KOMA-Script scrbook sits between them and is the milder migration.Why do my page numbers restart at 1 twice in one PDF?
\frontmatter numbers the preliminaries i, ii, iii and \mainmatter restarts at arabic 1. Printed books do this too. The complication it creates for a PDF is that two pages share a printed number, so anything keyed on that number, including some link and bookmark machinery, can pick the wrong page; hyperref's hypertexnames=false makes anchor names count occurrences instead of trusting the printed number.Live playground: edit the LaTeX, see it render
The preview updates as you type — break it on purpose to see how errors look.
Keep reading
Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.