使用文档类“scrbook”中的值“index=numbered”,我将本例中的章节标题从“MyIndex”更改为“2 MyIndex”。在页眉中仍然打印“MyIndex”而不是“2 MyIndex”。除非 markboth 命令在这里不起作用,否则我该如何在使用 Koma Script 时修复此问题。
\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}