KOMAscript:如何“刷新底部”部分标题页的序言?

KOMAscript:如何“刷新底部”部分标题页的序言?

语境:我正在使用该类scrbook。部分标题打印在空白页上,然后下一个内容从新页开始。
但是,KOMAscript 提供了\setpartpreamble[<position>]{<text>}允许在部分标题页上打印一些文本的命令。<position>要么o在标题上方插入文本,要么u在标题下方插入文本。

文档明确指出:

请注意谁负责标题、序言和后续文本之间的空白。

问题:我想将插入在标题下方的序言“对齐底部”(后者是顶部对齐的)。但是,我既无法在\vspace*{\fill}序言文本的开头插入,也无法修改部分标题下方的空间,如下所示\renewcommand{\partheadendvskip}{\vskip\fill\newpage}。(我想象“标题和序言之间的空白由你负责“ 表示“\partheadendvskip在添加可预置项时不会被考虑”)

问题:如何将部分标题页中的序言底部对齐scrbook


在此处输入图片描述

\documentclass[open any]{scrbook}
    \usepackage{lipsum}
    \usepackage{showframe}

    \renewcommand{\partheadstartvskip}{\null}% removes vertical space before part title
    \renewcommand{\partheadendvskip}{\vskip\fill\newpage}% no effect
\begin{document}
    \setpartpreamble[u]{
        %\vspace*{\fill}% <-- has no effet
        This text comes after the part title, but on the same page.
        I would like to ``flushbottom'' it, i.e.\@ I want it to be aligned with the bottom of the text area.
    }
    \part{Part title}
    \lipsum
\end{document}

答案1

部分序言的内容设置在\parbox,因此齐平底部似乎是不可能的。

也许您正在使用scrlayer-scrpage页眉和页脚?那么您可以为部分页面定义一个新的页面样式,并使用添加到此页面样式的新图层插入您的序言。

\documentclass[open=any]{scrbook}
\usepackage{lipsum}
\usepackage{showframe}

\RedeclareSectionCommand[
  beforeskip=0pt
]{part}

\usepackage{xpatch}
\usepackage{scrlayer-scrpage}
\DeclareNewLayer[
  textarea,
  foreground,
  contents=\vfill\mypartpreamble
]{partpreamble}
\DeclareNewPageStyleByLayers{partpage}{partpreamble}
\ForEachLayerOfPageStyle{plain.scrheadings}{%
    \AddLayersToPageStyle{partpage}{#1}%
}
\renewcommand\partpagestyle{partpage}

\makeatother
\newcommand\mypartpreamble{}
\newcommand\setmypartpreamble[1]{\def\mypartpreamble{#1}}
\xapptocmd{\partheademptypage}{\setmypartpreamble{}}{}{}

\begin{document}
    \part{Part title without Preamble}
    \lipsum

    \setmypartpreamble{
        This text comes after the part title, but on the same page.
        I would like to ``flushbottom'' it, i.e.\@ I want it to be aligned with the bottom of the text area.
    }
    \part{Part title with Preamble}
    \lipsum

    \part{Part tile without Preamble}
    \lipsum
\end{document}

在此处输入图片描述


scrlayer-scrpage基于包scrlayer

也可以只scrlayer在部分页面上使用特殊页面样式的包。那么您可能需要为页码声明一个额外的层。

示例没有任何其他用于页眉和页脚的包,但包含\pagestyle{headings}

\documentclass[open=any,footlines=1]{scrbook}
%\providecommand*\Ifthispageodd{\ifthispageodd}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif
\usepackage{lipsum}
\usepackage{showframe}

\RedeclareSectionCommand[
  beforeskip=0pt
]{part}

\pagestyle{headings}

\usepackage{xpatch}
\usepackage{scrlayer}
\DeclareNewLayer[
  textarea,
  foreground,
  contents=\vfill\mypartpreamble
]{partpreamble}
\DeclareNewLayer[
  foot,
  background,
  contents={\Ifthispageodd{\hfill\pagemark}{\pagemark\hfill}}
]{partpagenumber}
\DeclareNewPageStyleByLayers{partpage}{partpreamble,partpagenumber}
\renewcommand\partpagestyle{partpage}

\makeatother
\newcommand\mypartpreamble{}
\newcommand\setmypartpreamble[1]{\def\mypartpreamble{#1}}
\xapptocmd{\partheademptypage}{\setmypartpreamble{}}{}{}

\begin{document}
    \part{Part title without Preamble}
    \lipsum

    \setmypartpreamble{
        This text comes after the part title, but on the same page.
        I would like to ``flushbottom'' it, i.e.\@ I want it to be aligned with the bottom of the text area.
    }
    \part{Part title with Preamble}
    \lipsum

    \part{Part tile without Preamble}
    \lipsum
\end{document}

或者使用包fancyhdr和居中的页码:

\documentclass[open=any,footlines=1]{scrbook}
\usepackage{lipsum}
\usepackage{showframe}

\RedeclareSectionCommand[
  beforeskip=0pt
]{part}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{xpatch}
\usepackage{scrlayer}
\DeclareNewLayer[
  textarea,
  foreground,
  contents=\vfill\mypartpreamble
]{partpreamble}
\DeclareNewLayer[
  foot,
  background,
  contents={\hfill\pagemark\hfill}
]{partpagenumber}
\DeclareNewPageStyleByLayers{partpage}{partpreamble,partpagenumber}
\renewcommand\partpagestyle{partpage}

\makeatother
\newcommand\mypartpreamble{}
\newcommand\setmypartpreamble[1]{\def\mypartpreamble{#1}}
\xapptocmd{\partheademptypage}{\setmypartpreamble{}}{}{}

\begin{document}
    \part{Part title without Preamble}
    \lipsum

    \setmypartpreamble{
        This text comes after the part title, but on the same page.
        I would like to ``flushbottom'' it, i.e.\@ I want it to be aligned with the bottom of the text area.
    }
    \part{Part title with Preamble}
    \lipsum

    \part{Part tile without Preamble}
    \lipsum
\end{document}

相关内容