Debian Codegraph @

texmf-dist/doc/latex/fillpages/fillpages-documentation.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % %
3 % Made by Gabriel Ruprecht %
4 % %
5 % This work is published under the %
6 % LaTeX project public license 1.3 %
7 % %
8 % Package version 1.1.0 %
9 % 2025-01-21 %
10 % %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \documentclass[11pt,a4paper]{scrartcl}
13 \usepackage[utf8]{inputenc}
14 \usepackage[english]{babel}
15 \usepackage{graphicx}
16 \usepackage{listings}
17 \lstset
18 { %Formatting for code in appendix
19 language=TeX,
20 numbers=left,
21 stepnumber=1,
22 showstringspaces=false,
23 tabsize=1,
24 breaklines=true,
25 breakatwhitespace=false,
26 basicstyle=\ttfamily}
27
28
29 \usepackage{xcolor}
30 \usepackage{hyperref}
31 \usepackage{parskip}
32
33 \makeatletter
34 %\def\FillPages{\makebox{\vspace*{50pt} \includegraphics[height=\f@size pt]{./GFM-FP-Logo}} }
35 \def\FillPagesTiny{\includegraphics[height=\f@size pt]{./GFM-FP-LogoTiny}\hspace*{-3pt}}
36 \def\FillPagesS{\hspace*{3pt}\includegraphics[height=\f@size pt]{./GFM-FP-LogoS}\hspace*{3pt}}
37 \makeatother
38 \title{Fill\FillPagesS Pages\FillPagesS Package\vskip 9pt\relax}
39 \subtitle{Version 1.1.0}
40 \author{Gabriel Ruprecht}
41
42
43 \begin{document}
44 \maketitle
45 \section{Introduction}
46 \subsection{About}
47 The \textsf{Fill\FillPagesS Pages\FillPagesS Package} can be used, if you create a book, booklet or similar. In these cases you often print something, where your page count must be divisible by 4, 8 or 16. This package fills your document with the needed pages. By default, they are blank, but they may also have a pre-defined content. If you use this package, you have to compile at least two times. The first run counts the pages and inserting positions. This information is then used in the second run, to calculate the number of pages to be inserted.
48
49 \subsection{License}
50 This package is subject to the LaTeX Project Public License 1.3. You may do whatever you want with. If you change the package and redistribute it, please keep the credits.
51
52 \section{Example document}
53 The fastest way to see, how it works, is copying this document and play around a little bit:
54
55 \begin{lstlisting}[numbers=none]
56 \documentclass{report}
57 \usepackage[utf8]{inputenc}
58 \usepackage[latin,english]{babel}
59 \usepackage{lipsum}
60
61 \usepackage{fillpages}
62
63 \pagesDivisibleBy{4}
64 %\pagesDivisibleBy{4}[2] % with optional offset
65
66 \setFillPage{2}{
67 ABC
68
69 DEF
70 }
71
72 \setFillPage{3}{
73 123
74
75 456
76 }
77
78 \setDefaultFillPage{
79 Nothing
80 }
81
82
83 \begin{document}
84
85 \lipsum
86
87 \insertFillPages
88 \insertFillPages
89
90 \lipsum
91 \lipsum
92 \pagenumbering{Roman}
93 \lipsum
94 \lipsum
95
96 \insertFillPages
97
98 \lipsum
99
100 \end{document}
101 \end{lstlisting}
102
103 \newpage
104 \section{Commands}
105 You have to define the number which the total page number should be devideable by. Then you define the insertion points for the fill-pages. You can define content for any of these pages. After that, you have to run the document at least two times for a proper result. In the first run, the insertion points are counted and the regular page number is collected. On the second run, the pages are inserted.\bigskip
106
107 \noindent\verb&\insertFillPages&\\ This command must be placed at the points, where insertion is allowed (insertion points). This can be done at multiple points. The total number of pages to be inserted is divided by the number of insertion points. If there are three insertion points and five pages will be inserted, the insertion will be \verb#1 1 2#. Inside each \verb+\inserFillPages+ a \verb+\clearpage+ is executed at the beginning. Therefore all pending floats will be shipped out. \verb+\inserFillPages+ equals a \verb+\clearpage+, even if there are no fill-pages inserted.
108
109 \noindent\verb&\pagesDivisibleBy{number}[offset]&\\ This defines the number the page number must be divisible by (default~=~4). If \verb+number+ is 4 and page count is 13, 3 pages will be inserted~(4*4=16; 13+3=16). If \verb+number+ is~4 and \verb+offset+ is 2, the same example will lead to 1 inserted page (3*4=12; 12+2=14; 13+1=14). You can make the page numbers also divisible by 5 with an offset of 3. There is no limitation. The result will always be the minimal number of inserted pages. Divisible by 4, offset 1 has the same result as divisible by 4, offset 5.
110
111 \noindent\verb&\setFillPage{pagenumber}{content}&\\
112 This creates a custom page, which will be used, if needed. By default all inserted pages are white, but if they shouldn't be white, you can define a content. I.e.
113 \begin{lstlisting}[numbers=none]
114 \setFillPage{3}{This is the insert page three}
115 \end{lstlisting}\vskip -8pt\relax
116 will create a page with the text ''This is the insert page three''. If only 2 pages are needed, it won't be used. If more than 2 are used, it will be. You can define as many fill-pages as you want, but only the required amount will appear in your document. The command is defined as long, which means, you are allowed to use paragraphs inside. It behaves almost like any other page in \LaTeX .
117
118 \noindent\verb&\setDefaultFillPage{content}&\\
119 This command works exactly like \verb&\setFillPage&, but takes only one argument. It sets the appearance of all other fill-pages. This makes it possible to set headers and footers, the page style or even a default text.
120
121 \section{What the package uses}
122 The package relies solely on standard \LaTeX -core functions.
123
124 \section{How it works}
125 The principle is really straight forward. The difficulty was to implement it bug free and robust (especially the idempotency).
126
127 \begin{enumerate}
128 \item First run:
129 \begin{enumerate}
130 \item Count all places, where pages can be inserted.
131 \end{enumerate}
132 \item Second run:
133 \begin{enumerate}
134 \item Calculate the number of total pages without the fill-pages, that were inserted.
135 \item Do a modulo division on this page count by target divisor (offset must be considered). It is actually not a modulo operation, but this is the principle behind it. Page count is 15, must be divisible by 4 (offset 0), 15\%4=3 $\rightarrow$ 1 page too less.
136 \item This number of pages to be inserted is distributed across all insertion points.\\Example 1: 3 insertion points and 3 pages, each gets one page.\\Example 2: 3 insertion points and 4 pages, first two get one page, third one gets two pages. This is done by the total limit. At the first point total limit is 1.33 $\rightarrow$ 1 inserted. At the second point, limit is 2.66, 1 already inserted $\rightarrow$ insert 1. At the third insertion point the total limit is 4, 2 already inserted $\rightarrow$ insert 2.
137 \end{enumerate}
138 \end{enumerate}
139
140 \section{References and interferences}
141 To avoid any interference with other packages, I listed the most probable causes for interference.
142
143 The package uses the \verb+\AtBeginDocument+ and \verb+\AtEndDocument+ document hook. If there is some issue with them, it won't work. I experienced some weird behaviour in koma classes with a beta-version of this package, which I couldn't explain. Therefore, it is mentioned here.
144
145 The package writes the following lines to the aux-file:\begin{lstlisting}[breaklines, numbers=none]
146 \global\GFM@FiPa@numberOfFillPagePositions=<Number of fill-page positions>}
147
148 \global\GFM@FiPa@numberOfInsertedPages=<Page count of fill-pages>}
149 \end{lstlisting}\vskip -8pt\relax
150 \noindent Make sure, that they don't interfere with anything of other packages or with any of your counters. Due to the naming this shouldn't happen at all.
151
152
153 \section{Known problems}
154 \subsection{Page number toggles}
155 If you have i.e. 10 pages and define divisible by 4, it should be 12 pages, which makes 2 fill-pages. If the page number toggles between 11 and 13 every two runs, there are two possible reasons:
156 \begin{enumerate}
157 \item You didn't put a clearpage before the \verb+\insertFillPages+
158 \item You defined a custom fill-page which is bigger than one page and will result in two fill-pages, though one should be inserted
159 \end{enumerate}
160
161
162 \section{Bug reports}
163 Nothing to say here. You can post any bug reports on bitbucket, if you find some:
164 \begin{quote}
165 \url{https://bitbucket.org/maestro-glanz/fillpages/src/main/}
166 \end{quote}
167 If you don't have a bitbucket account and don't want to create one, you can post an email to \mbox{text\color{white}.\color{black}\hspace*{-7.5pt} inkerer.1904$@$gmail.com} and hope, that I read it within 3 month. Note:~Copying the mail address will fail. This is for spam precautions. You have to type it off your screen. This is a good memory exercise to keep your mind vital a flexible.
168
169 \section{Revision history}
170 \noindent
171 \begin{tabular}{l l}
172 2017/11/01:& version 0.1.0\\
173 2025/01/07:& version 1.0.0\\
174 2025/01/10:& version 1.0.1\\
175 2025/01/21:& version 1.1.0
176 \end{tabular}
177
178
179 \end{document}
180
181 \section{Version 1.1.0}
182 \long\def\setDefaultFillPage#1{%
183 \def\GFM@FP@defaultFillPage{%
184 #1%
185 }%
186 }
187
188 \section{Before upload}
189 Is the license in
190 - the sty- and tex-files?
191 - readme?
192
193 Is the author name in
194 - the sty- and tex-files?
195 - readme?
196
197 Is the version number in
198 - the docu text?
199 - the sty- and tex-files (+provides package param)?
200 - readme?
201
202 Is the correct revision date in
203 - the docu text?
204 - the sty- and tex-files?
205 - readme?
206
207 Is the repo link in
208 - the docu text?
209 - the sty- and tex-files? -> no
210 - readme? -> no
211
212
213
214
215
216 \chapter{fillpages}