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.

\newcommand\cotitle{Chapter 1 Title}
\newcommand\secco{Chapter 1, Section 1 Title}
\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.

  • Normally, \leftmark will be the chapter title and \rightmark will be the section title. The default is that they also contain the chapter and section number, respectively. You must redefine \chaptermark and \sectionmark if you don't want these numbers. See the fancyhdr documentation. Sep 1, 2022 at 18:27
  • I think you need to distinguish between LaTex oneside/twoside and the printed result where they want the margins on every page to be the same. You can get twoside to give the appearance of oneside, but I can't remember how. Hopefully somebody else can help. Sep 1, 2022 at 18:32
  • @PietervanOostrum Thank you Professor for the tips. There are no issues with the numbers. I am unable to make it possible automatically. Sep 2, 2022 at 2:12
  • @PeterWilson Thanks Professor Wilson for the comment. I need the one-sided format. Somehow, I have managed to do this manually. I wonder if it can be done automatically. Sep 2, 2022 at 2:15

1 Answer 1


As Peter Wilson said you could use a twoside document but with the same left and right margins, which can be done with the geometry package. Something like


The other way is to use a oneside document and use the \ifodd\value{page} as you have done in your code, but using \leftmark and \rightmark. This is the solution that I am offering you.



\newcommand\cotitle{Chapter 1 Title}
\newcommand\secco{Chapter 1, Section 1 Title}




\section{The first section}



enter image description here

enter image description here

  • Thanks a lot Professor Pieter for helping me with this wonderful code. I have the chapters with .tex files. It does not show the section titles. I have inserted this in the preamble. Sep 2, 2022 at 11:41
  • I don't understand this. Do you mean you don't use the \section command to define a section? Do you use \chapter commands for your chapters? Sep 2, 2022 at 14:40
  • I use those. But I have a separate folder (namely, Chapters) for the chapters where there are .tex files for the chapters. And in the main .tex file, I call the chapters as: \input{Chapters/Chapter1}. Here Chapter1 is the .tex file for Chapter 1. Hope you understand my problem now. Thanks. Sep 3, 2022 at 5:06
  • I could be making a mistake. But I'm not sure what's wrong. Sep 3, 2022 at 5:09
  • 1
    Using \input should not make a difference, as long as you have the normal \chapter and \section commands in these files. Sep 3, 2022 at 7:12

You must log in to answer this question.

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