To rectify this problem I had to delve into the dark world of LaTeX programming. It was an adventure, but thankfully it wasn't too difficult. What I came up with was the following tex file:
\documentclass[a4paper,twoside]{memoir}
\newcounter{number@}
\usepackage{pdfpages}
\begin{document}
\setcounter{number@}{0}
\loop\ifnum \value{number@} < 6 %CHANGE for each document
\stepcounter{number@}
\ifodd \value{number@}
\includepdf[pages=\arabic{number@}, angle=180]{document}
\else
\includepdf[pages=\arabic{number@}]{document}
\fi
\repeat
\end{document}
To illustrate, I've made an example PDF file to test it on. This test file is an open access paper from Zootaxa, the original of which is available here.
Do remember to change the number that \value{number@} is being compared to. This number is the total pages in "document.pdf", and I haven't yet figured out how to automatically retrieve it. Doing so would've consumed more time than I can afford just now.
Particularly helpful in this adventure was the Tralics site that contains documentation on all TeX commands, and this site on counters.
2 comments:
this code places the number of pages in \lastpagecount:
\documentclass[]{minimal}
\usepackage{pdfpages}
\newcommand{\retrievepagecount}[1]{\pdfximage{#1}\edef\lastpagecount{\the\pdflastximagepages}}
\begin{document}
\retrievepagecount{pdffile.pdf}
\lastpagecount
\end{document}
Thank you matieh! That code makes things much more straightforward.
Post a Comment