使用 Koma 腳本「srcbook」修改雙面文件的頁首和頁尾

使用 Koma 腳本「srcbook」修改雙面文件的頁首和頁尾

我正在寫論文,我正在使用 KOMA 類scrbook,但在更改文件樣式時遇到了困難。

首先,我的頁首和頁尾有問題。我想要的格式對於偶數頁和奇數頁應該分別如下所示。

我想要右側的章節名稱和偶數頁的右側頁碼

我想要左側的部分名稱和左側的奇數頁頁碼

我的文件的序言如下

\documentclass[twoside,12pt,headsepline,chapterprefix=true]{scrbook} 
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{slashed}
\usepackage{mathtools}
\usepackage{scrlayer-scrpage}
\usepackage{biblatex}
\usepackage{csquotes}
\usepackage{hyperref}
\pagestyle{scrheadings}
\automark{chapter}
\automark*[section]{}

但這給了我以下格式 在此輸入影像描述 在此輸入影像描述

請注意,章節名稱顯示在所需位置的對面,頁碼也顯示在頁腳中。有誰知道如何獲得我正在尋找的格式?另外,我想去掉“第 2 章”,我只想要標題中的章節名稱。

其次,由於我使用的是雙面格式,所以每章後面都有一個空白頁。我想在標題頁、致謝、摘要和目錄之後保留這些空白頁,但我不希望將其保留在文件的其餘部分中。可以這樣做嗎?

編輯:這是程式碼給出的內容與我目前的文檔格式相同

\documentclass[twoside,12pt,headsepline,chapterprefix=true]{scrbook} 
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{slashed}
\usepackage{mathtools}
\usepackage{scrlayer-scrpage}
\usepackage{lipsum}
\pagestyle{scrheadings}
\automark{chapter}
\automark*[section]{}
\begin{document}
\frontmatter
\tableofcontents
\chapter{Acknowledgements}
\lipsum[1-3]
\chapter{Abstract}
\lipsum[4-5]
\mainmatter
\chapter{ Cha 2}
\lipsum[6-15]
\section{section 1}
\lipsum[16-22]
\end{document}

答案1

假設頁碼plain也應該位於頁面的外部標題(例如章節頁面)中,您可以使用:

\clearpairofpagestyles
\ohead*{\pagemark}
\ihead{\headmark}

若要從頁首中刪除章節號,請使用

\renewcommand*\chaptermarkformat{}

若要刪除主要內容中的空白頁,您可以修補\mainmatter以設定 KOMA-Script 選項open=any

\usepackage{xpatch}
\xapptocmd{\mainmatter}{\KOMAoptions{open=any}}{}{\PatchFailed}

例子:

\documentclass[
  %twoside,% default
  12pt,headsepline,chapterprefix=true
]{scrbook} 
\usepackage{lipsum}% only for dummy text
%\usepackage[utf8]{inputenc}% only needed for outdated TeX distributions
\usepackage{graphicx}
%\usepackage{amsmath}
\usepackage{slashed}
\usepackage{mathtools}% loads amsmath
\usepackage{scrlayer-scrpage}% sets page style scrheadings automatically
%\pagestyle{scrheadings}
\automark[section]{chapter}
\renewcommand*\chaptermarkformat{}% removes chapter number from page header

\clearpairofpagestyles
\ohead*{\pagemark}
\ihead{\headmark}

\usepackage{xpatch}
\xapptocmd{\mainmatter}{\KOMAoptions{open=any}}{}{\PatchFailed}

\begin{document}
\frontmatter
\tableofcontents
\chapter{Acknowledgements}
\lipsum[1-3]
\chapter{Abstract}
\lipsum[4-5]
\mainmatter
\chapter{Cha 1}
\lipsum[6-15]
\section{section 1}
\lipsum[16-22]
\chapter{Foo}
\lipsum[23-50]
\end{document}

在此輸入影像描述

請注意,我已經縮短了

\automark{chapter}
\automark*[section]{}

\automark[section]{chapter}

但也許你想要

\automark[chapter]{chapter}
\automark*[section]{}

相關內容