Menu

#52 Numbered Index in Page Head

KOMA-Script 3.41
closed
2023-05-05
2023-05-05
Harald Jele
No

With the value "index=numbered" within the document class "scrbook" I changed the chapter head in this example from "MyIndex" to "2 MyIndex". In the pagehead there is still "MyIndex" printed instead of "2 MyIndex". How can I fix this when using Koma Script unless the markboth command does not help here.

\documentclass[
    10pt,
    twoside,
    toc=listofnumbered,
    listof=flat,
    headinclude,
    footinclude,
    index=numbered,
    usegeometry
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{makeidx}

\usepackage[headsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
\ohead{\headmark}
\automark[section]{chapter}
\setkomafont{pagehead}{\upshape\sffamily\small}
\addtokomafont{pagenumber}{\sffamily\small}

\addto\captionsngerman{
    \def\indexname{MyIndex}%
    }
\makeindex
\makeatother

\begin{document}
\chapter{MyFirstPage}
Foo \index{foo}

Moo \index{moo}
\printindex%\markboth{Huhu}{Huhu} %this does not work here
\end{document}
1 Attachments

Discussion

  • Markus Kohm

    Markus Kohm - 2023-05-05
    • labels: header-footer index --> scrbook, index, pagestyle
    • assigned_to: Markus Kohm
     
  • Markus Kohm

    Markus Kohm - 2023-05-05

    Seems indeed to be one more bug with the index. It is not limited to scrbook, but also occurs with scrreprt and scrartcl, if \pagestyle{headings} is used.

    Thank you for reporting it.

    Just a note: The example could be reduced a lot, because neither scrlayer-scrpage nor changing captions is needed to show the problem:

    \documentclass[index=numbered]{scrbook}
    \usepackage[T1]{fontenc}
    \usepackage{makeidx}
    \makeindex
    
    \begin{document}
    \chapter{MyFirstPage}
    Foo \index{foo}
    
    Moo \index{moo}
    
    \printindex%\markboth{Huhu}{Huhu} %this does not work here
    \newpage
    Still part of the index.
    \newpage
    Still part of the index.
    
    \end{document}
    

    Just a workaround would be:

    \documentclass[index=numbered]{scrbook}
    \usepackage[T1]{fontenc}
    \usepackage{makeidx}
    \makeindex
    
    \begin{document}
    \chapter{MyFirstPage}
    Foo \index{foo}
    
    Moo \index{moo}
    
    \setindexpreamble{\chaptermark{\indexname}}%
    \printindex%\markboth{Huhu}{Huhu} %this does not work here
    \newpage
    Still part of the index.
    \newpage
    Still part of the index.
    
    \end{document}
    

    BTW: You've one unwanted space in your redefinition \captionsngermanHow to avoid unwanted spaces in the output or Wie unerwünschte Leerzeichen in der Ausgabe vermieden werden.

     

    Related

    Wiki (Deutsch): HowTo_AvoidSpaces
    Wiki (English): HowTo_AvoidSpaces


    Last edit: Markus Kohm 2023-06-07
  • Markus Kohm

    Markus Kohm - 2023-05-05

    Issue has been fixed in [r4052].

    For test files of several index option combinations see [r4053].

     

    Related

    Commit: [r4052]
    Commit: [r4053]

  • Markus Kohm

    Markus Kohm - 2023-05-05
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.