# How do I create 'n' blank pages

I need to insert a variable number (up to 40) of plain style pages into a document. Not inserting pdf's. I am aware of how to do this with a single page (see MWE) but is there a way to do it with 'n' number of pages, or do I just copy and paste lots of times? I thought pdfpages might help somehow but as there are no file names I can't get it to work.

\documentclass[9pt,paper=a6,]{scrbook}
\begin{document}
Notes
\newpage
\thispagestyle{plain}
\mbox{}
\clearpage
Next Section
\end{document}

• Welcome to TeX.se, and thanks for posting a MWE! – Alan Munn Oct 31 '17 at 17:59

You can put your "blank page recipe" into a loop, say using pgffor:

\documentclass[9pt,paper=a6,]{scrbook}
\usepackage{pgffor}

\newcommand\InsertBlankPages[1]{% \InsertBlankPages{n} => insert n blank pages
\foreach \blank in {1,...,#1} {
\newpage
\thispagestyle{plain}
\mbox{}
}%
}

\begin{document}
\InsertBlankPages{10}
\end{document}


Actually, the pages are not quite blank as they have a page number. If you want them truly blank then use \thispagestyle{empty}.

The expl3 function \prg_replicate:nn does what you want; its first argument is an integer n and the second argument is the code to be repeated n times.

\documentclass[9pt,paper=a6,]{scrbook}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\blankpages}{m}
{
\clearpage
\prg_replicate:nn { #1 } { \mbox{}\thispagestyle{plain}\clearpage }
}
\ExplSyntaxOff

\begin{document}

Notes

\blankpages{10}

Next Section

\end{document}