Margins – Solving the Empty Margin Issue Inside the Text Body with Geometry Package

geometryheader-footermargins

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.

Original Page Layout from package Geometry with header and footer set to textwidth

desired page layout modified from other image with header and footer spanning entire non printing margin width

Best Answer

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}

enter image description here

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}

enter image description here

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}

enter image description here