summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nag/nag.sty
blob: e10680bb690f25dd16f46fb4e8c22d8ad57c5eae (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
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
%%
%% This is file `nag.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nag.dtx  (with options: `nag')
%% This is a generated file.
%% 
%% This file is part of the `nag' package.
%% The `nag' package has the LPPL maintenance status: maintained.
%% Current Maintainer is Ulrich M. Schwarz, ulmi@users.sarovar.org
%% 
%% Copyright (C) 2005 by Ulrich M. Schwarz.
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3a 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
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nag}[2005/07/07 0.3 warning about nag things (ulmi)]
\newcounter{nag@c}
\newcounter{nag@sins}
 \newcommand\nag@prepend[2]{%
  \expandafter\let
    \csname nag@@#1@\the\value{nag@c}\expandafter\endcsname
    \csname #1\endcsname
  \expandafter\nag@pr@p@nd\csname #1\expandafter\endcsname
    \csname nag@@#1@\the\value{nag@c}\endcsname{#2}%
    \stepcounter{nag@c}%
}
\newcommand\nag@pr@p@nd[3]{%
  \def#1{#3#2}%
}
\newcommand\nag@warn{%
  \addtocounter{nag@sins}{1}%
  \PackageWarning{nag}%
}
\newcommand\nag@warnNoLine{%
  \addtocounter{nag@sins}{1}%
  \PackageWarningNoLine{nag}%
}
\newcommand\ObsoleteCS[3][obsolete]{%
  \AtBeginDocument{%
    \nag@prepend{#2}{%
      \nag@warn{%
Command \expandafter\protect\csname #2\endcsname\space is #1.
\MessageBreak
Use #3 instead}%
    }%
  }%
}
\newcommand\nag@ifcsname[3]{%
  \begingroup\@ifundefined{#1}{#3}{#2}\endgroup
}
\nag@ifcsname{ifcsname}{%
  \renewcommand*\nag@ifcsname[3]{%
    \begingroup
    \ifcsname #1\endcsname #2\else #3\fi
    \endgroup
  }%
  \global\let\nag@ifcsname\nag@ifcsname
}{}
\newcommand\ObsoletePackage[3][obsolete]{%
  \AtEndDocument{%
    \nag@ifcsname{ver@#2.sty}{%
    \nag@warnNoLine{%
      Package #2 is #1.\MessageBreak
      Use #3 instead}%
    }{}%
  }%
}
\newcommand\ObsoleteClass[3][obsolete]{%
  \AtEndDocument{%
    \nag@ifcsname{ver@#2.cls}{%
    \nag@warnNoLine{%
      Class #2 is #1.\MessageBreak
      Use #3 instead}%
    }{}%
  }%
}
\newif\ifnag@haslabel
\newif\ifnag@hascaption
\newcommand\nag@hackfloat[1]{%
  \nag@prepend{#1}{%
    \nag@prepend{endcenter}{%
      \nag@warn%
  {\lq center\rq\space environment in #1.\MessageBreak
    Maybe you want \protect\centering\space instead}
    }%
  }
  \nag@prepend{#1}{%
    \@for\labelprovider:=\nag@labels\do{%
      \nag@prepend{\labelprovider}%
       {\nag@captioncheck\global\nag@haslabeltrue}
    }%
    \@for\captionprovider:=\nag@captions\do{%
      \nag@prepend{\captionprovider}{\global\nag@hascaptiontrue}%
    }%
    \global\nag@haslabelfalse\global\nag@hascaptionfalse
  }%
  \nag@prepend{end#1}{%
    \ifnag@hascaption\relax\else
    \nag@warn%
{#1 with no \protect\caption}%
    \fi
  }%
}
\newcommand\nag@captioncheck{%
  \ifnag@hascaption\else
  \nag@warn{\protect\label\space in float, but not after
    \protect\caption}%
  \fi
}
\def\nag@floats{nag@dummy}
\def\nag@labels{label}
%% The latter two are used by KOMA-Script.
\def\nag@captions{caption,captionabove,captionbelow}
\newcommand\nag@floatsetup{%
  \@for\flo:=\nag@floats\do{%
    \expandafter\nag@hackfloat\expandafter{\flo}%
  }%
}
\AtBeginDocument{%
  \nag@floatsetup
}
\AtBeginDocument{%
  \AtEndDocument{%
    \ifnum\value{nag@sins}>0%
    \PackageWarningNoLine{nag}{\arabic{nag@sins} complaints
      in total}%
    \else
    \typeout{No complaints by nag.}%
    \fi
  }%
}
\DeclareOption*{%
  \InputIfFileExists{\CurrentOption.nag}{%
    \typeout{package nag: Loaded \CurrentOption.nag}%
  }{%
    \PackageWarningNoLine{nag}{Required ruleset
      \CurrentOption.nag, and it wasn't there}
  }%
}
\ProcessOptions*
%%X Local Variables:
%%X mode: latex
%%X End:
\endinput
%%
%% End of file `nag.sty'.