I would like the section to be displayed in the header using \automark
. However, if a chapter does not include a section I would like the chapter to be diplayed in the header.
How do I achieve that?
\documentclass[a4paper,headsepline,numbers=noenddot]{scrreprt}
\usepackage[english]{babel}
\usepackage{scrlayer-scrpage}
\usepackage{blindtext}
\renewcommand*{\chapterpagestyle}{empty}
\clearpairofpagestyles
\ihead{\headmark}
\ohead[]{\pagemark}
\automark[]{section}
\begin{document}
\chapter{Chapter 1}
\blindtext[10]
\chapter{Chapter 2}
\blindtext[12]
\section{Section 1}
\blindtext[14]
\chapter{Chapter 3}
\blindtext[10]
\end{document}