I'm sorry if this has been asked before, but I haven't found an answer anywhere.
I'm currently writing my bachelor's thesis in LATEX and I'm having problems with my pagenumbering.
I'm using the package fancyhdr in an article. The first few items like the acknowledgement and the ToC etc should be numbered with roman numerals on the left/right side in the footer, just like in books. I was able to get roman numerals, but it stays centered. When I remove the complete footer still an arabic pagenumber remains in the centre.
\documentclass[a4paper,12pt,twoside]{article}
\usepackage[super,square,sort&compress]{natbib} %Zitierstil
\setcitestyle{nature} %Literaturstil
\bibliographystyle{unsrtnat} %Literatur sortiert nach Auftreten im Text
\usepackage{hyperref}
\usepackage[usenames, dvipsnames]{color}
\usepackage{ghsystem}
\usepackage[ngerman]{babel}
\usepackage{subfiles}
\usepackage{chemmacros}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage[version=4]{mhchem}
\usepackage{pdfpages}
\usepackage[utf8x]{inputenc}
\usepackage[labelfont={color=text,bf}]{caption}
\usepackage{cancel, caption, mathtools, subcaption, amsthm}
\usepackage[margin={0.10\paperwidth,0.1\paperheight}, heightrounded, bindingoffset=1cm]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{array}
\usepackage{microtype}
\usepackage{booktabs}
\usepackage{icomma}
\usepackage{bibgerm}
\usepackage{titling}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{float}
\usepackage{fancyhdr}
\usepackage{longtable}
\usepackage{multirow}
\usepackage[header]{appendix}
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------optionale Packages-------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\numberwithin{equation}{section}
\usepackage{lipsum} %Blindtext
\usepackage{blindtext} %Blindtext
\graphicspath{{images}{../images}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---------Zeilenabstand---------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\baselinestretch}{1.5}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------2. Listenebene---------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\labelitemii}{-}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------Farben-------------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{text}{RGB}{0,0,0}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------Schriftart-----------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\renewcommand{\familydefault}{\sfdefault}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-----------Titelseite----------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\thispagestyle{empty}
\input{Sections/titlepage}
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----Fußzeile & Nummerierung----%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagenumbering{roman} %Römische Seitenzahlen
\setcounter{page}{1} %Start der Nummerierung
\fancyfoot[C]{}
\fancyfoot[OR,EL]{\thepage} %O=odd, E=even
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-----------Danksagung----------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{Sections/acknowledgement}
Later on I did the same thing for the main body of the thesis, which worked fine.
It would be great if someone had an answer for me :) thank you!
EDIT:
I found a solution for the page numbers being centered on the toc. That's because the command \tableofcontents automatically resets to the plain pagestyle. You have to redefine the plain pagestyle:
\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[OR]{\thepage}
\fancyfoot[EL]{\thepage}
\renewcommand{\headrulewidth}{0pt}
}
In combination with the other answers I was able to get it right! Thanks everyone for your help!
hyperref
way too early. it should be loaded last, cf. Which packages should be loaded afterhyperref
instead of before?\pagestyle{fancy}
after changing the footer.