How to change the margins of ‎the only‎ first page ‎of‎ ‎‎each‎ ‎‎‎chapter‎?‎

1,293

It's not easy in TeX to change line width mid-paragraph unless you know in advance how many lines are required for the first width. thus you can not change the line width at an automatic page break the whole paragraph has already been set with the settings from the first page.

If you have a fixed break such as \clearpage then you can reset the geometry at that point (as done in lscape package for example) it would perhaps be possible in some cases with a multiple-pass procedure that determined the page break on one pass and re-set on later passes, or using luatex which has extra features here

Share:
1,293

Related videos on Youtube

Vahid Damanafshan
Author by

Vahid Damanafshan

Updated on April 12, 2020

Comments

  • Vahid Damanafshan
    Vahid Damanafshan over 3 years

    I'm‎ using ‎the ‎geometry package in the ‎book‎ class‎ ‎and now I ‎want‎ the margins of the first page of each chapter ‎to‎ be, for example, top=50mm, ‎bottom=50mm‎, ‎left=50mm‎, ‎‎right=50mm‎ and the margins of other pages to be, say, ‎top=3‎0mm, ‎‎bottom=3‎0mm‎, ‎‎left=3‎0mm‎, ‎‎‎‎right=30‎mm.‎ BTW,‎ I ‎want‎ to do it in the preamle, and not in the document ‎body ‎itself. For ‎convenience,‎ I put ‎the‎ following MWE:‎‎

    ‎\documentclass{book}‎
    \usepackage[top=50mm, ‎bottom=50mm‎, ‎left=50mm‎, ‎‎‎right=50mm]{geometry}‎‎‎
    ‎‎\usepackage{lipsum‎} ‎‎
    ‎\begin{document}‎‎‎‎‎
    ‎‎\chapter{One‎}‎‎‎
    ‎\lipsum[1-‎‎‎12‎‎‎]‎
    ‎\chapter{Two‎}‎‎‎‎
    ‎\lipsum[4-‎8‎]         
    ‎‎‎‎\end{document}‎‎‎
    

    I'm‎ familiar with ‎command‎s like \newgeometry, \savegeometry, ‎and‎ \loadgeometry ‎etc‎, but I couldn't ‎accomplish‎ that. ‎Can‎ anybody please help me do that?

    • David Carlisle
      David Carlisle about 11 years
      It's not easy in TeX to change line width mid-paragraph unless you know in advance how many lines are required for the first width. thus you can not change the lien width at an automatic page break the whole paragraph has already been set with the settings from the first page. If you have a fixed break such as \clearpage then you can reset the geometry at that point (as done in lscape package for example) it would perhaps be possible in some cases with a multiple-pass procedure that determined the page break on one pass and re-set on later passes, or using luatex which has extra features here
    • someonr
      someonr about 11 years
      I would try afterpage package. But this isn't working for me: \newgeometry{top=50mm,bottom=50mm,left=50mm,right=50mm} \afterpage{\clearpage\restoregeometry} (just thought mentioning the package could help)
    • Vahid Damanafshan
      Vahid Damanafshan about 11 years
      Cannot it be done using another package?
    • jon
      jon about 11 years
      @VahidDamanafshan -- I'm afraid there is no existing, automatic solution in 'package' form. Perhaps someone could get clever with LuaTeX, but I don't think anyone has done so yet.
    • azetina
      azetina about 11 years
    • Andy
      Andy almost 11 years
      Could you maybe draw a small sketch what are are trying to accomplish? I am not sure you need to change the geometry at all. If I understand correctly, wouldn't a 20mm vertical white space above the chapter name suffice?
    • Vahid Damanafshan
      Vahid Damanafshan almost 11 years
      @Andy: As I said in my post, I want the first page of each chapter in different margins.
    • David Carlisle
      David Carlisle over 10 years
      @lockstep done.