2

I am making a thesis in LaTeX with \documentclass{scrreprt}. The \usepackage{fancyhdr} is loaded and customized. Default settings of page number I think is \pagestyle{plain} by report, which automatically adds page numbers in the bottom center of every page. Right now I have two problems which I can not resolve:

  1. I have removed the page numbers on chapter ackownlegement and abstract with \pagestyle{empty}; however, for the toc/ list of figure and table, \pagestyle{empty} and \thispagestyle{empty} do not work. I still have the plain style. Why are they not working? I want to remove the numbers on toc and list of Figure/Table

  2. I tried to use the fancy pagestyle (in preamble and in separate .tex) to change the rest of documents/pages starting 1. chapter introduction. Most of pages are correct but the starting page of every new chapter is still in \pagestyle{plain}. How could i change them into \pagestyle{fancy}?

This a minimum working example in my preamble:

    \documentclass[a4paper,12pt]{scrreprt}
    \usepackage[left= 2.5cm,right = 2.5cm, top = 2.5cm, bottom = 2 cm]{geometry}
    \renewcommand*{\chapterformat}{\thechapter\hspace{4mm}}
    \usepackage{fontspec}
    \setmainfont{Times New Roman}
    \usepackage{sectsty}
    \setsansfont{Times New Roman}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{graphicx, subfig}
    \usepackage{fancyhdr}
    \usepackage{tabularx}
    \usepackage{lmodern}
    \usepackage{enumitem}
    \usepackage{emptypage}
    \usepackage[subfigure]{tocloft}
    \usepackage{amsfonts}
    \usepackage{amsmath}

    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
    \fancyhf{}
    \rhead{Page \thepage}
    \lhead{\leftmark}
    \renewcommand{\headrulewidth}{0.4pt}

    \begin{document}

    \pagestyle{empty}
    \include{01_title}
    \include{02_acknowlegements}
    \include{03_abstract}

    %\newpage
    \pagestyle{empty}
    \thispagestyle{empty}
    \tableofcontents

    \newpage
    \pagestyle{empty}
    \thispagestyle{empty}
    \listoffigures

    \newpage
    \pagestyle{empty}
    \thispagestyle{empty}
    \listoftables

    \pagestyle{fancy}
    \thispagestyle{fancy}
    \include{04_introduction}

    \end{document}

and in the introduction.tex i start with:

\chapter{Introduction}
\section{Motivation and Purpose of the Thesis}
.......

in the following sreenshots you can see the fancy pagestyle i managed to achieve on the rest pages except the starting pages of new chapters:

enter image description here

enter image description here

1 Answer 1

2

Do not use packages sectsty, tocloft and fancyhdr with a KOMA-Script class. Package emptypage is not needed with a KOMA-Script class. Package fontspec requires either XeTeX or LuaTeX. Do not use package inputenc with XeTeX or LuaTeX. With an uptodate TeX distribution it is not needed at all. Your Times New Roman selection is overwritten by package lmodern.

I would suggest to use KOMA-Script package scrlayer-scrpage for page header and footer:

\usepackage[automark,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}
\ihead{\leftmark}
\renewcommand\chaptermarkformat{\thechapter.\ }
\renewcommand\pagemark{\usekomafont{pagenumber}Page \thepage}
\addtokomafont{pagehead}{\normalfont}

\AddToLayerPageStyleOptions{empty}{onselect=\renewcommand\chapterpagestyle{empty}}
\AddToLayerPageStyleOptions{scrheadings}{onselect=\renewcommand\chapterpagestyle{scrheadings}}

Example:

\documentclass[12pt]{scrreprt}
\usepackage[margin = 2.5cm, bottom = 2 cm]{geometry}
\renewcommand*{\chapterformat}{\thechapter\hspace{4mm}}
\usepackage{fontspec}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{amsfonts}
\usepackage{amsmath}

\usepackage[automark,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}
\ihead{\leftmark}
\renewcommand\chaptermarkformat{\thechapter.\ }
\renewcommand\pagemark{\usekomafont{pagenumber}Page \thepage}
\addtokomafont{pagehead}{\normalfont}

\AddToLayerPageStyleOptions{empty}{onselect=\renewcommand\chapterpagestyle{empty}}
\AddToLayerPageStyleOptions{scrheadings}{onselect=\renewcommand\chapterpagestyle{scrheadings}}

\usepackage{blindtext}
\begin{document}

\pagestyle{empty}
\chapter{Title}\blindtext
\chapter{Acknowledgements}\blindtext
\chapter{Abstract}\blindtext

\tableofcontents
\listoffigures
\listoftables

\cleardoublepage
\pagestyle{scrheadings}
\Blinddocument
\end{document}

enter image description here


If you really want to use package fancyhdr then redefine \chapterpagestyle when you change the page style:

\documentclass[12pt]{scrreprt}
\usepackage[margin = 2.5cm, bottom = 2 cm]{geometry}
\renewcommand*{\chapterformat}{\thechapter\hspace{4mm}}
\usepackage{fontspec}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage{amsfonts}
\usepackage{amsmath}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\fancyhf{}
\rhead{Page \thepage}
\lhead{\leftmark}
\renewcommand{\headrulewidth}{0.4pt}

\usepackage{blindtext}
\begin{document}

\pagestyle{empty}\renewcommand\chapterpagestyle{empty}
\chapter{Title}\blindtext
\chapter{Acknowledgements}\blindtext
\chapter{Abstract}\blindtext

\tableofcontents
\listoffigures
\listoftables

\cleardoublepage
\pagestyle{fancy}\renewcommand\chapterpagestyle{fancy}
\Blinddocument
\end{document}

You must log in to answer this question.

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