0

How do I get author, title and chapter title (Example 1.Introduction) in the header and page number on the right side of the footer.

\documentclass[a4paper,12pt]{report} 

\usepackage{geometry}
\geometry{margin=2.00cm}
\usepackage{pdfpages}
\usepackage{dirtytalk}
\usepackage{fancyhdr}
\usepackage{newcent}
\usepackage{setspace}
\usepackage{epigraph}
\usepackage{csvsimple}
\usepackage{sectsty}
\allsectionsfont{\sffamily}

%\singlespacing
\onehalfspacing

\newtheorem{hypothesis}{Hypothesis}
\newtheorem{nullhypothesis}{Null Hypothesis}

\usepackage[linktoc=all]{hyperref}
\hypersetup{
    colorlinks   = true,    % Colours links instead of ugly boxes
    urlcolor     = black,    % Colour for external hyperlinks
    linkcolor    = black,    % Colour of internal links
    citecolor    = red      % Colour of citations
}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{natbib}
\usepackage{amsmath}
\usepackage[font={small,it}]{caption}
\addto\captionsenglish{\renewcommand{\figurename}{Fig.}}
%images
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[export]{adjustbox}
\newcommand\cites[1]{\citeauthor{#1}'s\ (\citeyear{#1})}

%\captionsetup{justification=raggedright,singlelinecheck=false}
\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage{bchart}
\usepackage{pgfplots}
\usepackage{todonotes}
\title{xx}
\author{xx}

\pagestyle{fancy}
\lhead{\author{xxx}}
\chead{\title{xx}
\rhead{\leftmark}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}} 

%put chapter and title on same line
\usepackage{titlesec}
\titleformat{\chapter}[hang] 
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}

\begin{document}


\maketitle 
\tableofcontents  
\listoffigures 
\listoftables 
\include{introduction} 


\chapter{Appendix}

\bibliography{sources}
\bibliographystyle{apalike}
\end{document}
2

1 Answer 1

1

Here is a solution, based on titleps and titling, which defines the commands \theauthor and \thetitle for a later use. Since you load titlesec it suffices to add the [pagestyles] option:

\documentclass[a4paper,12pt,english]{report}

\usepackage{geometry}
\geometry{margin=2.00cm}
\usepackage{pdfpages}
\usepackage{dirtytalk}
\usepackage{newcent}
\usepackage{setspace}
\usepackage{epigraph}
\usepackage{csvsimple}
\usepackage{sectsty}
\allsectionsfont{\sffamily}

%\singlespacing
\onehalfspacing

\newtheorem{hypothesis}{Hypothesis}
\newtheorem{nullhypothesis}{Null Hypothesis}

\usepackage[linktoc=all]{hyperref}
\hypersetup{
    colorlinks = true, % Colours links instead of ugly boxes
    urlcolor = black, % Colour for external hyperlinks
    linkcolor = black, % Colour of internal links
    citecolor = red % Colour of citations
}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\usepackage{natbib}
\usepackage{amsmath}
\usepackage[font={small,it}]{caption}
\addto\captionsenglish{\renewcommand{\figurename}{Fig.}}
%images
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[export]{adjustbox}
\newcommand\cites[1]{\citeauthor{#1}'s\ (\citeyear{#1})}

%\captionsetup{justification=raggedright,singlelinecheck=false}
\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage{bchart}
\usepackage{pgfplots}
\usepackage{todonotes}

\usepackage{titling}
\title{Ventriloquist Cat}
\author{TeX Avery}
\keepthetitle

%put chapter and title on same line, and use titleps for headers and footers
\usepackage[pagestyles]{titlesec}
\titleformat{\chapter}[hang]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}
\makeatletter
 \newpagestyle{mystyle}{%
 \headrule
 \sethead{\author{TeX Avery}}{\title{Ventriloquist Cat}}{\thechapter.~\MakeUppercase{\chaptertitle}}
 \setfoot{}{}{\thepage} }%
 \makeatother

 \renewpagestyle{plain}{%
 \setfoot{}{}{\thepage}}

 \pagestyle{mystyle}
\usepackage{lipsum}

\begin{document}


\maketitle
\tableofcontents
\listoffigures
\listoftables
\chapter{introduction}
\lipsum

\chapter{Appendix}
\lipsum

\bibliography{sources}
\bibliographystyle{apalike}

\end{document} 

enter image description here

You must log in to answer this question.

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