2

I am having trouble including page numbers in my resume. I earlier used \pagestyle{empty} for non-numbered page but thought to have page numbers. So I decided to use following packages which works for numbering. however, the last section in the pages, appearing on top. If I remove these packages, it works fine.

[Edit]: A Key thing to note is my sections are non-numbered for actual page display (as they should be) but on the top it appears with numbering.

Yes I am using \fancyhdr{} before \cfoot. I believe there is some incompatibility between packages, I am using since if I remove \pagestyle{fancy} and put \pagestyle{empty} it works as expected but of course pages will not be numbered.

\documentclass[a4paper,12pt]{article}

\usepackage{titlesec}                   

\usepackage{fancyhdr}
\pagestyle{fancy} 
\usepackage{lastpage}
\cfoot{\thepage\ of \pageref{LastPage}}

\titleformat{\section}{\LARGE\scshape\raggedright}{}{0em}{}[\titlerule]
\titlespacing{\section}{0pt}{2.5pt}{2.5pt}

\titleformat{\subsection}{\large\scshape\raggedright}{\hspace{0.25cm}}{0em}{}
\titlespacing{\subsection}{0pt}{2.5pt}{2.5pt}


%\pagestyle{empty} % non-numbered pages

\begin{document}


\section{One}
\section{Two}
\end{document}

Output Code Output

  • Please show us a minimal working example (MWE) then we have not to guess what you are doing! – Mensch Jun 24 at 17:26
  • Apologies, I might have to add little big code since I believe it is about compatibility between packages. – Joe Jun 24 at 18:50
  • 1
    If you like my answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and/or marking it as the accepted answer (by clicking on the checkmark ✓). – Mensch Aug 12 at 17:28
1

Well, I'm not sure I understand you right:

It seems you want to get rid of the printed section name in header with style fancy ...

Style fancy is predefined and adds the section name and an headrule to the headers. To get rid of them you need to redefine style fancy like this:

\pagestyle{fancy} 
\fancyhf{} % <==========================================================
\renewcommand{\headrulewidth}{0pt} % <==================================
\cfoot{\thepage\ of \pageref{LastPage}}

With \fancyhf{} you delete all predefined things, with \renewcommand{\headrulewidth}{0pt} you delete the headrule.

With the following complete mwe

\documentclass[a4paper,12pt]{article}

\usepackage{titlesec}

\usepackage{lastpage}

\usepackage{fancyhdr}
\pagestyle{fancy} 
\fancyhf{} % <==========================================================
\renewcommand{\headrulewidth}{0pt} % <==================================
\cfoot{\thepage\ of \pageref{LastPage}}

\titleformat{\section}{\LARGE\scshape\raggedright}{}{0em}{}[\titlerule]
\titlespacing{\section}{0pt}{2.5pt}{2.5pt}

\titleformat{\subsection}{\large\scshape\raggedright}{\hspace{0.25cm}}{0em}{}
\titlespacing{\subsection}{0pt}{2.5pt}{2.5pt}


\begin{document}
\section{One}
\section{Two}

\end{document}

you get the result:

resulting page

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.