summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pagecont/pagecont.sty
blob: d2b85739c7630da0648f88783101e293065cb49d (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
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
%%
%% This is file `pagecont.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pagecont.dtx 
%% 
%% Copyright (C) 2007 Miguel V. S. Frasson (mvsfrasson@gmail.com)
%% 
%% This file is part of the `pagecont' package.
%% 
%% This package may be distributed under the terms of the LaTeX
%% Project Public License, as described in lppl.txt in the base
%% LaTeX distribution, either version 1.2 or (at your option)
%% any later version.
%% 
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pagecont}%
    [2009/05/26 v1 Page numbering continuation between documents]
  \RequirePackage{keyval}
\newif\ifPGC@first
\PGC@firstfalse
\DeclareOption{first}{\PGC@firsttrue}
\newcommand{\PGC@savefile}{pagecont.pco}
\define@key{PGC@}{savefile}{\renewcommand{\PGC@savefile}{#1}}
\newcommand{\PGC@kvsetkeys}[1]{\setkeys{PGC@}{#1}}
\DeclareOption*{\expandafter\PGC@kvsetkeys\expandafter{\CurrentOption}}
\ProcessOptions
\newcommand{\PGC@lastfilelastpage}{0}
\newcommand{\PGC@info}[3]{%
  \edef\PGC@jobname{\jobname}%
  \def\PGC@jobnamesaved{#1}%
  \edef\PGC@jobnamesaved{\expandafter\strip@prefix\meaning\PGC@jobnamesaved}%
  \ifx\PGC@jobname\PGC@jobnamesaved
    \renewcommand{\PGC@lastfilelastpage}{#2}%
    \setcounter{page}{#2}%
  \else
    \renewcommand{\PGC@lastfilelastpage}{#3}%
    \setcounter{page}{#3}%
  \fi
\addtocounter{page}{1}}
\newcommand{\PGC@saveinfo}{%
  \newwrite\PGC@file
  \expandafter\openout\expandafter\PGC@file\PGC@savefile\relax
  \write\PGC@file
     {\string\PGC@info{\jobname}{\PGC@lastfilelastpage}{\arabic{page}}}}
\AtEndDocument{\PGC@saveinfo}
\ifPGC@first
\else
  \IfFileExists{\PGC@savefile}{\input{\PGC@savefile}}{}
\fi
\endinput
%%
%% End of file `pagecont.sty'.