MWE is below:
\documentclass{report}
\usepackage{fancyhdr}
%\newcommand{\currentchapter}{}
%\let\oldchapter\chapter
%\renewcommand{\oldchapter}[1]{\oldchapter{#1}\renewcommand{\currentchapter}{#1}}
%\renewcommand{\sectionmark}[1]{\markright{#1}}
%\renewcommand{\chaptermark}[1]{\markboth{\textbf{#1}}{}} \rhead{\leftmark}
\fancypagestyle{newstyle}{
\fancyhf{}
\fancyhead[LE]{{\nouppercase{\leftmark}}}
\fancyhead[RO]{{\nouppercase{\rightmark}}}
}
\begin{document}
I want to have
'Introduction'
in place of
'Chapter 1. Introduction'
as the header for my pages inside the document.
So, is there a command set I can use instead of \leftmark
to get the desired results? Or can I redefine \leftmark
in any way to get the desired results?
Best Answer
The problem with your current (re)definition of
\chapter
is that it removes the ability to use\chapter*{<title>}
or\chapter[<ToC entry>]{<title>}
. While this may not be a problem in your case, a general approach/solution would be preferred.titleps
provides built-in access to the titles of sectional units via\chaptertitle
,\sectiontitle
, etc.:In fact, even though the above does not use
fancyhdr
, the switch totitleps
is fairly straight forward. Seetitleps
forfancyhdr
users. The advantage should be obvious, since the interface provided bytitleps
is clear and avoids hacking into the page marks to extract content.