How to remove the section title in header using scrpage2

I would like to remove the section title (header) in the appendix:

\documentclass[headsepline, open=right,twoside=true, numbers=noenddot]{scrreprt}

\usepackage[english]{babel}
\usepackage{scrpage2}
\usepackage{blindtext}

\clearscrheadfoot
\ihead{\headmark}
\ohead[\pagemark]{\pagemark}
\automark[section]{chapter}
\pagestyle{scrheadings}
\renewcommand*{\chapterpagestyle}{empty}

\begin{document}

\begin{appendix}

\chapter{Appendix}
\section{Remove the section title}
\blindtext[12]

\end{appendix}

\end{document}


I'm looking for something like \renewcommand*{\sectionmarkformat}{} except I want to keep the number and remove the title.

2 Answers

If the KOMA-Script option appendixprefix is not used:

\newcommand*{\appendixmore}{%
\renewcommand\sectionmark[1]{%
\markright{\ifnumbered{section}{\thesection\autodot}{}}%
}}


Using \ifnumbered avoids a wrong number in the header if there is an unnumbered section.

Note \appendix is not an environment. The package scrpage2 is depreciated. Use scrlayer-scrpage instead.

\documentclass[headsepline,twoside, numbers=noenddot]{scrreprt}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\headmark}
\ohead[\pagemark]{\pagemark}
\automark[section]{chapter}
\renewcommand*{\chapterpagestyle}{empty}
\newcommand*{\appendixmore}{%
\renewcommand\sectionmark[1]{%
\markright{\ifnumbered{section}{\thesection\autodot}{}}%
}}

\begin{document}
\appendix
\chapter{Appendix}
\section{Remove the section title}
\blindtext[30]
\addsec{Unnumbered section}
\blindtext[12]
\end{document}

• Maybe my question was unclear. I would like to keep the section number. In my example I would like to keep the A.1 and just remove the Remove the section title. Dec 7 '14 at 21:02
• I have changed my answer.
– esdd
Dec 7 '14 at 22:19
• @esdd I am sorry, but how can I totally remove page headers using scrbook and scrlayer-scrpage?
– Diaa
Dec 8 '16 at 3:29
– esdd
Dec 8 '16 at 7:09
• @esdd I am sorry, but I meant for the whole document. I found that plain.scrheadings option of scrlayer-scrpage did what I want, am I right? or should it be done another way?
– Diaa
Dec 8 '16 at 8:31

I also suggest the use of scrlayer-scrpage instead of scrpage2....

About your question, you can issue

\lohead{\thesection\autodot}


just after

\chapter{Appendix}


to obtain what you want.

MWE

\documentclass[headsepline, open=right,twoside=true, numbers=noenddot]{scrreprt}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\headmark}
\ohead[\pagemark]{\pagemark}
\automark[section]{chapter}
\renewcommand*{\chapterpagestyle}{empty}

\begin{document}

\chapter{Test}
\section{Here I want the headers}
\blindtext[12]

\appendix

\chapter{Appendix}
\lohead{\thesection\autodot}

\section{Remove the section title}
\blindtext[12]

\end{document}


Output