3

As an ester egg I would like to change the formatting of only one page number and leave all other as they are.

I am using the article document class with page number on the bottom of the page in the middle, so nothing fancy:)

  • 1
    Welcome to TeX.SX! Your question is quite unspecific. Which packages are you using? You're not using something fancy, but perhaps fancyhdr might be useful. – user31729 Mar 3 '16 at 16:05
3

Here's a fancyhdr approach with a \ifnum conditional. The specific page number can be set with \myfancypagenumber.

\documentclass{article}

\usepackage{fancyhdr}

\usepackage{blindtext}

\usepackage[x11names]{xcolor}

\def\myfancypagenumber{3}

\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[C]{\ifnum\value{page} = \myfancypagenumber\huge\bfseries \textcolor{blue}{\thepage}\else\thepage\fi}
}
\begin{document}
\pagestyle{plain}
\blindtext[20]

\end{document}

enter image description here

Update Another approach with \getpagerefnumber which acts only a specific page label, i.e. just place a page label and this will be used for the relevant conditional with \getpagerefnumber. (\pageref does not work here, since it's not expandable and so \ifnum... fails to compile)

\documentclass{article}

\usepackage{fancyhdr}

\usepackage{blindtext}
\usepackage{refcount}

\usepackage[x11names]{xcolor}

\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[C]{\ifnum\numexpr\value{page} = \getpagerefnumber{mypagelabel}\huge\bfseries \textcolor{blue}{\thepage}\else\thepage\fi}
}
\begin{document}
\pagestyle{plain}
\blindtext[12]

\hfill\textbf{Here some text}\hfill
\label{mypagelabel}

\blindtext[6]

\end{document}
  • You don't need to hard code the page number into the document with def\myfancypagenumber...unless that is what you really want to do, (for example make page 42 look 'special', independent of the contents of that page). You can define a new page style, then apply it to the relevant page using \thispagestyle{...} – alephzero Mar 3 '16 at 18:39
  • @alephzero: Do you have seen my update at all? ;-) – user31729 Mar 3 '16 at 18:51
1

I did it using fancyhdr as suggested by Christian.

\usepackage{fancyhdr}
\cfoot{\ifnum\value{page}=22
 \textbf{\thepage} 
 \else 
 \thepage 
 \fi}

To remove the header fanncyhdr adds.

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead{}
  • It's better so provide full compilable examples instead of fragments – user31729 Mar 3 '16 at 16:16

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.