将页码和页眉移至边距

将页码和页眉移至边距

如何使用 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}自动设置。

rerunnerScrbookHeaderInMargin

\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}

相关内容