將文字新增至 scrbook 頁首/頁尾的最小方法

將文字新增至 scrbook 頁首/頁尾的最小方法

我正在使用 scrbook 類,並且沒有對其進行太多配置。我無意。

預設情況下,非章節頁面的標題是章節標題,偶數頁上左對齊,奇數頁上右對齊。同樣,頁尾只是頁碼。

我只想將文字添加到頁腳(假設它現在應該為Draft v1.1 Page #pagenumber)。當我搜尋有關如何修改頁首/頁腳的建議時,我得到的範例比這更複雜。

我不需要其他人正在做的事情的複雜性。我只想用上面的架構替換頁腳文字。

執行此操作的最少程式碼方法是什麼?我並不特別關心我是否失去了奇數/偶數對齊或其他此類裝飾調整,我只是想保持簡單。

答案1

您可以重新定義\pagemark以新增附加資訊:

\documentclass{scrbook}

\renewcommand\pagemark{{%
  \usekomafont{pagenumber}Draft v1.1 Page \thepage
}}

\usepackage{blindtext}% only for the dummy text in this example
\begin{document}
\Blinddocument
\end{document}

在此輸入影像描述

如果您不想使用字體元素pagenumber

\documentclass{scrbook}

\renewcommand\pagemark{Draft v1.1 Page \thepage}

\usepackage{blindtext}% only for the dummy text in this example
\begin{document}
\Blinddocument
\end{document}

答案2

\documentclass{scrbook}
\usepackage{scrlayer-scrpage}
\usepackage{lipsum}
\pagestyle{scrheadings}
\renewcommand\chapterpagestyle{scrheadings} % ensures that the first page of chapters is formatted the same
\ofoot{Draft v1.1 Page \pagemark}
\begin{document}
\chapter{First Chapter}
\lipsum\lipsum
\chapter{Second Chapter}
\lipsum\lipsum
\end{document}

在此輸入影像描述

在此輸入影像描述

相關內容