Our university has instructions to write the thesis in a one-sided format. I am trying to place the chapter title and section title in the odd-even pages. I have succeeded (with manual inputs) in placing these along with the page number using the code from this link.
I manually put the following code in every section (of every chapter) to get this.
\pagestyle{fancy}
\newcommand\cotitle{Chapter 1 Title}
\newcommand\secco{Chapter 1, Section 1 Title}
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\fancyhead[C]{%
\ifodd\value{page}
\small\scshape\cotitle
\else
\small\scshape\secco
\fi }
\fancyhead[R]{\thepage\ifodd\value{page}\else\hfill\fi}
Is it possible to use \rightmark and \leftmark to get automatic chapter title (say, in the odd pages) and section title (say, in the even pages) in a one-sided thesis format?
Note that, I have 5 chapters and each containing 4-6 sections.
Any help will be highly appreciated. Thanks in advance.


\leftmarkwill be the chapter title and\rightmarkwill be the section title. The default is that they also contain the chapter and section number, respectively. You must redefine\chaptermarkand\sectionmarkif you don't want these numbers. See thefancyhdrdocumentation. – Pieter van Oostrum Sep 01 '22 at 18:27