diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/nag/nag.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/nag/nag.sty | 82 |
1 files changed, 51 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/latex/nag/nag.sty b/Master/texmf-dist/tex/latex/nag/nag.sty index 302638cf3a3..732a1784518 100644 --- a/Master/texmf-dist/tex/latex/nag/nag.sty +++ b/Master/texmf-dist/tex/latex/nag/nag.sty @@ -9,9 +9,9 @@ %% %% 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 +%% Current Maintainer is Ulrich M. Schwarz, ulmi@absatzen.de %% -%% Copyright (C) 2005, 2006 by Ulrich M. Schwarz. +%% Copyright (C) 2005-7 by Ulrich M. Schwarz. %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,21 @@ %% http://www.latex-project.org/lppl.txt %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{nag}[2007/03/20 0.53 warning about old commands (ulmi)] +\ProvidesPackage{nag}[2007/06/10 0.60 warning about old commands (ulmi)] \let\@xa\expandafter \let\@nx\noexpand \newcounter{nag@c} \newcounter{nag@sins} +\newcommand\nag@ifundefined[1]{% + \begingroup + \@ifundefined{#1}{\endgroup\@firstoftwo}{\endgroup\@secondoftwo}% +} \newcommand\nag@prepend[2]{% - \@ifundefined{#1}{% + \nag@ifundefined{#1}{% % if it doesn't exist, don't do anything. \PackageInfo{nag}{% - Command \@backslashchar#1\space not defined, skipping amendment - } + Command \@backslashchar#1\space not defined, skipping amendment% + }% }{% \@xa\let \csname nag@@#1@\thenag@c\@xa\endcsname @@ -38,7 +42,7 @@ \@xa\nag@pr@p@nd\csname #1\@xa\endcsname \csname nag@@#1@\thenag@c\endcsname{#2}% \stepcounter{nag@c}% - } + }% } \newcommand\nag@pr@p@nd[3]{% \def#1{#3#2}% @@ -61,6 +65,16 @@ Use #3 instead}% }% }% } +\newcommand\ObsoleteEnv[3][obsolete]{% + \AtBeginDocument{% + \nag@prepend{#2}{% + \nag@warn{% +Environment #2 is #1. +\MessageBreak +Use #3 instead}% + }% + }% +} \newcommand\nag@ifcsname[3]{% \begingroup\@ifundefined{#1}{#3}{#2}\endgroup } @@ -102,36 +116,36 @@ Use #3 instead}% }% } \newif\ifnag@haslabel -\newif\ifnag@hascaption +\newif\ifnag@hascaption\nag@hascaptiontrue \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{% - \ifx\labelprovider\@empty\else - \nag@prepend{\labelprovider}% - {\nag@captioncheck\nag@haslabeltrue} - \fi - }% - \@for\captionprovider:=\nag@captions\do{% - \ifx\captionprovider\@empty\else - \nag@prepend{\captionprovider}{\global\nag@hascaptiontrue}% - \fi - }% \global\nag@haslabelfalse\global\nag@hascaptionfalse }% \nag@prepend{end#1}{% \ifnag@hascaption\relax\else - \nag@warn% -{#1 with no \protect\caption}% + \nag@warn% + {#1 with no \protect\caption}% \fi + % labels outside floats shouldn't complain: + \global\nag@hascaptiontrue + % (we do this always because it needs to be global) }% } +\AtBeginDocument{% +\g@addto@macro{\@preamblecmds}{% + \@for\labelprovider:=\nag@labels\do{% + \ifx\labelprovider\@empty\else + \nag@prepend{\labelprovider}% + {\nag@captioncheck\nag@haslabeltrue}% + \fi + }% + \@for\captionprovider:=\nag@captions\do{% + \ifx\captionprovider\@empty\else + \nag@prepend{\captionprovider}{\global\nag@hascaptiontrue}% + \fi + }% +}% +} \newcommand\nag@captioncheck{% \ifnag@hascaption\else \nag@warn{\protect\label\space in float, but not after @@ -189,13 +203,16 @@ Use #3 instead}% \DeclareRobustCommand\nag@beginenv[1]{% % push a begin-entry onto the stack. Form is % |{\foo{lineno}}| for environment foo. - \xdef\nag@envstack{% + \bgroup + \@xa\toks@\@xa{\nag@envstack}% + \xdef\nag@envstack{% \@nx{% \@xa\@nx\csname #1\endcsname \@nx{\the\inputlineno\@nx}% \@nx}% - \@xa\@nx\nag@envstack - }% + \the\toks@ + }% + \egroup } \DeclareRobustCommand\nag@endenv[1]{% % extract the first entry. @@ -383,6 +400,9 @@ Use #3 instead}% \fi }% \vtop\bgroup + %% ulmi: new 2007/05/10: #2, #3 may contain label command + \csname nag@hascaptiontrue\endcsname + %% and that was it. \vbox\bgroup \ifcase\@tempcnta \@minipagefalse |