2

This might look like a duplicate, but I don't think it is. What I want is the chapter and section titles in the headers on alternating pages in italics without them being preceded by "Chapter 1" or the section number. I've managed to get most the way there, but I can't manage to get the section title (without the section number) on the odd pages without the chapter title disappearing altogether from the headers on the even pages.

The commands I'm using to try and get rid of the "Chapter 1" and "1.1", respectively, are:

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\renewcommand{\sectionmark}[1]{\markboth{#1}{}}

And here's a MWE:

\documentclass[12pt, twoside]{report}

\usepackage{lipsum}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} %clears header
\fancyhead[CE]{\nouppercase{\textit{\leftmark}}} %puts chapter title on even page in lower-case italics
\fancyhead[CO]{\nouppercase{\textit{\rightmark}}} %puts section title on odd page in lower-case italics
\renewcommand{\headrulewidth}{0pt} %gets rid of line
\renewcommand{\chaptermark}[1]{\markboth{#1}{}} %gets rid of chapter number
\renewcommand{\sectionmark}[1]{\markboth{#1}{}} %gets rid of section number

\begin{document}

\chapter{Off we go}

\section{Introduction}

\lipsum[1-7]

\section{Key Point}

\lipsum[7-10]


\end{document}

I suspect it's something to do with the \markboth bit, but I can't figure it out! Thanks!

1 Answer 1

1

You have to use

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

Example:

\documentclass[12pt, twoside]{report}
\usepackage{lipsum}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} %clears header
\fancyhead[CE]{\nouppercase{\textit{\leftmark}}} %puts chapter title on even page in lower-case italics
\fancyhead[CO]{\nouppercase{\textit{\rightmark}}} %puts section title on odd page in lower-case italics
\renewcommand{\headrulewidth}{0pt} %gets rid of line
\renewcommand{\chaptermark}[1]{\markboth{#1}{}} %gets rid of chapter number
\renewcommand{\sectionmark}[1]{\markright{#1}} %gets rid of section number

\begin{document}
\chapter{Off we go}
\section{Introduction}
\lipsum[1-7]
\section{Key Point}
\lipsum[7-10]
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .