Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
\pagenumbering redefines \thepage. –  egreg Mar 31 '12 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 '12 at 18:02
    
I've updated my original answer to work with \pagenumbering. –  rdhs Mar 31 '12 at 18:04

1 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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