No page number for divider pages in LaTeX
I have a report in LaTeX, and i have开发者_运维知识库 used the following commands to create my Appendix, however, my lecturer states that any divider pages should be unnumbered.
\documentclass{report}
\usepackage{appendix}
\begin{document}
\include{chap1}
\include{appendix}
\end{document}
Then in appendix.tex
\appendix
\pagestyle{empty}
\appendixpage
\noappendicestocpagenum
\addappheadtotoc
This creates the Appendices
divider page, but still puts a page number on it in the footer. There is no page number in the TOC, as expected.
How can I remove it from the footer?
I looked at the appendix.sty source, and I see the problem: line 74, in the definition of \@chap@pppage
, issues a \thispagestyle{plain}
command, thus overriding your \pagestyle{empty}
for this page. The inelegant but direct way to fix this is to redefine the command without this line - issue the following code after importing the package.
Revised, tested version
\documentclass{report} \usepackage{appendix} %==== The action ================ \makeatletter \def\@chap@pppage{% \clear@ppage \if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi \null\vfil \markboth{}{}% { \centering \interlinepenalty \@M \normalfont \Huge \bfseries \appendixpagename\par}% \if@dotoc@pp\addappheadtotoc\fi \vfil\newpage \if@twoside \if@openright \null \thispagestyle{empty}\newpage\fi \fi \if@tempswa \twocolumn\fi } \makeatother %==== Back to the document ======== \begin{document} \tableofcontents \chapter{Blah} Rhubarb, rhubarb, rhubarb. \appendix \pagestyle{empty} \appendixpage \noappendicestocpagenum \addappheadtotoc \chapter{Boff} Cabbages, cabbages, cabbages. \end{document}
The TeX FAQ might come in handy here:
I asked for “empty”, but the page is numbered
If you use \pagestyle{empty} and you find some pages are numbered anyway, you are probably encountering one of the style decisions built into the standard LaTeX classes: that certain special pages should always appear with \pagestyle{plain}, with a page number at the centre of the page foot. The special pages in question are those (in article class) containing a \maketitle, or (in book and report classes) \chapter or \part commands.
The simple solution is to reissue the page style after the command, with effect for a single page, as, for example (in article):
\maketitle \thispagestyle{empty}
So give adding \thispagestyle{empty}
after your \appendix
a try.
try changing \pagestyle{empty}
to \thispagestyle{empty}
and put it after \addappheadtotoc
.
Try instead:
\pagenumbering{gobble}
\begin{appendices} \newpage
\clearpage
\pagenumbering{arabic}
\addtocounter{page}{100}
\tableofcontents
\newpage
*Special thanks to https://tex.stackexchange.com/questions/6639/removing-page-numbers-but-not-headers!
精彩评论