答案1
您可以使用包fancyhdr
:
\documentclass{book}
\usepackage[includemp]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{plain}{\fancyhead{}}
\fancyheadoffset[LE,RO]{\dimexpr\marginparsep+\marginparwidth\relax}
\fancyfootoffset[LE,RO]{\dimexpr\marginparsep+\marginparwidth\relax}
\renewcommand{\footrulewidth}{\headrulewidth}% to show the width of footer
\usepackage{lipsum}% dummy text
\begin{document}
\chapter{Foo}
\lipsum
\lipsum[1]\marginpar{\raggedright\lipsum[2]}
\lipsum
\end{document}
或者你可以使用包scrlayer-scrpage
:
\documentclass{book}
\usepackage[includemp]{geometry}
\usepackage[
headwidth=textwithmarginpar,
headsepline,plainheadsepline,% to show the width of header
footwidth=textwithmarginpar,
footsepline,plainfootsepline% to show the width of footer
]{scrlayer-scrpage}
\usepackage{lipsum}% dummy text
\begin{document}
\chapter{Foo}
\lipsum
\lipsum[1]\marginpar{\raggedright\lipsum[2]}
\lipsum
\end{document}
然后,您可以为边距部分添加图层:
\documentclass{book}
\usepackage[includemp]{geometry}
\usepackage[
headwidth=textwithmarginpar,
headsepline,plainheadsepline,% to show the width of header
footwidth=textwithmarginpar,
footsepline,plainfootsepline% to show the width of footer
]{scrlayer-scrpage}
\DeclareNewLayer[
oddpage,
background,
textarea,
addhoffset=\dimexpr\textwidth+\marginparsep,
width=\marginparwidth,
mode=picture,
contents=\putUL{\raisebox{\dp\strutbox}{Notes:}}%
% draw marginpar border:
\putLL{\line(1,0){\LenToUnit{\layerwidth}}}%
\putLR{\line(0,1){\LenToUnit{\layerheight}}}%
\putUR{\line(-1,0){\LenToUnit{\layerwidth}}}%
\putUL{\line(0,-1){\LenToUnit{\layerheight}}}%
]{odd.marginpar}
\DeclareNewLayer[
evenpage,
background,
textarea,
addhoffset=\dimexpr-\marginparsep-\marginparwidth,
width=\marginparwidth,
mode=picture,
contents=\putUL{\raisebox{\dp\strutbox}{Notes:}}%
% draw margin par border:
\putLL{\line(1,0){\LenToUnit{\layerwidth}}}%
\putLR{\line(0,1){\LenToUnit{\layerheight}}}%
\putUR{\line(-1,0){\LenToUnit{\layerwidth}}}%
\putUL{\line(0,-1){\LenToUnit{\layerheight}}}%
]{even.marginpar}
\AddLayersToPageStyle{scrheadings}{odd.marginpar,even.marginpar}
\AddLayersToPageStyle{plain.scrheadings}{odd.marginpar,even.marginpar}
\usepackage{lipsum}% dummy text
\begin{document}
\chapter{Foo}
\lipsum
\lipsum[1]\marginpar{\raggedright\lipsum[2]}
\lipsum
\end{document}