# Remove name of section from header in pagestyle{fancy} (Notice: document class=article)

I am forced to use the document class: article, because of several packages that I use and format restrictions.

I have long names for some of the sections and subsections, so there is no room to display it all in the header.

I only use: section-->subsection-->subsubsection, no "chapter".

I wish the header to display only subsection names and numbers, not sections. How do I do that?

When I use \fancyhf{} everything disappears from the header.

I also tried a solution that I found on this website

\documentclass[oneside,a4paper]{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[R]{Page \thepage\ of \pageref{LastPage}}


... but it doesn't display anything. I think the problem might be that the document class is different than what they had there, but I cannot change that.

• you know that you have the right to edit your own questions, right? – Johannes_B Feb 29 '16 at 15:59
• Posting a minimal working example is much more effective and obvious than adding ten ! to the question title. Please post an MWE. – Johannes_B Feb 29 '16 at 16:01
• 15.02pt as font size option? – user31729 Feb 29 '16 at 16:33
• yeah, you're right, thx, that was a mistake of course, but not the source of the problem with the header I think (?).. I will try to upload a working example as soon as possible. – user1611107 Feb 29 '16 at 16:38

You need to redefine the commands which fills the marks:

\documentclass{article}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand\sectionmark[1]{} %section doesn't set a mark
\makeatletter
\renewcommand\subsectionmark[1]{% but subsection should
\markright{\MakeUppercase{\ifnum\c@secnumdepth >\m@ne \thesubsection \quad \fi #1}}}
\makeatother
\begin{document}
\section{abc}\subsection{subsection}
\lipsum
\end{document}

• Works great, thx! Quick followup: How do you make the header in this case to appear in small letters, not CAPITALS? – user1611107 Mar 1 '16 at 8:26
• Remove the MakeUppercase command. – Ulrike Fischer Mar 1 '16 at 8:30
• I'm starting to regret that I answered your question without waiting for your complete minimal example. – Ulrike Fischer Mar 1 '16 at 8:55