# How to alter the headnote in this thesis class provided in sharelatex?

I am using a template for graduate thesis in sharelatex, but there is some problem with the headnote, it shows the "physical constants" headnote for every other chapters. How to make relevant headnotes for each chapters?

%%
%% This is file Thesis.cls', based on 'ECSthesis.cls', by Steve R. Gunn
%% generated with the docstrip utility.
%%
%% Created by Steve R. Gunn, modified by Sunil Patel: www.sunilpatel.co.uk

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
[2007/22/02 v1.0
LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
\edef\@curroptions{\@ptionlist{\@currname.\@currext}}
\@tempswafalse
\@tfor\@this:=#2\do{
\@expandtwoargs\in@{,\@this,}{,\@curroptions,}
\ifin@ \@tempswatrue \@break@tfor \fi}
\let\@this\@empty
\if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\Declaration[1]{
\btypeout{Declaration of Authorship}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf Declaration of Authorship\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space \number\year}
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
\usepackage{vmargin}
\setmarginsrb           { 1.5in}  % left margin
{ 0.6in}  % top margin
{ 1.0in}  % right margin
{ 0.8in}  % bottom margin
{   9pt}  % foot height
{ 0.3in}  % foot sep
\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000       % No consecutive line hyphens.
\brokenpenalty=10000              % No broken words across columns/pages.
\widowpenalty=9999                % Almost no widows at bottom of page.
\clubpenalty=9999                 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999    % Almost never break footnotes.
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\theoremstyle{plain}
\newtheorem{example}{Example}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{axiom}[theorem]{Axiom}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\usepackage[centerlast,small,sc]{caption}
\setlength{\captionmargin}{20pt}
\newcommand{\fref}[1]{Figure~\ref{#1}}
\newcommand{\tref}[1]{Table~\ref{#1}}
\newcommand{\eref}[1]{Equation~\ref{#1}}
\newcommand{\cref}[1]{Chapter~\ref{#1}}
\newcommand{\sref}[1]{Section~\ref{#1}}
\newcommand{\aref}[1]{Appendix~\ref{#1}}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\dbltopfraction}{.85}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\dblfloatpagefraction}{.75}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[scriptsize]{subfigure}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{lstpatch}
\lstset{captionpos=b,
frame=tb,
basicstyle=\scriptsize\ttfamily,
showstringspaces=false,
keepspaces=true}
\lstdefinestyle{matlab} {
language=Matlab,
keywordstyle=\color{blue},
stringstyle=\color[rgb]{0.7,0,0} }
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
\pdfstringdefDisableCommands{
\let\\\space
}
\newcommand*{\supervisor}[1]{\def\supname{#1}}
\newcommand*{\examiner}[1]{\def\examname{#1}}
\newcommand*{\degree}[1]{\def\degreename{#1}}
\newcommand*{\authors}[1]{\def\authornames{#1}}
\newcommand*{\university}[1]{\def\univname{#1}}
\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\group}[1]{\def\groupname{#1}}
\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
\newcommand*{\subject}[1]{\def\subjectname{#1}}
\newcommand*{\keywords}[1]{\def\keywordnames{#1}}
\supervisor  {}
\examiner    {}
\degree      {}
\authors     {}
\university  {\texorpdfstring{\href{http://www.bracu.ac.bd/}
{BRAC University}}
{BRAC University}}
\UNIVERSITY  {\texorpdfstring{\href{http://www.bracu.ac.bd/
}
{BRAC University}}
{BRAC University}}
{Department of Mathematics and Natural Sciences}}
{Department of Mathematics and Natural Sciences}}
{Department of Mathematics and Natural Sciences}}
{Department of Mathematics and Natural Sciences}}
\group       {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
{Research Group Name}}
{Research Group Name}}
\GROUP       {\texorpdfstring{\href{Research Group Web Site URL Here (include http://)}
{RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
{RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
\faculty     {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
\FACULTY     {\texorpdfstring{\href{Faculty Web Site URL Here (include http://)}
\subject     {}
\keywords    {}
\renewcommand\maketitle{
\btypeout{Title Page}
\hypersetup{pdftitle={\@title}}
\hypersetup{pdfsubject=\subjectname}
\hypersetup{pdfauthor=\authornames}
\hypersetup{pdfkeywords=\keywordnames}
\thispagestyle{empty}
\begin{titlepage}
\let\footnotesize\small
\let\footnoterule\relax
\let \footnote \thanks
\setcounter{footnote}{0}
\null\vfil
\vskip 60\p@
\begin{center}
\setlength{\parskip}{0pt}
{\large\textbf{\UNIVNAME}\par}
\vfill
{\huge \bf \@title \par}
\vfill
{\LARGE by \par}
\smallskip
{\LARGE \authornames \par}
\vfill
{\large A thesis submitted in partial fulfillment for the \par}
{\large degree of Bachelors of Science \par}
\bigskip
\bigskip
{\large in the \par}
{\large \facname \par}
{\large \deptname \par}
\bigskip
\bigskip
\bigskip
{\Large \@date \par}
\bigskip
\end{center}
\par
\@thanks
\vfil\null
\end{titlepage}
\setcounter{footnote}{0}%
\global\let\thanks\relax
\global\let\maketitle\relax
\global\let\@thanks\@empty
\global\let\@author\@empty
\global\let\@date\@empty
\global\let\@title\@empty
\global\let\title\relax
\global\let\author\relax
\global\let\date\relax
\global\let\and\relax
\cleardoublepage
}
\newenvironment{abstract}
{
\btypeout{Abstract Page}
\thispagestyle{empty}
\null\vfil
\begin{center}
\setlength{\parskip}{0pt}
{\normalsize \UNIVNAME \par}
\bigskip
{\huge{\textit{Abstract}} \par}
\bigskip
{\normalsize \facname \par}
{\normalsize \deptname \par}
\bigskip
{\normalsize Bachelors of Science in Physics\par}
\bigskip
{\normalsize\bf \@title \par}
\medskip
{\normalsize by \authornames \par}
\bigskip
\end{center}
}
{
\vfil\vfil\vfil\null
\cleardoublepage
}
\setcounter{tocdepth}{6}
\newcounter{dummy}
\refstepcounter{dummy}
\renewcommand\tableofcontents{
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
\@starttoc{toc}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\renewcommand\listoffigures{
\btypeout{List of Figures}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listfigurename
\@mkboth{\MakeUppercase\listfigurename}
{\MakeUppercase\listfigurename}}
\@starttoc{lof}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\renewcommand\listoftables{
\btypeout{List of Tables}
\begin{spacing}{1}{
\setlength{\parskip}{1pt}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listtablename
\@mkboth{
\MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
\@starttoc{lot}
\if@restonecol\twocolumn\fi
\cleardoublepage
}\end{spacing}
}
\newcommand\listsymbolname{Abbreviations}
\usepackage{longtable}
\newcommand\listofsymbols[2]{
\btypeout{\listsymbolname}
\chapter*{\listsymbolname
\@mkboth{
\MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\listconstants{Physical Constants}
\usepackage{longtable}
\newcommand\listofconstants[2]{
\btypeout{\listconstants}
\chapter*{\listconstants
\@mkboth{
\MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\listnomenclature{Symbols}
\usepackage{longtable}
\newcommand\listofnomenclature[2]{
\btypeout{\listnomenclature}
\chapter*{\listnomenclature
\@mkboth{
\MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
\cleardoublepage
}
\newcommand\acknowledgements[1]{
\btypeout{Acknowledgements}
\thispagestyle{plain}
\begin{center}{\huge{\textit{Acknowledgements}} \par}\end{center}
{\normalsize #1}
\vfil\vfil\null

}
\newcommand\dedicatory[1]{
\btypeout{Dedicatory}
\thispagestyle{plain}
\null\vfil
\vskip 60\p@
\begin{center}{\Large \sl #1}\end{center}
\vfil\null
\cleardoublepage
}
\renewcommand\backmatter{
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\btypeout{\bibname}
\@mainmatterfalse}
\endinput
%%
%% End of file Thesis.cls'.


and this is the thesis.tex file, I provided both because I have no idea which section of the files are to alter.

%% ----------------------------------------------------------------
%% Thesis.tex -- MAIN FILE (the one that you compile with LaTeX)
%% ----------------------------------------------------------------

% Set up the document
\documentclass[a4paper, 11pt, oneside]{Thesis}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
\graphicspath{Figures/}  % Location of the graphics files (set up for graphics to be in PDF format)

% Include any extra LaTeX packages required
\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments

\usepackage{vector}  % Allows "\bvec{}" and "\buvec{}" for "blackboard" style bold vectors in maths
\hypersetup{urlcolor=blue, colorlinks=true}  % Colours hyperlinks in blue, but this can be distracting if there are many links.
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.9}
%\usepgfplotslibrary{external}
%\tikzexternalize
%% ----------------------------------------------------------------
\begin{document}
\frontmatter      % Begin Roman style (i, ii, iii, iv...) page numbering

% Set up the Title Page
\title  {Anisotropic charged stellar models in Generalized Tolman IV spacetime}
\authors  {\texorpdfstring
{\href{h.tazkera@gmail.com}{Tazkera Haque}}
{Tazkera Haque}
}
\date       {\today}
\subject    {}
\keywords   {}

\maketitle
%% ----------------------------------------------------------------

\setstretch{1.3}  % It is better to have smaller font and larger line spacing than the other way round

% Define the page headers using the FancyHdr package and set up for one-sided printing
\rhead{\thepage}  % Sets the right side header to show the page number

\pagestyle{fancy}  % Finally, use the "fancy" page style to implement the FancyHdr headers

%% ----------------------------------------------------------------
% Declaration Page required for the Thesis, your institution may give you a different text to place here
\Declaration{

I, Tazkera Haque, declare that this thesis titled, Anisotropic charged stellar models in Generalized Tolman IV spacetime' and the work presented in it are my own. I confirm that:

\begin{itemize}
\item[\tiny{$\blacksquare$}] This work was done wholly or mainly while in candidature for a bachelor degree at this University.

\item[\tiny{$\blacksquare$}] Where I have consulted the published work of others, this is always clearly attributed.

\item[\tiny{$\blacksquare$}] Where I have quoted from the work of others, the source is always given. With the exception of such quotations, this thesis is entirely my own work.

\item[\tiny{$\blacksquare$}] I have acknowledged all main sources of help.

\item[\tiny{$\blacksquare$}] Where the thesis is based on work done by myself jointly with others, I have made clear exactly what was done by others and what I have contributed myself.
\\
\end{itemize}

Signed:\\
\rule[1em]{25em}{0.5pt}  % This prints a line for the signature

Date:\\
\rule[1em]{25em}{0.5pt}  % This prints a line to write the date
}
\clearpage  % Declaration ended, now start a new page

%% ----------------------------------------------------------------
% The "Funny Quote Page"
\pagestyle{empty}  % No headers or footers for the following pages

\null\vfill
% Now comes the "Funny Quote", written in italics
\textit{General relativity predicts that time ends inside black holes because the gravitational collapse squeezes matter to infinite density.''
}

\begin{flushright}
Lee Smolin
\end{flushright}

\vfill\vfill\vfill\vfill\vfill\vfill\null
\clearpage  % Funny Quote page ended, start a new page
%% ----------------------------------------------------------------

% The Abstract Page
\abstract{

With the presence of electric charge and pressure anisotropy some anisotropic stellar models have
been developed. An algorithm presented by Herrera et al. (Phys. Rev. D 77, 027502 (2008)) to
generate static spherically symmetric anisotropic solutions of Einstein’s equations has been used to derive
relativistic anisotropic charged fluid spheres. In the absence of pressure anisotropy the fluid spheres reduce
to some well-known Generalized Tolman IV exact metrics. The astrophysical significance of the resulting
equations of state (EOS) for a particular case (Wyman-Leibovitz-Adler) for the anisotropic charged matter
distribution has been discussed. The interior matter pressure, energy–density, and the
adiabatic sound speed are expressed in terms of simple algebraic
functions. The constant parameters involved in the solution
have been set so that certain physical criteria satisfied. Physical analysis shows that the relativistic stellar structure obtained in
this work may reasonably model an electrically charged compact star, whose energy density associated
with the electric fields is of the same order of magnitude as the energy density of fluid matter itself like
electrically charged bare strange quark stars.

}

\clearpage  % Abstract ended, start a new page
%% ----------------------------------------------------------------

\setstretch{1.3}  % Reset the line-spacing to 1.3 for body text (if it has changed)

% The Acknowledgements page, for thanking everyone
\acknowledgements{

I would like to give special thanks to God Almighty, without whom I would
not have had the motivation and strength to complete this thesis. I would also like to
thank my family for their mo
ral support and encouragement. I thank My honorable faculty member Mohammad Hassan Murad for giving me the opportunity to work under his research project and for
helping me through with this thesis. I thank the entire stellar models research group whose papers I have frequently used and consulted, and
in particular Dr. Mofiz Uddin Ahmed and
for their continuous
support, advice, and help in the writing of this thesis.
Thanks to you all and God bless.

}
\clearpage  % End of the Acknowledgements
%% ----------------------------------------------------------------

\pagestyle{fancy}  %The page style headers have been "empty" all this time, now use the "fancy" headers as defined before to bring them back

%% ----------------------------------------------------------------

%% ----------------------------------------------------------------
\lhead{\emph{List of Figures}}  % Set the left side page header to "List if Figures"
\listoffigures  % Write out the List of Figures

%% ----------------------------------------------------------------
\lhead{\emph{List of Tables}}  % Set the left side page header to "List of Tables"
\listoftables  % Write out the List of Tables

%% ----------------------------------------------------------------
\setstretch{1.5}  % Set the line spacing to 1.5, this makes the following tables easier to read
\clearpage  % Start a new page
\listofsymbols{ll}  % Include a list of Abbreviations (a table of two columns)
{
% \textbf{Acronym} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or \\
\textbf{LAH} & \textbf{L}ist \textbf{A}bbreviations \textbf{H}ere \\

}

%% ----------------------------------------------------------------
\clearpage  % Start a new page
\lhead{\emph{Physical Constants}}  % Set the left side page header to "Physical Constants"
\listofconstants{lrcl}  % Include a list of Physical Constants (a four column table)
{
% Constant Name & Symbol & = & Constant Value (with units) \\
Speed of Light & $c$ & $=$ & $2.997\ 924\ 58\times10^{8}\ \mbox{ms}^{-\mbox{s}}$ (exact)\\

}

%% ----------------------------------------------------------------
\clearpage  %Start a new page

%% ----------------------------------------------------------------
% End of the pre-able, contents and lists of things
% Begin the Dedication page

\setstretch{1.3}  % Return the line spacing back to 1.3

\dedicatory{This thesis is dedicated to m}

%% ----------------------------------------------------------------
\mainmatter   % Begin normal, numeric (1,2,3...) page numbering
\pagestyle{fancy}  % Return the page headers back to the "fancy" style

% Include the chapters of the thesis, as separate files
% Just uncomment the lines as you write the chapters

\input{Chapters/Chapter1} % Introduction

%\input{Chapters/Chapter2} % Background Theory

%\input{Chapters/Chapter3} % Experimental Setup

%\input{Chapters/Chapter4} % Experiment 1

%\input{Chapters/Chapter5} % Experiment 2

%\input{Chapters/Chapter6} % Results and Discussion

%\input{Chapters/Chapter7} % Conclusion

%% ----------------------------------------------------------------
% Now begin the Appendices, including them as separate files

\appendix % Cue to tell LaTeX that the following 'chapters' are Appendices

\input{Appendices/AppendixA}    % Appendix Title

%\input{Appendices/AppendixB} % Appendix Title

%\input{Appendices/AppendixC} % Appendix Title

\backmatter

%% ----------------------------------------------------------------
\label{Bibliography}
\bibliographystyle{unsrtnat}  % Use the "unsrtnat" BibTeX style for formatting the Bibliography
\bibliography{bibliography}  % The references (bibliography) information are stored in the file named "Bibliography.bib"

\end{document}  % The End

%% ----------------------------------------------------------------

• Try if \lhead{\rightmark} between \mainmatter and \pagestyle{fancy} does what you need. – Ignasi Jun 8 '15 at 14:34
• @Ignasi Wanna make that an answer? – Johannes_B Jun 9 '15 at 12:05
• @Johannes_B Done! – Ignasi Jun 9 '15 at 14:52
• @Johannes_B Do you know where lstpatch.sty comes from? – cfr Feb 1 '17 at 15:33
• @cfr Please see the chat ping. – Johannes_B Feb 1 '17 at 17:00

Thesis.cls defines how left page headings should be:

\usepackage{fancyhdr}
\pagestyle{fancy}


but in thesis.tex these definitions are overwritten everytime \lhead{}, \lhead{\emph{Physical Constants}} or similar commands are used.

Therefore, in mainmatter, although \pagestyle{fancy} forces the use of the official style again, \lhead{\emph{Physical Constants}} remains being the contents for left headers.

If you want to restore the original style, command

\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}


should be declared before the first use of \pagestyle{fancy} in mainmatter.

• Thanks for answering. by the way, that Thesis.cls` haunts me at night. – Johannes_B Jun 9 '15 at 15:10