How to change the margins of the only first page of each chapter?
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
Related videos on Youtube
Vahid Damanafshan
Updated on April 12, 2020Comments
-
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=30mm, bottom=30mm, left=30mm, right=30mm
. 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 commands like
\newgeometry
,\savegeometry
, and\loadgeometry
etc, but I couldn't accomplish that. Can anybody please help me do that?-
David Carlisle about 11 yearsIt'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 about 11 yearsI 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 about 11 yearsCannot it be done using another package?
-
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 about 11 yearsDoes this help: tex.stackexchange.com/a/13451/10898
-
Andy almost 11 yearsCould 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 almost 11 years@Andy: As I said in my post, I want the first page of each chapter in different margins.
-
David Carlisle over 10 years@lockstep done.
-