有人能修改以下代码,使文档的边距位于右侧而不是左侧吗?页眉仍应延伸到边距之上。
\documentclass[twoside=semi, titlepage]{scrreprt}
\usepackage[
vmargin=2.5cm, heightrounded,
left=6cm, right=2cm,
marginparwidth=3.5cm, marginparsep=0.5cm,
showframe
]{geometry}
\usepackage[
automark,
headwidth=textwithmarginpar:-\the\marginparwidth- \the\marginparsep:marginpar,
footwidth=textwithmarginpar:-\the\marginparwidth-\the\marginparsep:marginpar
]{scrlayer-scrpage}
\clearpairofpagestyles
\ofoot{\pagemark}
\ohead{\normalfont MATH UNIT}
\usepackage{blindtext}
\begin{document}
\section{Section}
\Blindtext\marginpar{Margin text}
\Blindtext\marginpar{Margin text}
\Blindtext[1]
\blinddocument
\end{document}
答案1
left
更改几何选项中的和的设置right
。对于页眉和页脚位置,将偏移量明确设置为 0pt。(我不知道为什么这是必要的。)
\documentclass[twoside=semi, titlepage]{scrreprt}
\usepackage[
vmargin=2.5cm, heightrounded,
left=2cm, right=6cm,% <- changed
marginparwidth=3.5cm, marginparsep=0.5cm,
showframe
]{geometry}
\usepackage[
automark,
headsepline,% <- to show the headwidth
footsepline,% <- to show the footwidth
headwidth=textwithmarginpar:0pt:0pt,% <- changed
footwidth=textwithmarginpar:0pt:0pt% <- changed
]{scrlayer-scrpage}
\clearpairofpagestyles
\ofoot{\pagemark}
\ohead{\normalfont MATH UNIT}
\usepackage{blindtext}% dummy text
\begin{document}
\section{Section}
\Blindtext\marginpar{Margin text}
\Blindtext\marginpar{Margin text}
\Blindtext[1]
\blinddocument
\end{document}
请注意,我已经使用选项headsepline
和footsepline
来显示页眉和页脚的位置。