scrbook
like book
does not provide automatic running head for \chapter*
and \section*
. If everything should be unnumbered, set \secnumdepth
to -2 and use \chapter
and \section
instead of \chapter*
and \section*
:
\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\chead{\headmark}
\ohead{\pagemark}
\setcounter{secnumdepth}{-2}%
\usepackage{blindtext}
\begin{document}
\chapter{Bla}
\section{Blub}
\Blindtext[10]
\end{document}
If you have numbered and not numbered chapters and section, you can use:
\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\chead{\headmark}
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\chapter*{Bla}
\markboth{\MakeUppercase{Bla}}{}
\section{Blub}
\markright{\MakeUppercase{Blub}}
\Blindtext[10]
\end{document}
But using scrbook
it is more easy to use \addchap
and \addsec
:
\documentclass[a4paper,12pt]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\chead{\headmark}
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\addchap{Bla}
\addsec{Blub}
\Blindtext[10]
\end{document}
If you want to avoid the ToC entries:
\documentclass[a4paper,12pt,headings=optiontotoc]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\chead{\headmark}
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\addchap[]{Bla}
\addsec[]{Blub}
\Blindtext[10]
\end{document}
And please note, that scrpage2
is obsolete. You should use scrlayer-scrpage
:
\documentclass[a4paper,12pt,headings=optiontotoc]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[automark]{scrlayer-scrpage}
\chead{\headmark}
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\addchap[]{Bla}
\addsec[]{Blub}
\Blindtext[10]
\end{document}
See the KOMA-Script manual or the German KOMA-Script manual or the German KOMA-Script book for more information about scrlayer-scrpage
, \addchap
, \addsec
and option headings
.
\chapter*
here to have an unnumbered chapter or to prevent the chapter from being in toc (or both)?scrpage2
is obsolete. You should usescrlayer-scrpage
instead ofscrpage2
.