使用 `scrbook` 设置标题

使用 `scrbook` 设置标题

如何设置automark以便如果有部分则选择一个部分,如果没有部分则选择章节而不是空文本?

\documentclass[listof=totoc,bibliography=totoc,a5paper,7pt,openright,twoside=true]{scrbook}
\usepackage{blindtext}
\usepackage[headsepline=true, autooneside = false]{scrlayer-scrpage}
\AfterTOCHead{\pagestyle{plain}}
\AfterStartingTOC{\clearpage}

\pagestyle{scrheadings}
\lohead{\leftmark}
\lohead{}
\rohead{\rightmark}

\cofoot[]{}
\rofoot[\pagemark]{\pagemark}

\automark[section]{chapter}


\begin{document}
    \chapter{Test}
    \blindtext[20]
\end{document}

答案1

您可以使用

\automark[chapter]{chapter}
\automark*[section]{}

例子:

\documentclass[
  listof=totoc,bibliography=totoc,
  a5paper,
  fontsize=7pt,% changed!
  %openright,% default
  %twoside=true% default
]{scrbook}
\usepackage{blindtext}% only for dummy text
\usepackage[headsepline=true,
  %autooneside = false% not needed with the default twoside=true
]{scrlayer-scrpage}% sets page style scrheadings automatically
\AfterTOCHead{\pagestyle{plain}}
\AfterStartingTOC{\clearpage}

\automark[chapter]{chapter}
\automark*[section]{}

\begin{document}
\chapter{Test}
\Blindtext[20]
\Blinddocument
\end{document}

答案2

我想这可能就是你想要的:

\automark[chapter]{chapter}
\automark*[section]{section}

相关内容