0

I am trying to compile my code using fancyhdr package but it doesn't compile it properly. Can someone kindly advise how to fix the issue? Here is what I am compiling:

% MNRAS Manuscript Template
\documentclass[useams,onecolumn,usenatbib,twoside]{Thesis}
\usepackage[T1]{fontenc}
%
\usepackage{fancyhdr}
\pagestyle{fancy}
%
\usepackage{titlesec}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{lettrine}
%
\usepackage{natbib}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage[utf8,latin1]{inputenc}
\usepackage{setspace}
\usepackage{makeidx}
\graphicspath{{./images/}}
\usepackage[table,xcdraw,svgnames]{xcolor}

\hypersetup{final}
\hypersetup{citecolor=CornflowerBlue}
\hypersetup{linkcolor=CornflowerBlue}
\hypersetup{urlcolor=CornflowerBlue}
\def\Planck{\,{\em Planck}}
\def\ie{\,{\rm i.e.}\,}
\def\eg{\,{\rm e.g.}\,}
\def\um{{\rm $\mu$m}\,}
\def\sdss{{\sc sdss}}
\def\viking{{\sc viking}}
\def\hatlas{{\sc h-atlas}}
\def\wise{{\em WISE}}
\def\vista{{\sc vista}}
\def\galex{{\em GALEX}}
\def\lambdar{{\sc lambdar}}
\def\lamsc{{\sc lambdar}}
\def\magphys{{\sc magphys}}
\def\interest{{\sc interest}}
\def\bbf{}
%

\newcommand\aap{A\&A}                % Astronomy and Astrophysics
\let\astap=\aap                          % alternative shortcut
\newcommand\aapr{A\&ARv}             % Astronomy and Astrophysics Review (the)
\newcommand\aaps{A\&AS}              % Astronomy and Astrophysics Supplement Series
\newcommand\actaa{Acta Astron.}      % Acta Astronomica
\newcommand\afz{Afz}                 % Astrofizika
\newcommand\aj{AJ}                   % Astronomical Journal (the)
\newcommand\ao{Appl. Opt.}           % Applied Optics
\let\applopt=\ao                         % alternative shortcut
\newcommand\aplett{Astrophys.~Lett.} % Astrophysics Letters
\newcommand\apj{ApJ}                 % Astrophysical Journal
\newcommand\apjl{ApJ}                % Astrophysical Journal, Letters
\let\apjlett=\apjl                       % alternative shortcut
\newcommand\apjs{ApJS}               % Astrophysical Journal, Supplement
\let\apjsupp=\apjs                       % alternative shortcut
% The following journal does not appear to exist! Disabled.
%\newcommand\apspr{Astrophys.~Space~Phys.~Res.} % Astrophysics Space Physics Research
\newcommand\apss{Ap\&SS}             % Astrophysics and Space Science
\newcommand\araa{ARA\&A}             % Annual Review of Astronomy and Astrophysics
\newcommand\arep{Astron. Rep.}       % Astronomy Reports
\newcommand\aspc{ASP Conf. Ser.}     % ASP Conference Series
\newcommand\azh{Azh}                 % Astronomicheskii Zhurnal
\newcommand\baas{BAAS}               % Bulletin of the American Astronomical Society
\newcommand\bac{Bull. Astron. Inst. Czechoslovakia} % Bulletin of the Astronomical Institutes of Czechoslovakia
\newcommand\bain{Bull. Astron. Inst. Netherlands} % Bulletin Astronomical Institute of the Netherlands
\newcommand\caa{Chinese Astron. Astrophys.} % Chinese Astronomy and Astrophysics
\newcommand\cjaa{Chinese J.~Astron. Astrophys.} % Chinese Journal of Astronomy and Astrophysics
\newcommand\fcp{Fundamentals Cosmic Phys.}  % Fundamentals of Cosmic Physics
\newcommand\gca{Geochimica Cosmochimica Acta}   % Geochimica Cosmochimica Acta
\newcommand\grl{Geophys. Res. Lett.} % Geophysics Research Letters
\newcommand\iaucirc{IAU~Circ.}       % IAU Cirulars
\newcommand\icarus{Icarus}           % Icarus
\newcommand\japa{J.~Astrophys. Astron.} % Journal of Astrophysics and Astronomy
\newcommand\jcap{J.~Cosmology Astropart. Phys.} % Journal of Cosmology and Astroparticle Physics
\newcommand\jcp{J.~Chem.~Phys.}      % Journal of Chemical Physics
\newcommand\jgr{J.~Geophys.~Res.}    % Journal of Geophysics Research
\newcommand\jqsrt{J.~Quant. Spectrosc. Radiative Transfer} % Journal of Quantitiative Spectroscopy and Radiative Transfer
\newcommand\jrasc{J.~R.~Astron. Soc. Canada} % Journal of the RAS of Canada
\newcommand\memras{Mem.~RAS}         % Memoirs of the RAS
\newcommand\memsai{Mem. Soc. Astron. Italiana} % Memoire della Societa Astronomica Italiana
\newcommand\mnassa{MNASSA}           % Monthly Notes of the Astronomical Society of Southern Africa
\newcommand\mnras{MNRAS}             % Monthly Notices of the Royal Astronomical Society
%\newcommand\na{New~Astron.}          % New Astronomy
\newcommand\nar{New~Astron.~Rev.}    % New Astronomy Review
\newcommand\nat{Nature}              % Nature
\newcommand\nphysa{Nuclear Phys.~A}  % Nuclear Physics A
\newcommand\phdt{PhD.T}        % PhD Thesis
\newcommand\pra{Phys. Rev.~A}        % Physical Review A: General Physics
\newcommand\prb{Phys. Rev.~B}        % Physical Review B: Solid State
\newcommand\prc{Phys. Rev.~C}        % Physical Review C
\newcommand\prd{Phys. Rev.~D}        % Physical Review D
\newcommand\pre{Phys. Rev.~E}        % Physical Review E
\newcommand\prl{Phys. Rev.~Lett.}    % Physical Review Letters
\newcommand\pasa{Publ. Astron. Soc. Australia}  % Publications of the Astronomical Society of Australia
\newcommand\pasp{PASP}               % Publications of the Astronomical Society of the Pacific
\newcommand\pasj{PASJ}               % Publications of the Astronomical Society of Japan
\newcommand\physrep{Phys.~Rep.}      % Physics Reports
\newcommand\physscr{Phys.~Scr.}      % Physica Scripta
\newcommand\planss{Planet. Space~Sci.} % Planetary Space Science
\newcommand\procspie{Proc.~SPIE}     % Proceedings of the Society of Photo-Optical Instrumentation Engineers
\newcommand\rmxaa{Rev. Mex. Astron. Astrofis.} % Revista Mexicana de Astronomia y Astrofisica
\newcommand\qjras{QJRAS}             % Quarterly Journal of the RAS
\newcommand\sci{Science}             % Science
\newcommand\skytel{Sky \& Telesc.}   % Sky and Telescope
\newcommand\solphys{Sol.~Phys.}      % Solar Physics
\newcommand\sovast{Soviet~Ast.}      % Soviet Astronomy (aka Astronomy Reports)
\newcommand\ssr{Space Sci. Rev.}     % Space Science Reviews
\newcommand\zap{Z.~Astrophys.}       % Zeitschrift fuer Astrophysik

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

%%%%%
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
    %\vspace*{50\p@}%
    \vspace*{10\p@}%
    {\parindent \z@ \centering \reset@font
        \thickhrulefill\quad
        \scshape \@chapapp{} \thechapter
        \quad \thickhrulefill
        \par\nobreak
        \vspace*{10\p@}%
        \interlinepenalty\@M
        \hrule
        \vspace*{10\p@}%
        \Huge \bfseries #1\par\nobreak
        \par
        \vspace*{10\p@}%
        \hrule
        %\vskip 40\p@
        \vskip 100\p@
}}
\def\@makeschapterhead#1{%
    %\vspace*{50\p@}%
    \vspace*{10\p@}%
    {\parindent \z@ \centering \reset@font
        \thickhrulefill
        \par\nobreak
        \vspace*{10\p@}%
        \interlinepenalty\@M
        \hrule
        \vspace*{10\p@}%
        \Huge \bfseries #1\par\nobreak
        \par
        \vspace*{10\p@}%
        \hrule
        %\vskip 40\p@
        \vskip 100\p@
}}
%%%%%
\makeindex{}
\begin{document}
\pagestyle{plain}
\pagenumbering{roman}
\DeclareGraphicsExtensions{.pdf,.png,.gif,.jpg}
%----------------------------------------------------------------------------------
%               Title Page
%----------------------------------------------------------------------------------
\begin{titlepage}
    \begin{center}



    \textsc {\LARGE The University of NoWhere}\\[0.5cm]
    \textsc {\LARGE  \& }\\[0.5cm]
    \textsc{School of SomeWhere}\\[0.5cm]
    \LARGE PhD Thesis\\[0.5cm]

    % Title
    \HRule \\[0.4cm]
    { \huge \bfseries
My thesis title
}\\[0.4cm]
    \HRule \\[0.5cm]


% Author and supervisor
\begin{minipage}{0.45\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
Stranger
\end{flushleft}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\begin{flushright} \large
\emph{Supervisors:} \\
Prof. Z.\\
A/Prof. A \\
Dr. B.
\end{flushright}
\end{minipage}

\vfill

 \begin{minipage}{0.7\textwidth}
  \centering
  \includegraphics[width=1\textwidth]{./images/logo.png}
 \end{minipage} \\[0.5cm]

    % Bottom of the page
    {\large \today}

    \end{center}
\end{titlepage}

%----------------------------------------------------------------------------------
%               Preamble
%----------------------------------------------------------------------------------

\clearpage
\include{Preamble}
\cleardoublepage
\pagenumbering{arabic}


%----------------------------------------------------------------------------------
%               Content
%----------------------------------------------------------------------------------
\include{ChapterOne}
\include{ChapterTwo}
\include{ChapterThree}
\include{ChapterFour}
\include{ChapterFive}


\cleardoublepage
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{mnras}
\bibliography{library}
\appendix
\include{AppendixOne}
\include{AppendixTwo}
\include{AppendixThree}
\printindex{}
\end{document}
6
  • Compiling your example with pdflatex, I have the following error: ! Package pdftex.def Error: File ./images/logo.png' not found.` (which is normal since I don't have your file logo.png) When commenting out this, the compilation ends without error. Could you please be more explicit about your error?
    – jchd
    Commented Nov 26, 2019 at 8:36
  • I compiled it with pdflatex as you advised and it is compiled with no error! But still I can't see any header.
    – Soheil
    Commented Nov 26, 2019 at 8:54
  • There are hundreds of document classes called Thesis.cls (but none in standard distributions such as texlive) please link to the one you are using, I note you are using \rm which has not been defined by default in LaTeX since 1993, so if the error you get is that \rm and \sc are undefined, that would be why. Commented Nov 26, 2019 at 9:47
  • Unrelated but \usepackage[utf8,latin1]{inputenc} is nonsense. Your file can't have two input encodings at the same time. Commented Nov 26, 2019 at 11:02
  • 1
    You are using \pagestyle{plain}, and plain style has no header. Commented Nov 26, 2019 at 11:04

1 Answer 1

3

You are using \pagestyle{plain}, and plain style has no header.

You must log in to answer this question.

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