summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/eskdx/eskdtotal.sty
blob: 2bc12352eda98de72e7d6e3e2d10615cc5ffa582 (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
% Copyright 2006 Konstantin Korikov <lostclus@ua.fm>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% 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 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Konstantin Korikov.
%
% This work consists of all files listed in manifest.txt.
%

%
% This is automaticaly generated file, do not edit it.
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{eskdtotal}[2006/12/17 v0.97 Total number of tables, figures, etc]

\RequirePackage{eskdsect}

\let\ESKD@old@caption\@caption
\let\ESKD@old@bibitem\bibitem

\newcounter{ESKD@figure}
\newcounter{ESKD@table}
\newcounter{ESKD@bibitem}

\long\def\@caption#1[#2]#3{%
  \stepcounter{ESKD@#1}%
  \ESKD@old@caption{#1}[#2]{#3}}

\long\def\bibitem{%
  \stepcounter{ESKD@bibitem}%
  \ESKD@old@bibitem}

\def\ESKD@total@save#1#2{%
  \immediate\write\@auxout{%
    \string\gdef\string\ESKD@total@saved@\string#1{\arabic{#2}}}}

\AtEndDocument{%
  \ESKD@total@save{figure}{ESKD@figure}
  \ESKD@total@save{table}{ESKD@table}
  \ESKD@total@save{bibitem}{ESKD@bibitem}
  \ESKD@total@save{appendix}{appendix}
  \clearpage
  \addtocounter{page}{-1}
  \ESKD@total@save{page}{page}
  \addtocounter{page}{1}}

\newcommand{\ESKDtotal}[1]{%
  \@ifundefined{ESKD@total@saved@#1}{?}{%
    \@nameuse{ESKD@total@saved@#1}}}