comparison dottes.tex @ 955:2324285ba90b

Round A4 up to a multiple of 4 total pages. I can't easily get the number of actual pages processed, so rely on telling the (rather hacky, and surprising - I have to divide to a separate counter to force an integer result) macro the number of pages used before the current numbering started.
author Jim Hague <jim.hague@acm.org>
date Tue, 06 Aug 2019 23:29:51 +0100
parents 48386452b36a
children 2e51b0787a54
comparison
equal deleted inserted replaced
954:48386452b36a 955:2324285ba90b
1 \input{docclass.tex} 1 \input{docclass.tex}
2 2
3 \usepackage{array} 3 \usepackage{array}
4 \usepackage{calc}
4 \usepackage{caption} 5 \usepackage{caption}
5 \usepackage{color} 6 \usepackage{color}
6 \usepackage{fontspec} 7 \usepackage{fontspec}
7 \usepackage{graphicx} 8 \usepackage{graphicx}
8 \usepackage{fancyhdr} 9 \usepackage{fancyhdr}
10 \usepackage{ifthen}
9 \usepackage[defaultlines=4,all]{nowidow} 11 \usepackage[defaultlines=4,all]{nowidow}
10 \usepackage{tabularx} 12 \usepackage{tabularx}
11 \usepackage{longtable} 13 \usepackage{longtable}
12 \usepackage{needspace} 14 \usepackage{needspace}
13 \usepackage[UKenglish]{babel} 15 \usepackage[UKenglish]{babel}
96 \end{center} 98 \end{center}
97 \ifemptyarg{#2}{}{\caption*{#2}} 99 \ifemptyarg{#2}{}{\caption*{#2}}
98 \end{figure} 100 \end{figure}
99 } 101 }
100 102
103 % Add blank pages to make total page count up to a multiple
104 % Args are:
105 % 1. Multiple desired
106 % 2. Pages before start of current page count
107 \newcounter{modpage}
108 \newcounter{modpageno}
109 \newcounter{modpagenodiv}
110 \newcommand{\padpages}[2]{%
111 \pagestyle{empty}%
112 \setcounter{modpageno}{\thepage + #2}%
113 \setcounter{modpagenodiv}{\themodpageno/#1}%
114 \setcounter{modpage}{\themodpageno - #1*\themodpagenodiv}%
115 \ifthenelse{\themodpage=0}%
116 {\relax}%
117 {\setcounter{modpage}{#1 - \themodpage}%
118 \whiledo{\themodpage>0}{%
119 \mbox{}\clearpage\mbox{}%
120 \setcounter{modpage}{\themodpage - 1}%
121 }% end whiledo
122 }% end ifthenelse
123 }% end padpages
124
101 % ----- Paper size document setup 125 % ----- Paper size document setup
102 126
103 \input{docsetup.tex} 127 \input{docsetup.tex}
104 128
105 % ----- Appearance 129 % ----- Appearance