I need to produce a series of book and the typography asked me to provide documents with the total number of pages multiple of 16.
I tried to follow this answer How to ensure document total page numbers is a multiple of four?, using the example working with \frontmatter and \mainmatter, but I am not able to modify it to output multiple of 16. Any advice?
EDIT: for convenience, full code below:
\usepackage{xparse}
\usepackage{refcount,lastpage,etoolbox}
\usepackage{kantlipsum}
\makeatletter
\patchcmd\mainmatter{\cleardoublepage}
{%
\clearpage\edef\@currentlabel{\number\numexpr\arabic{page}\ifodd\arabic{page}+1\fi\relax}%
\label{LastFrontmatterPage}%
\cleardoublepage
}{}{}
\makeatother
\ExplSyntaxOn
\cs_new:Npn \egreg_int_coremainder:nn #1 #2
{
\int_mod:nn { #2 - \int_mod:nn { #1 } { #2 } } { #2 }
}
\NewDocumentCommand{\checkmultipleoffour} { O{0} }
{
\prg_replicate:nn
{
\egreg_int_coremainder:nn { #1 + \getrefnumber{LastFrontmatterPage} + \getpagerefnumber{LastPage} } { 4 }
}
{ \thispagestyle{empty}\null\clearpage }
}
\ExplSyntaxOff
\AtEndDocument{\checkmultipleoffour}
4to16seems to work fine for me. – Steven B. Segletes Sep 01 '15 at 12:004to16, it also seems to work. – Steven B. Segletes Sep 01 '15 at 12:33\label-\refsystem to get synchronized. I added a note. – egreg Sep 01 '15 at 12:40