Page LayoutHow to change trimmed paper size mid-document with the same stock paper size

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
krow4869
Posts: 1
Joined: Fri Dec 22, 2017 11:25 pm

How to change trimmed paper size mid-document with the same stock paper size

Post by krow4869 »

Basically what the subject says.

Project MWE code can be found in this link: https://www.sharelatex.com/5258121182fkxppbnvfsjr

The problem is in pages ix and x (9 and 10). The code for this page are located in /intro/Not_blank.tex.

The paper size initializations are located in /setup/papersetup.tex and the geometry package initialization is located in /setup/packages.tex.

The file you need to compile is /main.tex.

I tried doing a Google search, but nothing came up.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

How to change trimmed paper size mid-document with the same stock paper size

Post by Stefan Kottwitz »

Hello,

as information for our readers, this question has been posted to TeX.SE too, and there's already a solution by David Purton. He wrote:
You can use the standard memoir commands to change the document page layout.

The only catch is that the size of the type set text block isn't automatically changed by memoir. Changing this mid-document can be a bit tricky, but you can copy what the geometry package does to do this provided you also surround things with a couple of \newpage commands.

Code: Select all

\documentclass{memoir}
\usepackage{showframe}
\usepackage{lipsum}
\setstocksize{7in}{5in}
\settrimmedsize{7in}{5in}{*}
\setlrmarginsandblock{.5in}{1in}{*}
\setulmarginsandblock{1in}{1in}{*}
\checkandfixthelayout
\makeatletter
% adapted from \Gm@changelayout geometry.sty
\newenvironment{newlayout}[1]{%
  \newpage
  #1%
  \setlength{\@colht}{\textheight}
  \setlength{\@colroom}{\textheight}%
  \setlength{\vsize}{\textheight}
  \setlength{\columnwidth}{\textwidth}%
  \if@twocolumn%
    \advance\columnwidth-\columnsep
    \divide\columnwidth\tw@%
    \@firstcolumntrue%
  \fi%
  \setlength{\hsize}{\columnwidth}%
  \setlength{\linewidth}{\hsize}}{\newpage}
\makeatother
\begin{document}
\lipsum[2]
\begin{newlayout}{%
  \setstocksize{6in}{4in}
  \settrimmedsize{6in}{4in}{*}
  \setlrmarginsandblock{.5in}{1in}{*}
  \setulmarginsandblock{1in}{1in}{*}
  \checkandfixthelayout
  \fixpdflayout}
\lipsum[2]
\end{newlayout}
\lipsum[2]
\end{document}
memoir.png
memoir.png (27.59 KiB) Viewed 3518 times
Stefan
LaTeX.org admin
Post Reply