I'm having a hard time with fancyhdr package in overleaf. My goal is make a header where the \subsection apper on the top left side of odd pages. In even pages, i want the the \section to appear on the top right side (see images, which aren't mine).picture1picture2



\section{Section name} \newpage

\subsection{Subsection name}
firstpage \newpage

second page \newpage
... next page 

If you notice, i put % in the front of \input{sections/1introduction.tex} because wheter i let this line to compile, only the \section name apper in the header. Any leads to solve this problem? If it might help, i divide my document in sections which i input them in the same way that is showed above.


Welcome to TeX.SX! If you just swap the \rightmark and \leftmark, you will get the name of the subsection on top left of odd pages and the name of the section on the top right of even pages.


To make it more like the style you have in the picture, you can add \textit before the commands, like \textit{\leftmark} in the first line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.