I'm using the scrbook class from the KOMA-Script bundle, and I've run into a problem when using longtable.
When I use a normal tabular environment that spans multiple pages, everything works fine — the running head (e.g., chapter title in the page header) is displayed correctly.
However, when I use the longtable environment for tables that span multiple pages, the running head on the second and following pages displays the chapter title from the previous chapter, not the current one. It seems like longtable is interfering with how KOMA-Script determines the running head content.
Here is a minimal working example (MWE)
\documentclass[english,twoside,headsepline]{scrbook} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{longtable} \begin{document} \frontmatter \addchap{Addchap 1} \begin{tabular}{|c|c|} \hline Simple Table Entry & \\ \hline & \\ % ... repeated rows ... \hline \end{tabular} \mainmatter \addchap{Addchap 2} \begin{longtable}{|c|c|} \hline Long Table Entry & \\ \hline & \\ % ... enough rows to span multiple pages ... \hline \end{longtable} \end{document} - Using \markboth{Addchap 2}{Addchap 2} before the longtable, didn't fix it.
- Loading scrlayer-scrpage with \ihead{\leftmark}, the problem persists.
- Changing to \mainmatter before the second chapter, no effect
What I’m asking
- Is this a known incompatibility between KOMA-Script and longtable?
- Is there a workaround or recommended way to ensure the running head reflects the correct chapter when longtable spans multiple pages?