0

I am currently writing a PhD. I have the following code

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\rightmark}
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}

which I obtained from this thread. My goal is to have the section name instead of the chapter name in the top left part of each page the thesis, but I am getting the chapter name instead. Does anybody know if this might be caused by a conflict between packages?

The ones I am using are:

\usepackage[square, numbers, comma, sort&compress]{natbib}  
\usepackage{verbatim}
\usepackage{vector} 
\usepackage{titlesec}
\usepackage{subeqnarray}
\usepackage{lineno,hyperref}
\usepackage{soul}
\usepackage{comment}
\usepackage{amssymb}
\usepackage{srcltx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{psfrag}
\usepackage{graphicx,subfigure}
\usepackage{multirow}
\usepackage{algorithm}
\usepackage{algorithmic}   
\usepackage{psfrag}       
\usepackage{url}
\usepackage{color}
\usepackage{xcolor}
\usepackage{ulem}
\usepackage{breqn}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{subfigmat}
\usepackage{fancyhdr}

I have also proved the example:

\documentclass{book}
\usepackage{fancyhdr}

\usepackage{lipsum}% just to generate text for the example

\pagestyle{fancy} \fancyhf{} \fancyhead[L]{\rightmark} \fancyhead[R]{\thepage} \renewcommand{\headrulewidth}{0pt}

\begin{document} \chapter{Chapter title} \section{AAAA}

\lipsum[1-20]

\section{BBBB}

\lipsum[1-20] \end{document}

and it works as intended.

Any help is appreciated. Best regards.

  • Can you create a MWE which does not work as expected? If I add all your packages to the preamble of your current MWE (except vector which seems to be not supported in overleaf, but I don't think it is responsible for this), it still works as expected for me. – Οὖτις Mar 12 '23 at 13:41
  • I don't think I can, each time I am more convinced that it has to do with the template, but I am not profficient enough in latex to solve it. Thanks anyway – slow_learner Mar 12 '23 at 14:34

0 Answers0