[Tex/LaTex] Change Page Number Font Size, using {theheadings}

page-numberingtable of contents

I've a problem. When I use this command to set the font size of the page numbering ( \renewcommand*{\thepage}{\footnotesize\arabic{page}} ), all page numbers in TOC turns footnotesize too. How can I solve this?

[MWE] This is the preamble of the main file:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{standalone}

\usepackage{wallpaper}
\usepackage{color}
\definecolor{darkblue}{RGB}{6,0,111}
\definecolor{red}{RGB}{255,0,0}
\definecolor{green}{RGB}{0,125,0}

\usepackage{indentfirst}
\setlength\parindent{1.25cm}

\usepackage{graphicx}
%\DeclareGraphicsExtensions{.jpg,.png}

\renewcommand*\contentsname{\centering ÍNDICE}
\usepackage{titletoc}

\setcounter{secnumdepth}{6}
\setcounter{tocdepth}{6}

\titlecontents{section}[0em]{\medskip\bfseries}
{\thecontentslabel.\enspace} %numbered
{} %numberless
{\titlerule*[1.5mm]{.}\contentspage}

\titlecontents{subsection}[0em]{\smallskip}
{\thecontentslabel.\enspace} %numbered
{} %numberless
{\normalfont\titlerule*[1.5mm]{.}\contentspage}

\titlecontents{subsubsection}[0em]{\smallskip\bfseries}
{\thecontentslabel.\enspace} %numbered
{} %numberless
{\normalfont\titlerule*[1.5mm]{.}\contentspage}

\titlecontents{paragraph}[0em]{\smallskip}
{\thecontentslabel.\enspace} %numbered
{} %numberless
{\normalfont\titlerule*[1.5mm]{.}\contentspage}

\titlecontents{subparagraph}[0em]{\smallskip\itshape}
{\thecontentslabel.\enspace} %numbered
{} %numberless
{\normalfont\titlerule*[1.5mm]{.}\contentspage}

\usepackage{enumitem}
\usepackage{multirow}
\usepackage{booktabs}

\usepackage{setspace}
\singlespacing

\usepackage{units}

\usepackage[fleqn]{amsmath}
\makeatletter
\g@addto@macro\normalsize{%
    \setlength\abovedisplayskip{0mm}
    \setlength\belowdisplayskip{5mm}
    \setlength\abovedisplayshortskip{0mm}
    \setlength\belowdisplayshortskip{0mm}
}
\makeatother

\usepackage{txfonts}

\renewcommand*{\thepage}{\footnotesize\arabic{page}}
\pagestyle{myheadings}

\usepackage[bottom=2cm,top=3cm,left=3cm,right=2cm]{geometry}
\usepackage{titling}
\usepackage{titlesec}
\titlelabel{\thetitle.\quad}
%\titlelabel{\theparagraph.\quad}
\titleformat*{\section}{\normalsize\bfseries\uppercase}
\titleformat*{\subsection}{\normalsize\uppercase}
\titleformat*{\subsubsection}{\normalsize\bfseries}
\titleformat{\paragraph}[hang]{\normalsize}{\theparagraph.}{1em}{}
\titleformat{\subparagraph}[hang]{\normalsize\itshape}{\thesubparagraph.}{1em}{}


\begin{document}

% TOC
\newpage
\thispagestyle{empty}
\tableofcontents
\thispagestyle{empty}
\newpage

% MISC
\section{Sec One}

\subsection{Subsec One}
\subsection{Subsec Two}
\subsection{Subsec Three}

\newpage
\section{Sec Two}

\subsection{Subsec One}
\subsection{Subsec Two}
\subsection{Subsec Three}

\newpage
\section{Sec Three}

\subsection{Subsec One}
\subsection{Subsec Two}
\subsection{Subsec Three}

\newpage
\section{Sec Four}

\subsection{Subsec One}
\subsection{Subsec Two}
\subsection{Subsec Three}


\end{document}

Best Answer

For header and footer requirements, it is better to use fancyhdr or titleps as you are already using titlesec heavily. However, for this case if you use

\renewcommand*{\thepage}{\footnotesize\arabic{page}}

it will make the page number foot note size every where. You have to put this inside the definition of oddhead (where the page number comes in myheadings style. To do that add these lines in the preamble.

\pagestyle{myheadings}
\makeatletter
\def\@oddhead{{\slshape\rightmark}\hfil\footnotesize\thepage}%
\makeatother

enter image description here