5

I am trying to squelch the page numbers using the code from here. This works fine, if one uses ordinary page numbers. If the page numbers are modified with the pagenumbering command, it doesn't work anymore.

Here is the MWE:

\documentclass{scrbook}
\usepackage{accsupp}
% Defining the squelch command
\DeclareRobustCommand\squelch[1]{%
  \BeginAccSupp{method=plain,ActualText={}}#1\EndAccSupp{}}
% Trying to squelch the page numbers
\let\oldthepage\thepage
\def\thepage{\squelch{\oldthepage}}

\begin{document}
\pagenumbering{roman}
\chapter{First Chapter}
\newpage
\pagenumbering{arabic}
\chapter{Next Chapter}    
\end{document}
3
  • \pagenumbering redefines \thepage.
    – egreg
    Mar 31, 2012 at 17:58
  • okay, so implementing \let\oldthepage\thepage \def\thepage{\squelch{\oldthepage}} after each pagenumbering command seems to do the job.
    – maetra
    Mar 31, 2012 at 18:02
  • I've updated my original answer to work with \pagenumbering.
    – Chel
    Mar 31, 2012 at 18:04

1 Answer 1

5

The cleanest solution is to load scrpage2:

\documentclass{scrbook}
\usepackage{accsupp}

\usepackage{scrpage2}
\pagestyle{scrplain}

% Defining the squelch command
\DeclareRobustCommand\squelch[1]{%
  \BeginAccSupp{method=plain,ActualText={}}#1\EndAccSupp{}}

% Trying to squelch the page numbers
\ofoot[\normalfont\squelch{\thepage}]{\normalfont\squelch{\thepage}}

\begin{document}
\pagenumbering{roman}

\chapter{First Chapter}
\newpage
\pagenumbering{arabic}

\chapter{Next Chapter}
\end{document}

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.