如何使用 KOMA-Script 将页码和标题移动到页边距?
我正在寻找这种布局:
其中红色圆圈表示节(或章)名称后的页码位置。
到目前为止我有以下代码:
\documentclass[12pt,parskip=half, DIV=calc]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, libertine}
\usepackage[headsepline]{scrpage2}
\setheadwidth[0pt]{textwithmarginpar}
\usepackage{geometry}
\geometry{includemp,showframe}
\usepackage{blindtext}
\begin{document}
\section{test}
\blindtext[1]
\marginpar{\blindtext[1]}
\blindtext[3]
\end{document}
答案1
交换加载顺序。
请注意,它scrpage2
已经过时了。它的后继者是包scrlayer-scrpage
。该包\pagestyle{scrheadings}
自动设置。
\documentclass[12pt,parskip=half]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, libertine}
\usepackage{geometry}
\geometry{includemp,showframe}
\usepackage[
headsepline,
headwidth=textwithmarginpar,
footwidth=head% if footer and header should have the same width
]{scrlayer-scrpage}% modern version
\usepackage{blindtext}
\begin{document}
\section{test}
\blindtext[1]
\marginpar{\raggedright No Wombat can be found here, please be aware of that}
\blindtext[3]
\end{document}
包装过时scrpage2
您必须scrheadings
手动激活页面样式。
\documentclass[12pt,parskip=half]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, libertine}
\usepackage{geometry}
\geometry{includemp,showframe}
\usepackage[headsepline]{scrpage2}
\setheadwidth[0pt]{textwithmarginpar}
\setfootwidth[0pt]{head}% if footer and header should have the same width
\pagestyle{scrheadings}% <- added
\begin{document}
\section{test}
\blindtext[1]
\marginpar{\raggedright No Wombat can be found here, please be aware of that}
\blindtext[3]
\end{document}