1

my problem is that I want to empty the footer but not the header. \thispagestyle{empty} empties both of them. \thispagestyle{plain} empties only the header, but not the footer.

Is there a third command to empty the footer, but not the header?

I just want to skip a numbering of a page in my document. Something like: page 1, page 2, page 3, page, page 4, page 5. There ist a page between 3 and 4, but it is not counted. My idea was to empty the footer and use \setcounter{page}{4} at the next page.

Is there any solution?

  • Maybe it is possible to use \thispagestyle{empty}, but also to let the heading (my name) appear again? – ZPlaya7 Jun 10 at 18:15
  • 4
    the fancyhdr package makes it very easy to declare any number of page styles doing whatever you want – David Carlisle Jun 10 at 18:19
  • The problem is, that I can't use \thispagestyle{headings} or \thispagestyle{myheadings} because I used \fancyhead{} \fancyhead[C]{\small \scshape myname}. If I use the above commands, I get ,,Contents'' in the heading and not my name – ZPlaya7 Jun 10 at 18:29
  • That's my problem :D How to define such a pagestyle where header appears, but footer disappears? – ZPlaya7 Jun 10 at 18:34
  • 1
    I take it you are using a oneside document class, as adding an uncounted page would mess up odd/even tests. I believe hypreref uses a separate page counter, so that the PDF can find unnumbered or duplicate pages. – John Kormylo Jun 10 at 20:59
2

Here are two examples, one using fancyhdr and one without. There is also \fancypagestyle which is described in the fancyhdr manual.

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{lipsum}% MWE only

\fancyfoot{} 
\fancyhead[C]{\small \scshape myname}

\makeatletter
\def\ps@ugly{%
    \let\@oddfoot\@empty
    \def\@oddhead{\hfill\small \scshape myname\hfill}%
}
\makeatother
\pagestyle{plain}% default

\begin{document}
\lipsum[1-7]% first page no header
\thispagestyle{fancy}
\lipsum[9-14]% second page fancy
\thispagestyle{ugly}
\lipsum[15-21]% third page ugly, fourth page default
\end{document}
| improve this answer | |
  • Great! Could you please explain the part between \fancyhead[C]... and \begin{document}? And could I replace \def by \newcommand? – ZPlaya7 Jun 13 at 10:19
  • If you look in artcile.cls (base folder) you will find definitions for \ps@empty, \ps@plain, \ps@headings and \ps@myheadings. You could use \newcommand{ps@ungly}{...} since \ps@ungly was not previously defined, but you should use \renewcommand{\@oddhead}{...} since it IS defined already. I used \def since that is how article.cls did it, and because I don't really care whether they were previously defined or not. – John Kormylo Jun 13 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.