標題位於章節標題旁而不是下面

標題位於章節標題旁而不是下面

這篇論文- 與回憶錄類別 - 作者使用頭線標題內容旁邊而不是下面:

在此輸入影像描述

是否有可能實現同樣的目標KOMA腳本scrlayer-scrpage,對於帶有章節標題的偶數頁和帶有章節標題的奇數頁?

與連結的範例不同,我想得到:

偶數頁:

章節標題_________________________________________________

奇數頁:

_________________________________ 章節編號 章節標題

頁碼不相關,因為它們位於頁腳。


這是一個可以玩的 MWE:

\documentclass{scrbook}

\RequirePackage[headsepline,automark]{scrlayer-scrpage}

\renewcommand*{\chaptermarkformat}{\scshape}
\KOMAoption{headsepline}{0.1pt}
\pagestyle{scrheadings}

\usepackage{blindtext}

\begin{document}

\chapter{Hello World!}
\section{Section One}
\blindmathpaper
\blindmathpaper
\blindmathpaper

\end{document} 

我試圖廢除頭線並修改\chaptermarkformatand \sectionmarkformatusing hrulefill,這似乎是一個好方法。但我做不到。

\documentclass{scrbook}

\RequirePackage[automark]{scrlayer-scrpage}

\renewcommand*{\chaptermarkformat}[1]{\scshape \hspace{2ex} \hrulefill}

在此輸入影像描述

(章節名稱應該在左側,間距錯誤)


\renewcommand*{\sectionmarkformat}[1]{\hrulefill \hspace{2ex} \thesection \hspace{1ex} \rightmark }

奇怪的頁面看起來不錯,但在我看來應該做一些不同的事情。例如,為什麼我需要在這裡手動設定間距:\thesection \hspace{1ex} \rightmark

在此輸入影像描述

答案1

這是一個使用的建議\hrulefill

\documentclass{scrbook}
\usepackage[automark]{scrlayer-scrpage}

\lehead{\headmark{} \hrulefill}
\rohead{\hrulefill{} \headmark}

\renewcommand*{\chaptermarkformat}{}
\addtokomafont{pagehead}{\scshape}

\usepackage{blindtext}

\begin{document}
\Blinddocument
\end{document}

在此輸入影像描述

在此輸入影像描述


或者,如果您想使用該headmarks=.1pt選項:

\documentclass{scrbook}
\usepackage{xcolor}
\usepackage[automark,headsepline=.1pt]{scrlayer-scrpage}

\RemoveLayersFromPageStyle{scrheadings}{scrheadings.head.below.line}
\DeclareNewLayer[
  clone=scrheadings.head.odd,
  contents={\GetLayerContents{scrheadings.head.below.line}}
]{scrheadings.head.odd.line}
\DeclareNewLayer[
  clone=scrheadings.head.odd.line,
  evenpage
]{scrheadings.head.even.line}
\AddLayersToPageStyleBeforeLayer{scrheadings}%
  {scrheadings.head.odd.line}{scrheadings.head.odd}
\AddLayersToPageStyleBeforeLayer{scrheadings}%
  {scrheadings.head.even.line}{scrheadings.head.even}

\lehead{\setlength\fboxsep{0pt}\colorbox{white}{\headmark\strut\enskip}}
\rohead{\setlength\fboxsep{0pt}\colorbox{white}{\enskip\headmark\strut}}

\renewcommand*{\chaptermarkformat}{}
\addtokomafont{pagehead}{\scshape}

\usepackage{blindtext}

\begin{document}
\Blinddocument
\end{document}

在此輸入影像描述 在此輸入影像描述

相關內容