classicthesis uses scrlayer-scrpage so you don't need a hack with the page numbering style to change the font of the page number. You can just use \setkomafont:
\documentclass[%
twoside, openright, titlepage, numbers=noenddot,%
cleardoublepage=empty,%
]{scrreprt}
\PassOptionsToPackage{%
dottedtoc,%
eulerchapternumbers,
floatperchapter, pdfspacing,%
beramono,%
a5paper,%
}{classicthesis}
\usepackage{classicthesis}
\usepackage{kantlipsum}
\makeatletter
\setkomafont{pagenumber}{\ifnum \the\c@page=4 \bfseries\fi}
\makeatother
\begin{document}
% TOC
\pdfbookmark[1]{\contentsname}{tableofcontents}
\chapter{Chapter 1}
\kant[1-8]
\chapter{Chapter 2}
\kant[9-15]
\end{document}
BTW: scrlayer-scrpage and classicthesis use \pagemark for the page number. So as an alternative you could redefine \pagemark instead of \thepage to change the output of the page number. This would also allow absolutely weird output definitions:
\documentclass[%
twoside, openright, titlepage, numbers=noenddot,%
cleardoublepage=empty,%
]{scrreprt}
\PassOptionsToPackage{%
dottedtoc,%
eulerchapternumbers,
floatperchapter, pdfspacing,%
beramono,%
a5paper,%
}{classicthesis}
\usepackage{classicthesis}
\usepackage{graphics}
\usepackage{kantlipsum}
\makeatletter
\ExplSyntaxOn
\renewcommand*{\pagemark}{%
\fp_set:Nn \l_tmpa_fp { 360 / \c@page }
\rotatebox { \fp_to_int:N \l_tmpa_fp } { \usekomafont{pagenumber}{\thepage} }
}
\ExplSyntaxOff
\setkomafont{pagenumber}{\ifnum \the\c@page=3 $\pi$ \expandafter@gobble\fi}% NOTE: You must not use \addtokomafon{pagenumber} after this definition!
\makeatother
\begin{document}
% TOC
\pdfbookmark[1]{\contentsname}{tableofcontents}
\chapter{Chapter 1}
\kant[1-8]
\chapter{Chapter 2}
\kant[9-15]
\end{document}
So no need to define weird \thepage to get weird output.
For special cases for several page numbers, it could make sense to use \int_case:nn, e.g.
\setkomafont{pagenumber}
{
\int_case:nn { \c@page }
{
{ 3 } { $\pi$ \use_none:n }
{ 5 } { \ensuremath }
{ 7 } { \bfseries } % \textbf would be possible but a font switch instead of a font command should be preferred
}
}
Note that you have to move the \ExplSyntaxOff in the example before behind this command:
\documentclass[%
twoside, openright, titlepage, numbers=noenddot,%
cleardoublepage=empty,%
]{scrreprt}
\PassOptionsToPackage{%
dottedtoc,%
eulerchapternumbers,
floatperchapter, pdfspacing,%
beramono,%
a5paper,%
}{classicthesis}
\usepackage{classicthesis}
\usepackage{graphics}
\usepackage{kantlipsum}
\makeatletter
\ExplSyntaxOn
\renewcommand*{\pagemark}{%
\fp_set:Nn \l_tmpa_fp { 360 / \c@page }
\rotatebox { \fp_to_int:N \l_tmpa_fp } { \usekomafont{pagenumber}{\thepage} }
}
\setkomafont{pagenumber}
{
\int_case:nn { \c@page }
{
{ 3 } { $\pi$ \use_none:n }
{ 5 } { \ensuremath }
{ 7 } { \bfseries } % \textbf would be possible but a font switch instead of a font command should be preferred
}
}
\ExplSyntaxOff
\makeatother
\begin{document}
% TOC
\pdfbookmark[1]{\contentsname}{tableofcontents}
\chapter{Chapter 1}
\kant[1-8]
\chapter{Chapter 2}
\kant[9-15]
\end{document}
See The LaTeX3 Interfaces for more information about the l3 functions (and variables) used in the examples above.
Note that only the last font change for element pagenumber is allowed to be a command with argument. Because in this example \@gobble (or \use_none:n) is used to eat the page number, if the page number is 3, you should not use \addtokomafont{pagenumber}{…} after the \setkomafont{pagenumber}{…}.
IMHO redefining \thepage makes only sense, if every usage should be changed, i.e., if also the entries to ToC, LoT, LoF and page references using \pageref should use exactly this output. So it could make sense for output of pi, but IMHO it would not be useful to change the font.
\setkomafont{pagenumber}{\ifnum \the\c@page=3 $\thepage$ \fi}but then it prints the math-mode page number and the original page number. – kafman Nov 02 '23 at 12:14\pagemarkinstead of\pagenumberis exactly what I want (I don't want the change to appear in the TOC as well). Your solution with the\@gobbleworks, but only for a single page. I'd like to change several pages, so I tried to add an else statement like\ifnum \the\c@page=3 $\pi$ \expandafter\@gobble \else \ifnum \the\c@page=5 $5$ \expandafter\@gobble \fi \fibut this doesn't work. – kafman Nov 03 '23 at 17:04\int_case:nnbut I can't get the L3 programing layer to work (tried both locally and on overleaf based on this post: https://tex.stackexchange.com/questions/676615/installing-newer-expl3-via-the-tds-zip-file) How would your example with\int_case:nnbe translated to use\ifcase? – kafman Nov 04 '23 at 11:37\int_case:nn. It is part of LaTeX for years and part of l3 since 2013-07-24. Just copy the code before the\ExplSyntaxOffand remove the other\setkomafont{pagenumber}{…}as shown in my example. If you fail, please ask a new question with minimal working example, that shows, what you've tried and also the error you get. I've already extended my answer too often, because you've asked additional questions in comments instead in new questions. Please avoid such comment provocation of answer extension. – cabohah Nov 04 '23 at 12:08\int_case:nnIMHO even wouldn't be a question for TeX.SX. – cabohah Nov 04 '23 at 12:17