如何在標題中加入我的書名?

如何在標題中加入我的書名?

我想把章節放在奇數頁上,後面跟著編號頁。並且,在偶數頁上,數字頁後面跟著標題。問題是:如何?

答案1

如果您使用標準book類,則可以使用捆綁包titleps中的套件titlesec。只需將此代碼添加到您的序言中:

\usepackage{titleps}
\newpagetyle{mystyle]{%
\titlerule% if you want a header rule
\sethead[\thepage\quad\chaptertitle][][]{}{}{\chapterritle\quad\thepage}
\setfoot{}{}{}
}%
\pagestyle{mypage}

如果您希望章節標題位於頁首中央,您可以這樣寫:

\sethead[\thepage][\chaptertitle][]{}{\chaptertitle}{\thepage}

有關範例和可能性的更多詳細信息,請參閱文件。

答案2

對於像這樣的 KOMA-Script 類,scrbook您可以簡單地使用以下內容:

\documentclass{scrbook}

\usepackage{mwe}
\usepackage{scrlayer-scrpage}
\automark[chapter]{chapter}
\clearpairofpagestyles
\lehead{\pagemark\quad\expandafter\MakeMarkcase\csname @title\endcsname}
\rohead{\headmark\quad\pagemark}

\begin{document}
\title{Title of the Document}
\author{Author of the Document}
\maketitle
\blinddocument
\end{document}

請注意,預設情況下,帶有章節標題的頁面不顯示運行標題。

如果您使用的是標準類,\@title則會在之後刪除\maketitle。因此,使用新指令可能是一個簡單的解決方案:

\documentclass{book}

\usepackage{mwe}
\newcommand*{\Title}{Title of the Document}
\usepackage{scrlayer-scrpage}
\automark[chapter]{chapter}
\clearpairofpagestyles
\lehead{\pagemark\quad\MakeMarkcase{\Title}}
\rohead{\headmark\quad\pagemark}

\begin{document}
\title{\Title}
\author{Author of the Document}
\maketitle
\blinddocument
\end{document}

相關內容