如何在 KOMA 脚本中显示“此页故意留空。”

如何在 KOMA 脚本中显示“此页故意留空。”

这个问题是问题的后续

如何制作“故意留空”的页面?

那里接受的解决方案

\documentclass[openright]{scrbook}
\newcommand*{\blankpage}{%
\vspace*{\fill}
\centering This page would be intentionally left blank if we would not wish to inform about that.
\vspace{\fill}}
\makeatletter
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\blankpage
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
\begin{document}
Text
\chapter{First chapter}
\end{document}

确实插入空白页警告,但仅此而已\mainmatter\frontmatter\appendix并且\backmatter没有空白页警告。

有什么方法可以调整此解决方案以便它会为整个文档产生空白页警告?

答案1

使用scrbook重新定义的命令是\cleardoubleoddstandardpage

\documentclass[openright]{scrbook}

\newcommand*{\blankpage}{%
  \par\vspace*{\fill}%
  {\centering This page would be intentionally left blank
   if we would not wish to inform about that.\par}
  \vspace{\fill}%
}
\makeatletter
\renewcommand*{\cleardoubleoddstandardpage}{%
  \clearpage
  \if@twoside
    \ifodd\c@page
    \else
      \blankpage
      \thispagestyle{empty}%
      \newpage
      \if@twocolumn\hbox{}\newpage\fi
    \fi
  \fi
}
\makeatother

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{First chapter}

\chapter{Second chapter}

\end{document}

答案2

您可以使用包scrlayer和 KOMA 选项为这些页面定义特殊的页面样式cleardoublepage=<pagestyle>

\documentclass[open=right]{scrbook}

\newcommand*{\blankpage}{%
  \par\vspace*{\fill}%
  {\centering This page would be intentionally left blank
   if we would not wish to inform about that.\par}
  \vspace{\fill}%
}

\usepackage{scrlayer}
\DeclareNewLayer[
    foreground,
    textarea,
    contents=\blankpage
  ]{blankpage.fg}
\DeclarePageStyleByLayers{blank}{blankpage.fg}
\KOMAoptions{cleardoublepage=blank}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{First chapter}
\chapter{Second chapter}
\end{document}

如果通过命令插入空白页\cleardoubleevenpage或切换到,这也会起作用open=left

相关内容