# Only show header if section number > 0

The current section name + chapter.section number is shown in the header. This is normal behaviour (what I want).

Example:

How can I remove the header text, if there is no section on the page. The following example illustrate my problem. The header is "1.0" but I want to show nothing.

Example:

Here my MWE:

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}

\begin{document}

\chapter{An example chapter}

\blindtext[25]

\section{An example section}

\blindtext
\end{document}


Using fancyhdr with scrbook is not recommended. However, here's a solution: issue the \thesection command within \markright. Note that \markright takes only one argument (whereas \markboth needs two).

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{lipsum}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{#1\ \thesection}%
}

\fancyhf{}