# Hidden \chapter* in header using scrpage2

How can I include a "hidden" \section*{} or \chapter*{} in the header (centered) using scrpage2?

  \documentclass[a4paper,12pt]{scrbook}
\usepackage[T1]{fontenc}

\usepackage[automark]{scrpage2}
\automark[chapter*]{section*}  %%leftpageheader: chapter* / rightpagehaeder: section*
\begin{document}
\chapter*{Bla}

\pagebreak

\section*{Blub}

\end{document}

• Do you just want unnumbered chapers and sections? Dec 22 '17 at 14:10
• Yes. unnumbered Dec 22 '17 at 14:14
• Do you use \chapter* here to have an unnumbered chapter or to prevent the chapter from being in toc (or both)? Dec 22 '17 at 15:05
• @TeXnician I just don't want any numbers. (but I want other parts of the book with numbered chapters as well) Dec 22 '17 at 15:08
• Please note: scrpage2 is obsolete. You should use scrlayer-scrpage instead of scrpage2. Dec 22 '17 at 15:22

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}
\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}
\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}
\usepackage{blindtext}
\begin{document}

\Blindtext[10]

\end{document}


If you want to avoid the ToC entries:

\documentclass[a4paper,12pt,headings=optiontotoc]{scrbook}
\usepackage[T1]{fontenc}

\usepackage[automark]{scrpage2}
\usepackage{blindtext}
\begin{document}
\tableofcontents

\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}
\usepackage{blindtext}
\begin{document}
\tableofcontents

\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.

• Thank you @Schweinebacke – but what if I want numbered and unnumbered \chapterin the same document (like an unnumbered appendix)? Dec 22 '17 at 15:10
• @לאהפּאַסטעך See the additional examples. Dec 22 '17 at 15:20
• Thank you both! the addchap / addsec command is new to me, but much better than the "old" \chapter* And thanks for the information that scrpage2is obsolete! Dec 22 '17 at 15:30

As your intention is to get unnumbered sections or chapters you can use KOMA's commands \addchap and \addsec which will produce unnumbered headings, but set the head marks and add the title to toc.

\documentclass[a4paper,12pt]{scrbook}
\usepackage[T1]{fontenc}

\usepackage[automark]{scrpage2}

• Thank you! I think using \addchapis the best idea here! Dec 22 '17 at 15:31