summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/counttexruns/counttexruns.sty
blob: 317b46d8f58e04fcd66a54a0dbb8a49124780e15 (plain)
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
%% See file 'counttexruns.dtx' for copyright and licence.
\NeedsTeXFormat{LaTeX2e}[1998/12/01]
\ProvidesPackage{counttexruns}
    [2012/08/27 v1.00 Counts the TeX runs]
%% ^^A \% is ignored ...
\newcounter{counttexruns}
\newwrite\@counttexrunsfile
\RequirePackage{kvoptions}
\DeclareStringOption[ctr]{extension}
\ProcessLocalKeyvalOptions*
\IfFileExists{\jobname.\counttexruns@extension}{
\immediate\openin\@counttexrunsfile=\jobname.\counttexruns@extension
\immediate\read\@counttexrunsfile to \counttexruns
\immediate\read\@counttexrunsfile to \counttexruns
\immediate\closeout\@counttexrunsfile
\setcounter{counttexruns}{\counttexruns}
}{} %% \value{counttexruns} is still zero
\stepcounter{counttexruns}
\immediate\openout\@counttexrunsfile=\jobname.\counttexruns@extension
\catcode`\%=11\relax
\immediate\write\@counttexrunsfile{%% This file
  '\jobname.\counttexruns@extension' was generated by the package counttexruns}
\catcode`\%=14\relax
\immediate\write\@counttexrunsfile{\arabic{counttexruns}}
\immediate\closeout\@counttexrunsfile
\endinput
%%
%% End of file `counttexruns.sty'.