1

I am trying to make a two-sided document with section names in the header of even numbered pages, and subsection names on odd numbered pages. The odd numbered pages on which my sections start shall feature no section name in the header. All this works well in the code below.

My problem is that it does not work for the table of contents. How can I disable the dislay of "Contents" in the header of the page on which the TOC starts? The same happens with the bibliography section.

\documentclass[12pt,a4paper,twoside]{scrartcl}
\usepackage[automark, headsepline]{scrlayer-scrpage}
\ihead*{\pagemark}
\begin{document}
\begin{titlepage} Title
\end{titlepage}
\thispagestyle{empty}
\mbox{}
\newpage
\mbox{}
\tableofcontents
\newpage
\thispagestyle{empty}
\mbox{}
\newpage
\section{Section}
\subsection{Subsection 1}
\newpage
\subsection{Subsection 2}
\newpage
\mbox{}
\newpage
\end{document}

EDIT: It turns out that I could fix the problem by defining a custom pagestyle, and using that for the first page of TOC and bibliography. In particular I defined

\defpagestyle{mystyle}{{\headmark\hfill\pagemark}{\pagemark}{}}{}

which generates a header that does not include the headmark on odd numbered pages.

1 Answer 1

0

Sections in a twoside scrartcl document with option automark sets the left mark and cleans the right mark. So the first right mark on that pages in your document is empty and therefore \headmark is empty on this pages. \tableofcontents sets both the left and the right mark to the \contentsname. Therefore \headmark is not empty on the first page of the ToC in your MWE.

You can use page style plain on pages that should not have \headmark in header.

Example:

\documentclass[12pt,a4paper,twoside]{scrartcl}
\usepackage{blindtext}% only for dummy text
\usepackage[automark,headsepline,plainheadsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\headmark}
\ihead*{\pagemark}
\AddToHook{cmd/section/before}{%
  \cleardoubleoddpage% start sections on odd pages
  \thispagestyle{plain}% use page style plain on section pages
}

\begin{document}
\begin{titlepage} Title \end{titlepage}
\tableofcontents
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\end{document}

enter image description here

enter image description here


Remark: I would suggest to use either scrreprt or scrbook.

Example:

\documentclass[12pt,a4paper,twoside,open=right]{scrreprt}
\usepackage{blindtext}% only for dummy text
\usepackage[automark,headsepline,plainheadsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\headmark}
\ihead*{\pagemark}

\begin{document}
\begin{titlepage} Title \end{titlepage}
\tableofcontents
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument\Blinddocument
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .