4

I want to put some full page images in substitution of blank pages before chapters. I know exactly where to put them and what image to put. For example: at page 74 (a left page), before chapter 12 which starts at page 75 (a right page) there's a blank page. I want to substitute it with a figure (using \includepdf) without any change in other pages (before and after). There's a simple and elegant way? I'm using memoir class. Thanks a lot!!!

5
  • \clearpage\includepdf{zzz}\chapter{Something} should work Jan 11, 2021 at 22:04
  • Is the image a full-size page PDF? Or just a regular image (say, JPG)?
    – Werner
    Jan 11, 2021 at 22:05
  • it is a full pdf of perfect dimensions. Jan 11, 2021 at 23:15
  • David, thank you but it seems to put two extrapages. I use \part{Tecnologia}\clearpage\includepdf[noautoscale, templatesize={226mm}{290mm}]{\folderimmagini FULL-3.pdf} \chapter{Storia del sonoro per l'audiovisivo} and the result is a page dedicated to part "Tecnologia", a blank page (I don't want), the picture, another blank page (I don't want), and the first page of the chapter "Storia del sonoro per l'audiovisivo". Jan 11, 2021 at 23:21
  • @Simone Corelli I updated the answer to stay within memoir. Jan 12, 2021 at 22:52

2 Answers 2

3

The memoir class provides several means of moving onwards to another page. In particular for your case:

\movetoevenpage[stuff] 
\cleartoevenpage[stuff]

The \movetoevenpage stops the current page and starts typesetting on the next even numbered page. \cleartoevenpage flushes out all floats before going to the next even page. In both cases stuff, if present, is put on the skipped page (if there is one). So, you could do something along the lines of:

... last line of the previous chapter.
\cleartoevenpage[\includepdf...]
\chapter{Next chapter}
...

For preventing a blank page after a \part use @SimonDispa's code for redefining \partpageend

EDIT

I should have said:

\movetoevenpage{stuff}
\cleartoevenpage{stuff}

As noted by @SimoneCorelli.

EDIT 2

Ignore the above, the macros are:

\movetoevepage[stuff]
\cleartoevenpage[stuff]

where stuff is put on the skipped blank page (if there is one). Calling \movetoevenpage{stuff} puts stuff on the page after the skipped blank page.

10
  • Peter, thanks! I feel we are on the right path. But at the moment instead of a picture I see some characters (on the correct page): "ImmaginiCMYK/FULL(p090).pdf]". The command is \cleartoevenpage[\includepdf[pages=1, noautoscale, templatesize={226mm}{290mm}]{\folderimmagini FULL(p090).pdf}] \chapter{Linguaggi}, where \folderimmagini is a command that substitute foldername in all the LaTeX document. Any ideas? Jan 12, 2021 at 19:06
  • I've found the culprit! brackets! Not [ ], but { }. GREAT! Jan 12, 2021 at 19:16
  • Now it's ok before chapter, after another chapter, but it put 2 blank pages if used after a \part. I've put the code suggested by @SimonDispa that redefine \partpageend. Perhaps I have to add something more... Can you kindly tell me exactly what part of the Dispa's code I need to put in the preamble? Thanks! Jan 12, 2021 at 19:28
  • @SimoneCorelli As I said, his code for \makatletter\renewcommand*\partpageend{...}\makeatother. Jan 12, 2021 at 19:46
  • 1
    @PeterWilson Thank you! Yes, I noticed the error in braces and having corrected them I've been able to solve my problem completely. So... great job! Thanks to all. I hope it will become useful for many other users. Jan 15, 2021 at 23:17
3

The answer needs two "parts":

(1) Prevent \part in memoir to issue a \newpage after filling the part page. This is done redefining \partpageend by commenting a line. (marked with <<<<<<<<<<<)

(2) I usually use xcoffins to put material in the page in the place I want. First the figure or the pdf or text, etc. is put into the special boxes, defined by the package, and then attached (only one in this case) to another box that serves has frame, with X and Y offsets. (X offset, Y offset) in the command \Join...

The frame is then typeset as a text object in the current insertion point, as if it where the first letter of a text in the page. So we need to displace it to its proper place, the top left corner for example, using the margins dimensions or arbitrary lengths to put it where we want.

I made 3 examples in the document: at the end of a chapter that ends in a even page, so there is a blank odd page before the next chapter; inserting a dummy figure after \part; and inserting a pdf page after \part. (The cover of a manual)

Over time, I found that xcoffins was superior to other alternatives. It is easy to learn, just a few commands, and it emulates a graphic design program, placing the material in boxes and then attaching the boxes and adding offsets using their relative positions. This is a very simple case, but you might well want put more things over the background image: a text, a table or another figure. See for example

https://tex.stackexchange.com/a/573206/161015

a

c

This is the code.

\documentclass[10pt, a4paper, twoside, openright]{memoir}

\usepackage{graphicx}
\usepackage{kantlipsum} % dummy text    
\RequirePackage{calc} % easier calculations 
\usepackage{xcoffins}
\NewCoffin\Framex
\NewCoffin\FigA

\makeatletter
\renewcommand*{\partpageend}{\afterpartskip
    \ifm@mnopartnewpage
    \else
    \if@twoside
    \if@openright
    \null
    \thispagestyle{afterpart}%
%   \newpage %<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    \fi
    \fi
    \fi
    \if@tempswa
    \twocolumn
    \fi}
\makeatother

\setlrmarginsandblock{3.5cm}{2.5cm}{*}
\setulmarginsandblock{2.5cm}{*}{1}
\checkandfixthelayout

\begin{document}
    
\chapter{Introduction}
\kant[1-12]
%%%%%********************************* image end of chapter
\clearpage
\thispagestyle{empty}
\SetHorizontalCoffin\FigA{\includegraphics[width=\stockwidth, height=\stockheight]{example-image-a}}
\JoinCoffins*\Framex[l,t]\FigA[l,t](-\foremargin,\uppermargin+12pt) % XY offset
\noindent\TypesetCoffin\Framex
%****************************************************************

\part{Tecnologia I}
%%%%%*****************************************  image after part
\thispagestyle{empty}
\SetHorizontalCoffin\Framex{}  %clear the frame
\SetHorizontalCoffin\FigA{\includegraphics[width=\stockwidth, height=\stockheight]{example-grid-100x100pt}}
\JoinCoffins*\Framex[l,t]\FigA[l,t](-\foremargin,\uppermargin+24pt)  % XY offset
\noindent\TypesetCoffin\Framex
%****************************************************************
\chapter{Storia del sonoro per l'audiovisivo} 
\kant[30-35]

\part{Tecnologia II}
%%%************************************************ pdf (cover) after part
\thispagestyle{empty}
\SetHorizontalCoffin\Framex{} %clear the frame
\SetHorizontalCoffin\FigA{\includegraphics[width=\stockwidth, height=\stockheight]{pgfmanual.pdf}}
\JoinCoffins*\Framex[l,t]\FigA[l,t](-\foremargin,\uppermargin+24pt)  % XY offset
\noindent\TypesetCoffin\Framex
%***********************************

\chapter{Final} 
    \kant[8-12]
\end{document}  

UPDATE

Following Peter Wilson's suggestion it is possible to have everything inside memoir's world.

It is needed to remove another \newpage, now from \afterpartskip to prevent memoir from stubbornly keep adding a blank page after \part

The code it is simpler, although I have to reach the page 335 of the manual. Excellent manual, by the way!

xx

zz

%%%%%%% UPDATED CODE 
\documentclass[10pt, a4paper, twoside,openright]{memoir}    
\usepackage{graphicx}
\usepackage{kantlipsum} % dummy text        
\usepackage{pdfpages}

%%%%% *************************  changes to memoir
\makeatletter
\renewcommand*{\partpageend}{%
    \afterpartskip
    \ifm@mnopartnewpage
    \else
    \if@twoside
    \if@openright
    \null
    \thispagestyle{afterpart}%
%   \newpage %<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    \fi
    \fi
    \fi
    \if@tempswa
    \twocolumn
    \fi
}

\makeatother

\renewcommand{\afterpartskip}{\vfil%
%   \newpage %<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}

%%%%% ************************* 

\setlrmarginsandblock{3.5cm}{2.5cm}{*}
\setulmarginsandblock{2.5cm}{*}{1}
\checkandfixthelayout

\begin{document}
    
\chapter{Introduction}
\kant[1-12]

\part{Tecnologia I}
\clearpage
\thispagestyle{empty}
\cleartoevenpage{\includegraphics[width=0.8\stockwidth, height=0.8\stockheight]{example-grid-100x100pt}}
    
\chapter{Storia del sonoro per l'audiovisivo} 
\kant[30-35]

\part{Tecnologia II}
\cleartoevenpage{\includepdf[noautoscale,height=\stockheight]{pgfmanual.pdf}}

\chapter{Final} 
    \kant[8-10] 
\end{document}  
1
  • I want to thank you very much and I'm sure this can be helpful for many users. But for me is too much complicate and I hoped for a more simple solution. At the moment I use Apple Preview to edit pdf pages dragging the thumbnails between two docs. It is ok but not elegant... and it is slow with big files, but it works. Thanks again Jan 12, 2021 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .