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?

10
  • Maybe it is possible to use \thispagestyle{empty}, but also to let the heading (my name) appear again?
    – ZPlaya7
    Commented Jun 10, 2020 at 18:15
  • 4
    the fancyhdr package makes it very easy to declare any number of page styles doing whatever you want Commented Jun 10, 2020 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
    Commented Jun 10, 2020 at 18:29
  • That's my problem :D How to define such a pagestyle where header appears, but footer disappears?
    – ZPlaya7
    Commented Jun 10, 2020 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. Commented Jun 10, 2020 at 20:59

1 Answer 1

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}
2
  • Great! Could you please explain the part between \fancyhead[C]... and \begin{document}? And could I replace \def by \newcommand?
    – ZPlaya7
    Commented Jun 13, 2020 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. Commented Jun 13, 2020 at 14:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .