I am trying to mimic a common textbook/study guide typesetting where every page's body (not header nor footer) have a "Notes" area on the outside margin. I have been looking at geometry, but it is non-native to have the header be text + margin. I copied the "includeall" layout in the geometry package documentation in the section "Body Size", and then a modification of that showing what I am looking for. The red text "Notes" would be great to include at the top of every page, but I can probably do that as part of the header as a floating text box, if necessary.
1 Answers
You can use package 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}
Or you could use package 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}
Then you could add layers for the margin pars:
\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}
- 85,675
-
This is great! I had been trying to play with fancyhdr and it always put the header inside the textwidth. I will try this out with my more complicated document. – Justin Shorb Sep 21 '22 at 16:03





texdocprogram? Just try from the OS prompt to runtexdoc tufteor go to https://www.ctan.org/pkg/tufte-latex – Fran Sep 16 '22 at 19:33texdoc caesaror search aboutcaesar_book. Example here. – Fran Sep 16 '22 at 19:42