3

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?

  • 5
    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 – David Carlisle Sep 20 '12 at 22:17
  • 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) – someonr Sep 20 '12 at 22:37
  • Cannot it be done using another package? – Vahid Damanafshan Sep 22 '12 at 20:57
  • @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. – jon Sep 25 '12 at 01:18
  • Does this help: http://tex.stackexchange.com/a/13451/10898 – azetina Oct 07 '12 at 13:05
  • 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? – Andy Nov 12 '12 at 09:00
  • @Andy: As I said in my post, I want the first page of each chapter in different margins. – Vahid Damanafshan Nov 12 '12 at 09:52
  • @lockstep done. – David Carlisle Apr 11 '13 at 20:32

1 Answers1

2

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

David Carlisle
  • 757,742