我有一份双面文档,当我添加
\cleardoubleoddpage
\thispagestyle{scrheadings}
生成的空白页没有像之前的页面那样的页眉。
我怎样才能获取这个新页面上的标题?
梅威瑟:
\documentclass[twoside, openany]{scrreprt}
\usepackage{geometry}
\geometry{a4paper, includefoot, include head}
\usepackage[headsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles
\makeatletter \let\ps@plain\ps@scrheadings \makeatother
\ihead{\headmark}
\automark*{chapter} \automark*[section]{}
\ohead{\pagemark}
\usepackage{lipsum}
\begin{document}
\chapter{Test}
\section{Test}
\lipsum
\cleardoubleoddpage
\thispagestyle{scrheadings}
\chapter{Test 2}
\section{Test 2}
\lipsum
\end{document}
这是我的第一个 MWE,如果有任何缺失或者太多,请告诉我。
答案1
KOMA-Script 类cleardoublepage=empty
默认使用选项。因此,通过\cleardoublepage
或\cleardoubleoddpage
等插入的空白页将获得页面样式empty
。
cleardoublepage=current
您可以使用选项或全局更改此行为cleardoublepage=<pagestyle>
,例如cleardoublepage=scrheadings
:
\documentclass[twoside,open=any,cleardoublepage=current]{scrreprt}% or cleardoublepage=scrheadings
或者
\documentclass[twoside,open=any]{scrreprt}
\KOMAoptions{cleardoublepage=scrheadings}% or cleardoublepage=current
如果只有一个空白页应该使用不同的页面样式,请用\cleardoubleoddpage
或\cleardoubleoddstandardpage
替换\cleardoubleoddpageusingstyle{scrheadings}
。
补充说明:
\automark*{chapter} \automark*[section]{}
作用相同
\automark[section]{chapter}
也许你想要
\automark[chapter]{chapter}
\automark*[section]{}
删除的重新定义\ps@plain
。
也许你想要
\renewcommand*{\chapterpagestyle}{scrheadings}% chapter pages get style scrheadings
或者
\usepackage[headsepline,plainheadsepline]{scrlayer-scrpage}% sets page style scrheadings automatically
\automark[chapter]{chapter}
\automark*[section]{}
\clearpairofpagestyles
\ihead*{\headmark}% or \ihead[\headmark]{\headmark}, ie. same content for plain.scrheadings and scrheadings
\ohead*{\pagemark}% or \ohead[\pagemark]{\pagemark}, ie. same content for plain.scrheadings and scrheadings
例子:
\documentclass[twoside, open=any,headinclude,footinclude,cleardoublepage=current]{scrreprt}
\usepackage[automark,headsepline,plainheadsepline]{scrlayer-scrpage}% sets page style scrheadings automatically
\clearpairofpagestyles
\ihead*{\headmark}% or \ihead[\headmark]{\headmark}, ie. same content for plain.scrheadings and scrheadings
\ohead*{\pagemark}% or \ohead[\pagemark]{\pagemark}, ie. same content for plain.scrheadings and scrheadings
\usepackage{lipsum}
\begin{document}
\chapter{Test}
\section{Test}
\lipsum[1-2]
\cleardoubleoddpage
\chapter{Test 2}
\section{Test 2}
\lipsum[1-10]
\end{document}