[Tex/LaTex] List of Figures and List of Tables do not show fancyhdr

fancyhdrincompatibilitytable of contents

I'm currently writing my Bachelor's Thesis and have already used LateX for several documents and reports so far. However, I cam across a problem during formatting my thesis. Throughout my whole work I want to use fancyhdr which gives me a horizontal line in the header of each page with the page numbering on the right upper corner (my thesis will be printed onesided).
Everything works fine besides the page numbering of my LOF and LOT. There the page numbering is on the bottom page in the middle (the default setting I think). After those two pages the page numbering is according to my wishes again.

\documentclass[a4paper,12pt]{scrartcl}
\usepackage{tocloft}
\usepackage[english]{babel}
\usepackage{titlesec}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rhead{\thepage}
\begin{document}
\end{document}
\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\newpage
\listoftables
\addcontentsline{toc}{section}{List of Tables}
\newpage

What could possibly be the problem?

Best Answer

It is not recommanded to use titlesec, tocloft or fancyhdr together with a KOMA-Script class. Here is a suggestion using scrlayer-scrpage:

\documentclass[a4paper,12pt,
  listof=totoc% <- added
]{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[headsepline,manualmark]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}

\begin{document}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\blinddocument
\end{document}

Note that package tocloft destroys the features of option listof. Additionally you have to define a matching plain style:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[headsepline,plainheadsepline,manualmark]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead*{\pagemark}

\usepackage{tocloft}

\begin{document}
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\cleardoublepage
\addcontentsline{toc}{section}{List of Figures}
\listoftables
\clearpage
\blinddocument
\end{document}

Or you have to set \tocloftpagestyle{scrheadings}:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[headsepline,manualmark]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}

\usepackage{tocloft}
\tocloftpagestyle{scrheadings}

\begin{document}
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\cleardoublepage
\addcontentsline{toc}{section}{List of Figures}
\listoftables
\clearpage
\blinddocument
\end{document}