# After \cfoot command every page is getting the same footer despite of specifying \thispagestyle

I am using fancyhdr package, I want some pages of my document to have a specific footer which I managed to do with the help of \cfoot. I'm using font Marathi.

But after that page every page has got the same footer specified as the argument of \cfoot. I also added \pagenumbering{arabic} after that page, but it is not at work. Please help me out.

(Note - \pagestyle of all the pages is fancy.)

As suggested by @Marjin I've made a file. (I've added each and every command from my preamble. Probably few commands are also not related with our interest.) This file does not run. (polyglossia needs XeLaTeX, so I've used XeLaTeX)

\documentclass{article}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{polyglossia}
\usepackage{fancyhdr}
\usepackage{navigator}
\usepackage{eso-pic,xcolor}
\newcommand{\HUGE}{\fontsize{50pt}{50pt}\selectfont}
\renewcommand{\footrulewidth}{0.4pt}
\setdefaultlanguage{Marathi}
\setmainfont[Mapping=devanagarinumerals,Language=Marathi]{Tillana Medium}
\newfontfamily{\Modak}[Mapping=devanagarinumerals,Language=Marathi]{Modak}
\renewcommand{\baselinestretch}{1.2}
\disablehyphenation
\setlength{\parindent}{0.9cm}
\usepackage{color}
\color{white}
\pagecolor{black}

\begin{document}
\begin{center}
\outline{1}{abcd}
abcdefghi\\
\pagebreak
\outline{1}{pqrs}
\thispagestyle{fancy}
\cfoot{एक}
abcdefghi\\
\pagebreak
\outline{1}{lmno}
\thispagestyle{fancy}
\cfoot{दोन}
abcdefghi\\
\pagebreak
\outline{1}{wxyz}
\thispagestyle{fancy}
\cfoot{तीन}
abcdefghi\\
\pagebreak
\thispagestyle{fancy}
abcdefghi\\
\pagebreak
\outline{1}{stuv}
\pagenumbering{arabic}
\thispagestyle{fancy}
\end{center}
\end{document}

• Can you provide a small document (perhaps using \lipsum) which demonstrates the problem? – John Kormylo Mar 21 '19 at 3:35
• My actual input file is very long and I cannot really paste it here. I tried to make one new input file imitating the commands in the real file, but actually it is working fine in that file. Probably fancyhdr is crashing with the other packages I've used (fontspec xltxtra polyglossia fancyhdr navigator eso-pic color xcolor) – Niranjan Mar 21 '19 at 6:54
• You can try to add those packages to the preamble of your small new input file to see if it makes any difference, if not then you can add contents from your actual file until the problem appears, or the other way around take (a copy of) your actual file and remove content until the problem disappears. Once you know where the problem is you can most likely construct a small example to reproduce the problem, which we can address here - or maybe during your investigation you already find the solution yourself. – Marijn Mar 21 '19 at 9:30
• @Marjin I've made one file which is not running. Please check it. – Niranjan Mar 21 '19 at 11:30
• I'm having trouble with your MWE. However, typically \cfoot is only used in the preamble. One can use something like \cfoot{\myfoot}in the preamble and \renewcommand{\myfoot}{...} in the document. – John Kormylo Mar 21 '19 at 15:25

Because you are using a font most of us do not have we can not run your given mwe. If the font is not the issue please create in future an mwe without your special font and use a standard font as I did in the following mwe.

If you change \cfoot in code this changing is permanent, that means if you want to get the pagenumber later back you have to change \cfoot again as I did in the following mwe. Please see that I used the text foot <number> for your changings in \cfoot and added at last \cfoot{\thepage} to get the page number back. I added numbers to your page head like abcdefghi 1 to be better able to identify the current page. I simply commented your font definitions ...

MWE:

\documentclass{article}

\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{polyglossia}
\usepackage{fancyhdr}
\usepackage{navigator}
\usepackage{eso-pic,xcolor}
\newcommand{\HUGE}{\fontsize{50pt}{50pt}\selectfont}
\renewcommand{\footrulewidth}{0.4pt}
%\setdefaultlanguage{Marathi}
%\setmainfont[Mapping=devanagarinumerals,Language=Marathi]{Tillana Medium}
%\newfontfamily{\Modak}[Mapping=devanagarinumerals,Language=Marathi]{Modak}
\renewcommand{\baselinestretch}{1.2}
\disablehyphenation
\setlength{\parindent}{0.9cm}
\usepackage{color}
\color{white}
\pagecolor{black}

\begin{document}
\begin{center}
\outline{1}{abcd}
abcdefghi 1\\ % <=======================================================
\pagebreak
\outline{1}{pqrs}
\thispagestyle{fancy}
\cfoot{foot1}
abcdefghi 2\\ % <=======================================================
\pagebreak
\outline{1}{lmno}
\thispagestyle{fancy}
\cfoot{foot2}
abcdefghi 3\\ % <=======================================================
\pagebreak
\outline{1}{wxyz}
\thispagestyle{fancy}
\cfoot{foot3}
abcdefghi 4\\ % <=======================================================
\pagebreak
\thispagestyle{fancy}
\cfoot{\thepage} % <====================================================
abcdefghi 5\\
\pagebreak
\outline{1}{stuv}
\pagenumbering{arabic}
\thispagestyle{fancy}
\end{center}
\end{document}


and the result:

and page 5

• So \pagestyle{fancy} should be in preamble, right? – Niranjan Mar 22 '19 at 5:04
• This worked for me. One last doubt. After some pages I want to start page numbering (I don't want it to start from the first page.) I've entered \pagenumbering{arabic} command where it should start, still I can't see the numbers. How to get them? – Niranjan Mar 22 '19 at 5:19
• – Niranjan Mar 22 '19 at 5:31