I have a series of pdf files that I'm combining. I'd like to include as many of them as possible in the finished document, but for logistical reasons I cannot have a total of more than 50 pages.
Is there any way to make LaTeX
stop compiling and throw an error message, should the page count exceed this total?
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{pdfpages}
\usepackage{tikz}
\renewcommand{\contentsname}{My combined file}
\setlength\parindent{0pt}
\begin{document}
\includepdf[pages=-]{cover.pdf}
\includepdf[pages=-]{doc1.pdf}
\includepdf[pages=-]{doc2.pdf}
\includepdf[pages=-]{doc3.pdf}
\includepdf[pages=-]{doc4.pdf}
\includepdf[pages=-]{doc5.pdf}
\includepdf[pages=-]{doc6.pdf}
\includepdf[pages=-]{doc7.pdf}
% More files included here
\end{document}
minp
andmaxp
keys for in the class I wrote for my thesis: github.com/vermiculus/smcm-tex/blob/master/smcm-tex/cosc/…, specifically line 134. The basic idea was to hook onto the end of the document to make sure that we were in the range. I'll post this up as an answer after work if you can be patient :) It won't just stop compiling, but it will throw out a message (can be made into a fatal error very easily).