[Tex/LaTex] How to i remove the header on the first page of the sections, but keep the footer

fancyhdrheader-footer

i need some support with my headers and footers. Actually my expectation was that Latex was good right at these type of things, but i'm very confused that i don't get it sorted out.

I have the article class, twosided. I define my own header and footer. Now on the first page of my sections i would like to have no header. I could live with writing \thispagestyle{something} just after the \section command.

But when i use "plain" or "empty" i loose my footer that i have styled in the way i need it. In particular, plain page style puts the page number in the middle, empty completely removes the footer. I need my page numbers on the left or right, as it is a twosided document.

My MWE is a bit verbose, it creates 5 pages with blindtext and a couple of sections. On the pages where the sections start, i somehow need my custom footer, but no header. Unfortunatelly i cannot switch to another class than article.

Hope you can help me.

Cheers
Janos

\documentclass[a4paper,twoside]{article}

\usepackage{lipsum}
\usepackage{fancyhdr}

\fancyhf{}% Clear header/footer
\fancyhead[OR]{\textbf{\rightmark}}
\fancyhead[EL]{\textbf{\leftmark}}
\fancyfoot[OR]{\textbf{\thepage}}
\fancyfoot[EL]{\textbf{\thepage}}

\pagestyle{fancy}

\renewcommand{\sectionmark}[1]{\markboth{\thesection\quad#1}{}} % set the \leftmark

\begin{document}

    \section{First Section}
    \thispagestyle{plain}

    \subsection{Subsection One}
    \lipsum[1]
    \subsection{Subsection Two}
    \lipsum[1]
    \lipsum[1]
    \lipsum[1]
    \lipsum[1]
    \subsection{Subsection Three}
    \lipsum[1]
    \subsection{Subsection Four}
    \lipsum[1]
    \lipsum[1]
    \lipsum[1]
    \lipsum[1]
    \lipsum[1]
    \lipsum[1]

    \newpage
    \section{Second Section - I don't want a header here}
    \thispagestyle{plain}
    \thispagestyle{empty}

    \subsection{I don't want a different footer though}
    \lipsum[1]
    \subsection{Nor can i live without my footer}
    \lipsum[1]
    \lipsum[1]
\end{document}

Best Answer

Add the following at the end of your preamble:

\fancypagestyle{plain}{%
  \fancyhf{}% Clear header/footer
  \fancyfoot[OR]{\textbf{\thepage}}%
  \fancyfoot[EL]{\textbf{\thepage}}%
  \renewcommand{\headrulewidth}{0pt}%
}

Also, remove \thispagestyle{empty} after issuing the second \section.