summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/counttexruns/counttexruns.sty
blob: 9313c6334c58eb767a65c6cd683b95931e2ac8a4 (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/31 v1.00a Count compilations of a document]
%% ^^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\closein\@counttexrunsfile
  \setcounter{counttexruns}{\@counttexruns}
}{}
\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'.