geometry package or native registers for mid-document margin changes
0 reputation · 29 Jan 2024, 19:09 UTC
0 reputation · 29 Jan 2024, 19:09 UTC
The goal is to adjust text block margins partway through a document while keeping facing pages symmetric. Under standard LaTeX2e behavior, the geometry package manages dependencies between paper size and layout lengths automatically, but its support for repeated mid-document reconfiguration is not clearly documented. Direct manipulation of native length registers permits granular changes, yet edits after the first page is shipped risk asymmetric offsets on verso and recto pages.
Overlap with KOMA-Script classes adds uncertainty because competing layout definitions can shift margins unexpectedly. The decision is whether to rely on package options or manual register control for dynamic margin changes without layout drift.
Is geometry safe to invoke multiple times for different margin sets? Should native register changes be confined to a specific shipout boundary to preserve symmetry? Must geometry be disabled when using a KOMA-Script class to avoid conflicting layout definitions?
34775 reputation · 29 Jan 2024, 23:47 UTC
Yes: with the geometry package under LaTeX2e, \newgeometry is the supported way to change margins multiple times in one document. It forces a page break and, in twoside mode, recalculates the odd/even offset pair so facing pages stay symmetric. Native register edits are not forbidden, but they must be made before the page is shipped out and you must update both \oddsidemargin and \evensidemargin yourself; dependent lengths such as \textwidth do not adjust automatically. For KOMA-Script classes, do not disable geometry entirely—load it with the KOMA option so it defers to KOMA's layout engine instead of fighting it.
Confirmed: \newgeometry ends the current page and starts a new one with the new layout. \restoregeometry returns to the preamble layout. geometry recalculates margins, text width, and text height together.
Likely explanation for drift: If you change only \oddsidemargin after a page has begun shipping, the recto and verso pages can receive different offsets. Manual edits also leave \textwidth and related lengths stale unless you recompute them, which geometry does for you.
\usepackage[twoside,margin=2.5cm]{geometry}\newgeometry{margin=3cm} at a paragraph or section boundary, never in the middle of a page.\restoregeometry at the next boundary.\clearpage or place it before \shipout, and set both \oddsidemargin and \evensidemargin explicitly.\usepackage[KOMA]{geometry}. Without that option, geometry and KOMA can redefine the same layout lengths and produce unexpected offsets.Assumptions: LaTeX2e, current geometry release, default output routine. Classes or packages that redefine \shipout may change where a boundary is safe.
Compile with pdfLaTeX, LuaLaTeX, or XeLaTeX and inspect odd and even pages after each \newgeometry call. The outer margin should mirror on facing pages. If it does not, the change was likely inserted mid-page or mixed with manual register edits.
Missing diagnostic: Are you using a standard LaTeX class (article, report, book) or a KOMA-Script class? That determines whether the KOMA option is required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.