1

I am trying to set different margins for the first page of my document. As I am not sure about the content of the first page, the \afterpage command has been used to achieve the required effect. However, I have noticed that the first paragraph on the second page (the red ellipse on top of Page 2) still has the margins of the first page (please check the example below).

  1. Is there any way where I can force the new margins on the entire content of the second page?
  2. Starting from the second page, is there a way where I can have a grey rectangle (Page 2 and Page 3 currently are drawn by hand only to demonstrate what I am after) covering the entire wide margin of the page (edge-to-edge vertically and edge-to-text on the wide margin horizontally)?

    \documentclass[11pt,a4paper,twoside]{article}
    
    \usepackage{lipsum,afterpage}
    
    \usepackage[left=1.5cm, top=1.5cm, right=3cm, bottom=1.5cm, nohead, nofoot]{geometry}
    
    \begin{document}
    
    \newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
    
    \afterpage{\globaldefs=1 \restoregeometry}
    
    \lipsum\lipsum\lipsum
    
    \end{document}
    

Thank you.

Page 1 Page 2 Page 3

  • You are probably looking for \clearpage, not \afterpage. – Johannes_B Dec 29 '18 at 11:52
  • 1
    Personally, i consider using this hocus pocus for the first page of a document completely unneeded. – Johannes_B Dec 29 '18 at 11:53
  • Welcome to TeX.SE. Please mark up code as such by selecting it, clicking on the {} - symbol in the editor or pressing CTRL-K – user31729 Dec 29 '18 at 11:53
  • @Johannes_B but I do not know the content of the first page beforehand. My understanding is that \clearpage has a similar effect to \newpage. – It's me again Dec 29 '18 at 11:55
  • @ChristianHupfer thank you for your comment. I have tried that but for some reasons the code did not get the correct format :( – It's me again Dec 29 '18 at 11:56
0

The solution to the second point (the grey bar on the margin) is found here.

\documentclass[11pt,a4paper,twoside]{article}
\usepackage{lipsum,afterpage,eso-pic,ifthen}
\usepackage[left=3cm, top=1.5cm, right=1.5cm, bottom=1.5cm, nohead, nofoot]{geometry}

\AddToShipoutPicture{% from package eso-pic: put something to the background
    \ifthenelse{\isodd{\thepage}}{
          % ODD page: left bar
          \AtPageLowerLeft{% start the bar at the left bottom of the page
                 \color{black!20}\rule{2.8cm}{\LenToUnit\paperheight}%

          }%
      }%
      {%
          % EVEN page: right bar
          \AtPageLowerLeft{% start the bar at the bottom left of the page
          \put(\LenToUnit{\dimexpr\paperwidth-2.8cm},0){% move it to the top right
              \color{black!20}\rule{2.8cm}{\LenToUnit\paperheight}%
           }%
           }%
       }%
}

\begin{document}
\newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
\afterpage{\globaldefs=1 \restoregeometry}

\lipsum\lipsum\lipsum

\end{document}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.