1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
%%
%% This is file `rerunfilecheck.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% rerunfilecheck.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2009, 2010 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%% http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Heiko Oberdiek.
%%
%% This work consists of the main source file rerunfilecheck.dtx
%% and the derived files
%% rerunfilecheck.sty, rerunfilecheck.pdf, rerunfilecheck.ins,
%% rerunfilecheck.drv, rerunfilecheck-example.cfg,
%% rerunfilecheck-test1.tex.
%%
\begingroup
\catcode123 1 % {
\catcode125 2 % }
\def\x{\endgroup
\expandafter\edef\csname ReFiCh@AtEnd\endcsname{%
\catcode35 \the\catcode35\relax
\catcode64 \the\catcode64\relax
\catcode123 \the\catcode123\relax
\catcode125 \the\catcode125\relax
}%
}%
\x
\catcode35 6 % #
\catcode64 11 % @
\catcode123 1 % {
\catcode125 2 % }
\def\TMP@EnsureCode#1#2{%
\edef\ReFiCh@AtEnd{%
\ReFiCh@AtEnd
\catcode#1 \the\catcode#1\relax
}%
\catcode#1 #2\relax
}
\TMP@EnsureCode{39}{12}% '
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{44}{12}% ,
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{58}{12}% :
\TMP@EnsureCode{59}{12}% ;
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{91}{12}% [
\TMP@EnsureCode{93}{12}% ]
\TMP@EnsureCode{96}{12}% `
\g@addto@macro\ReFiCh@AtEnd{\endinput}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{rerunfilecheck}%
[2010/01/25 v1.3 Rerun checks for auxiliary files (HO)]
\RequirePackage{kvoptions}[2009/07/17]
\SetupKeyvalOptions{%
family=rerunfilecheck,%
prefix=ReFiCh@%
}
\newcommand*{\RerunFileCheckSetup}{%
\setkeys{rerunfilecheck}%
}
\DeclareBoolOption{mainaux}
\DeclareBoolOption{partaux}
\DeclareBoolOption{starttoc}
\DeclareBoolOption{index}
\DeclareBoolOption{glossary}
\define@key{rerunfilecheck}{aux}[true]{%
\RerunFileCheckSetup{%
mainaux={#1},%
partaux={#1},%
starttoc={#1},%
index={#1},%
glossary={#1}%
}%
}
\InputIfFileExists{rerunfilecheck.cfg}{}{}
\ProcessKeyvalOptions*
\def\ReFiCh@DisableOption{%
\DisableKeyvalOption[%
action=warning,%
package=rerunfilecheck%
]{rerunfilecheck}%
}
\RequirePackage{infwarerr}[2007/09/09]
\RequirePackage{pdftexcmds}[2009/04/10]
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdf@filemdfivesum\endcsname\relax
\@PackageInfoNoLine{rerunfilecheck}{%
Feature \string\pdfmdfivesum\space is not available\MessageBreak
(e.g. pdfTeX or LuaTeX with package `pdftexcmds').\MessageBreak
Therefore file contents cannot be checked efficiently\MessageBreak
and the loading of the package is aborted%
}%
\newcommand*{\RerunFileCheck}[3]{}%
\renewcommand*{\RerunFileCheckSetup}[1]{}%
\expandafter\ReFiCh@AtEnd
\fi
\ifReFiCh@partaux
\let\ReFiCh@org@include\@include
\def\@include#1 {%
\if@filesw
\RerunFileCheck{#1.aux}{}{}%
\fi
\ReFiCh@org@include{#1} %
}%
\fi
\ifReFiCh@mainaux
\AtBeginDocument{%
\ReFiCh@mainauxfalse
}%
\ifReFiCh@mainaux
\AtEndOfPackage{%
\RerunFileCheck{\jobname.aux}{}{}%
}%
\else
\if@filesw
\@PackageWarningNoLine{rerunfilecheck}{%
Main aux file check is disabled,\MessageBreak
because the file is already opened.\MessageBreak
Load the package before \string\begin{document}%
}%
\fi
\fi
\fi
\ifReFiCh@starttoc
\let\ReFiCh@org@starttoc\@starttoc
\def\@starttoc#1{%
\if@filesw
\RerunFileCheck{\jobname.#1}{%
\@ifundefined{tf@#1}{%
}{%
\immediate\closeout\csname tf@#1\endcsname
}%
}{}%
\fi
\ReFiCh@org@starttoc{#1}%
}%
\fi
\ifReFiCh@index
\ifx\makeindex\@empty
\@PackageWarningNoLine{rerunfilecheck}{%
Option `index' ignored,\MessageBreak
because \string\makeindex\space has already been called%
}%
\else
\def\ReFiCh@temp{%
\newwrite\@indexfile
\immediate\openout\@indexfile=\jobname.idx %
\def\index{%
\@bsphack
\begingroup
\@sanitize
\@wrindex
}%
\typeout{Writing index file \jobname.idx}%
\let\makeindex\@empty
}%
\ifx\ReFiCh@temp\makeindex
\def\makeindex{%
\newwrite\@indexfile
\RerunFileCheck{\jobname.idx}{%
\immediate\closeout\@indexfile
}{%
Rerun LaTeX/makeindex to get index right%
}%
\immediate\openout\@indexfile=\jobname.idx %
\def\index{%
\@bsphack
\begingroup
\@sanitize
\@wrindex
}%
\typeout{Writing index file \jobname.idx}%
\let\makeindex\@empty
}%
\else
\@PackageInfoNoLine{rerunfilecheck}{%
Option `index': unsupported version of \string\makeindex
}%
\fi
\fi
\fi
\ifReFiCh@glossary
\ifx\makeglossary\@empty
\@PackageWarningNoLine{rerunfilecheck}{%
Option `glossary' ignored,\MessageBreak
because \string\makeglossary\space has already been called%
}%
\else
\def\ReFiCh@temp{%
\newwrite\@glossaryfile
\immediate\openout\@glossaryfile=\jobname.glo %
\def\glossary{%
\@bsphack
\begingroup
\@sanitize
\@wrglossary
}%
\typeout{Writing glossary file \jobname.glo }%
\let\makeglossary\@empty
}%
\ifx\ReFiCh@temp\makeglossary
\def\ReFiCh@temp{%
\newwrite\@glossaryfile
\RerunFileCheck{\jobname.glo}{%
\immediate\closeout\@glossaryfile
}{%
Rerun LaTeX/makeindex to get glossary right%
}%
\immediate\openout\@glossaryfile=\jobname.glo %
\def\glossary{%
\@bsphack
\begingroup
\@sanitize
\@wrglossary
}%
\typeout{Writing glossary file \jobname.glo}%
\let\makeglossary\@empty
}%
\else
\@PackageInfoNoLine{rerunfilecheck}{%
Option `glossary': unsupported version of \string\makeglossary
}%
\fi
\fi
\fi
\ReFiCh@DisableOption{mainaux}
\ReFiCh@DisableOption{partaux}
\ReFiCh@DisableOption{starttoc}
\ReFiCh@DisableOption{index}
\ReFiCh@DisableOption{glossary}
\ReFiCh@DisableOption{aux}
\RequirePackage{atveryend}[2009/12/07]
\RequirePackage{uniquecounter}[2009/12/18]
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdf@filesize\endcsname\relax
\def\ReFiCh@CheckSum{%
\pdf@filemdfivesum
}%
\else
\def\ReFiCh@CheckSum#1{%
\pdf@filemdfivesum{#1}%
\ReFiCh@Separator
\pdf@filesize{#1}%
}%
\fi
\def\ReFiCh@Separator{;}
\def\ReFiCh@NoFile{<no file>}
\UniqueCounterNew{rerunfilecheck}
\newcommand*{\RerunFileCheck}{%
\UniqueCounterCall{rerunfilecheck}\ReFiCh@RerunFileCheck
}
\def\ReFiCh@RerunFileCheck#1{%
\expandafter\ReFiCh@@RerunFileCheck\csname ReFiCh@#1\endcsname
}
\def\ReFiCh@@RerunFileCheck#1#2#3#4{%
\xdef#1{\ReFiCh@CheckSum{#2}}%
\ifx#1\ReFiCh@Separator
\global\let#1\ReFiCh@NoFile
\fi
\AtVeryEndDocument{%
\begingroup
#3%
\edef\x{\ReFiCh@CheckSum{#2}}%
\ifx\x\ReFiCh@Separator
\let\x\ReFiCh@NoFile
\fi
\ifx#1\x
\@PackageInfoNoLine{rerunfilecheck}{%
File `#2' has not changed.\MessageBreak
Checksum: \x
}%
\else
\ifnum
\ReFiCh@IsAux#2\relax.aux\relax\@nil
\ifx#1\ReFiCh@NoFile 1\else 0\fi
\ifx\x\ReFiCh@AuxEmptyUnix 1%
\else
\ifx\x\ReFiCh@AuxEmptyDos 1\fi
\fi
=111 %
\@PackageInfoNoLine{rerunfilecheck}{%
File `#2' is empty .aux file.\MessageBreak
Before: #1\MessageBreak
After: \space\x
}%
\else
\@PackageWarningNoLine{rerunfilecheck}{%
File `#2' has changed.%
\ifx\\#4\\%
\space Rerun%
\else
\MessageBreak
#4%
\fi
}%
\@PackageInfoNoLine{rerunfilecheck}{%
Checksums for `#2':\MessageBreak
Before: #1\MessageBreak
After: \space\x
}%
\fi
\fi
\endgroup
}%
}
\def\ReFiCh@IsAux#1.aux\relax#2\@nil{%
\ifx\hbox#2\hbox
0%
\else
1%
\fi
}
\def\ReFiCh@AuxEmptyUnix{A94A2480D3289E625EEA47CD1B285758;8}%
\@onelevel@sanitize\ReFiCh@AuxEmptyUnix
\def\ReFiCh@AuxEmptyDos{A62A15ECE803E2EBE94952FCC9933BC0;9}%
\@onelevel@sanitize\ReFiCh@AuxEmptyDos
\ReFiCh@AtEnd
\endinput
%%
%% End of file `rerunfilecheck.sty'.
|