
我需要排版一本書,其中各部分由字符串標識,例如“PLA 1”,按照書籍編輯的指示(出版商將這些字符串稱為“cite-keys”。)
有時,給定的圖書跨頁上有幾個部分,這意味著一些引用鍵。
- 這些引用鍵需要列印在外邊距上,與該部分在同一行。
- 此外,左頁的第一個目前引用鍵必須列印在偶數頁運行標題中。
- 出現在右頁上的最後一個目前引用鍵必須位於奇數頁運行標題中。
如何在運行標題和頁邊空白中列印這些特殊字串?
我想過使用\label{SCA 1}
,但後來我意識到\labels
實際上是計數器。
我嘗試使用\marks
(與emarks
包一起),但我無法弄清楚。
正在進行的 MWE:
\documentclass{scrbook}
\usepackage{lipsum}
\documentclass{scrbook}
\usepackage{lipsum}
\usepackage{scrpage2}
\pagestyle{scrheadings}
\ihead[]{}
\chead[]{\pagemark}
\ohead[\headmark]{\headmark}
\begin{document}
\section*{Section title}\label{PLA 1}
\lipsum[1]
Label string should be here \nameref{PLA 1}
\end{document}
我需要使用 Koma 類別。我在某個地方看到人們使用fancyhdr
或 titlesec
,但 Koma 手動建議反對其中任何一個(例如,該titlesec
包乾擾選項標題=optiontotoc)。
我看到了一些問題的回答http://tex.stackexchange.com,但沒有人有足夠的指導讓我開始。
答案1
這是使用該包的建議scrlayer-scrpage
\documentclass{scrbook}
\usepackage{lipsum}% dummy text
\usepackage{needspace}
\usepackage[manualmark]{scrlayer-scrpage}
\clearpairofpagestyles
%%% alternatively:
%\usepackage[manualmark]{scrpage2}
%\clearscrheadfoot
%\pagestyle{scrheadings}
\chead{\pagemark}
\lehead*{\rightmark}\rohead*{\leftmark}
\renewcommand\chaptermark[1]{\markboth{}{}}
\newcommand\myaddsec[2]{%
\needspace{3\baselineskip}%
\addsec[#1]{#1\markboth{#2}{#2}\marginpar[\raggedright#2]{\raggedleft#2}}%
}
\begin{document}
\tableofcontents
\chapter{Chapter Title}
\myaddsec{Section title}{PLA1}
\lipsum[1]
\myaddsec{Section title}{PLA2}
\lipsum[1-3]
\myaddsec{Section title}{PLA3}
\lipsum[1]
\myaddsec{Section title}{PLA4}
\lipsum[1-5]
\myaddsec{Section title}{PLA5}
\lipsum[1]
\myaddsec{Section title}{PLA6}
\lipsum[1-2]
Label string should be here
\end{document}
結果