0

This question already has an answer here:

I have got two questions and would be extremely grateful for any help (especially with the first question)!

Question 1: I am using the article class and would like the section title (including section number) to appear on the LEFT; additionally, on pages belonging to a subsection, the subsection title (excluding number) should be printed on the RIGHT.

To create the header I used the following code:

\documentclass{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}

\renewcommand{\subsectionmark}[1]{\markright{#1}}

\pagestyle{fancy}
\fancyhf{}
\rhead{\rightmark}
\lhead{\sectionmark}
\rfoot{\centering \thepage}

\begin{document}

\section{Introduction}

\section{Chapter 2}
  \subsection{A subsection}
  \subsection{Another subsection}

\section{Chapter 3}
  \subsection{First subsection in Chapter 3}
  \subsection{Another subsection in Chapter 3}

\section{Conclusion}

\end{document}

The problem is that with this code, the left-hand header is empty and the right-hand header gives the subsection title (if a subsection exists) and otherwise it gives the section title.

I would be very grateful if someone would show me how to get the desired header, described above!

Question 2: I don't want the header to appear on the first page of a new section. Is there anything one could include in the preamble to achieve this, instead of having to add \thispagestyle{empty}in the code underneath each \sectioncommand?

Many thanks in advance! :)

marked as duplicate by David Carlisle, TeXnician, Mensch, barbara beeton, Stefan Pinnow Sep 22 '17 at 17:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    it would be easier to answer if you made your example run without error and have pages showing the problem. But note by default article is one-sided and only the odd (right hand) page style is used, you need [twoside] to enable left and right pages to be styled differently. – David Carlisle Sep 22 '17 at 15:57
  • @David Carlisle Thank you so much – this was the piece I was missing! – Apollo13 Sep 22 '17 at 16:15