From 01d27f3a5e3fe5d21a3d5aec43fd2a489783f881 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 17 Jun 2007 23:24:00 +0000 Subject: nag update (11jun07) git-svn-id: svn://tug.org/texlive/trunk@4461 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/nag/nag-abort.cfg | 4 +- .../texmf-dist/tex/latex/nag/nag-experimental.cfg | 29 ++++++++ Master/texmf-dist/tex/latex/nag/nag-l2tabu.cfg | 75 ++++++++++++++++++-- Master/texmf-dist/tex/latex/nag/nag-orthodox.cfg | 4 +- Master/texmf-dist/tex/latex/nag/nag.sty | 82 ++++++++++++++-------- 5 files changed, 154 insertions(+), 40 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/nag/nag-experimental.cfg (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/nag/nag-abort.cfg b/Master/texmf-dist/tex/latex/nag/nag-abort.cfg index 5102e831b4f..247f1c7e91d 100644 --- a/Master/texmf-dist/tex/latex/nag/nag-abort.cfg +++ b/Master/texmf-dist/tex/latex/nag/nag-abort.cfg @@ -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 diff --git a/Master/texmf-dist/tex/latex/nag/nag-experimental.cfg b/Master/texmf-dist/tex/latex/nag/nag-experimental.cfg new file mode 100644 index 00000000000..67fcce045e7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/nag/nag-experimental.cfg @@ -0,0 +1,29 @@ +%% +%% This is file `nag-experimental.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% nag.dtx (with options: `experimentalnag') +%% 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@absatzen.de +%% +%% 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 +%% 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 +%% +\ProvidesFile{nag-experimental.cfg} + [2007/06/10 v0.1b experimental additions to nag (ulmi)] +%%X Local Variables: +%%X mode: latex +%%X End: +\endinput +%% +%% End of file `nag-experimental.cfg'. diff --git a/Master/texmf-dist/tex/latex/nag/nag-l2tabu.cfg b/Master/texmf-dist/tex/latex/nag/nag-l2tabu.cfg index 48ae1474d6e..3ca2e7a0878 100644 --- a/Master/texmf-dist/tex/latex/nag/nag-l2tabu.cfg +++ b/Master/texmf-dist/tex/latex/nag/nag-l2tabu.cfg @@ -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,7 +20,7 @@ %% http://www.latex-project.org/lppl.txt %% \ProvidesFile{nag-l2tabu.cfg} - [2007/03/21 v1.8b l2tabu rules for nag.sty (ulmi)] + [2007/06/10 v2.0 l2tabu rules for nag.sty (ulmi)] %% %% The sins. %% @@ -29,7 +29,63 @@ \ObsoletePackage{a4wide}{the \lq a4paper\rq\space class option} \ObsoletePackage{a4}{the \lq a4paper\rq\space class option} %% \S 1.2--1.5 cannot reasonably be checked programmatically -%% \S 1.6 is handled by H.Harders' onlyamsmath package +%% \S 1.6 +\def\nag@doubledollar{$$}%$$ +\def\nag@singledollar{$}%$ +\def\nag@expanding@voodoo#1#2#3{\relax\relax\nag@singledollar} + +\def\nag@maybedispmath{% + \texorpdfstring{% + %% in TeX context, do tricky stuff. + \ifinner\expandafter\@firstoftwo + \else\expandafter\@secondoftwo\fi + {%% in inner mode, $$ is an empty formula, so no testing wanted. + \nag@singledollar}% + {%% + \ifx\protect\@typeset@protect\expandafter\@firstoftwo + \else\expandafter\@secondoftwo\fi + {%% normal case: looks like typesetting + %% protect against strictly expanding context + %% like TeX' \message: the first expanding voodoo will expand, + %% removing the rest, inserting \relax\relax$ instead. This is + %% not totally transparent, but \let\relax\relax is as close + %% to a no-op as we can get. + \let\nag@expanding@voodoo\nag@expanding@voodoo + \protect\nag@maybe@dispmath}% + {%% some other case, hide ourselves + \nag@singledollar}% + }% + }{% + %% in pdf context, just be a math shift. This creates the "math + %% shift not allowed" warnings we all love. + \nag@singledollar + }% +} +\AtBeginDocument{\providecommand\texorpdfstring{\@firstoftwo}} +\AtBeginDocument{\catcode`$\active}%$ +\bgroup + \catcode`$\active%$ + \gdef\nag@maybe@dispmath{% + \bgroup + \let\@sptoken\nag@quark% prevent skipping of spaces + \@ifnextchar${%$% + \ifmmode + % we already warned upon entering. + \else + \nag@warn{% + \nag@doubledollar...\nag@doubledollar\space is obsolete.\MessageBreak + Use \string\[...\string\] et al. instead}% + \fi + \egroup\expandafter\nag@doubledollar\@gobble + }{% + \egroup\nag@singledollar + }% + } + % we do the assignment here, which means any package that redefines + % \$ as well will silently disable us. This is a feature. + \global\let$\nag@maybedispmath%$ +\egroup + %% \S 1.7 cannot reasonably be checked programmatically %% \S 1.8 \sloppy is called by parbox, among others, and would %% give many spurious warnings. @@ -95,6 +151,12 @@ %% \S 3.1 \NagDeclareFloat{figure}\NagDeclareFloat{table}% \g@addto@macro\nag@labels{,label}% +\nag@prepend{endcenter}{% + \ifx\@captype\@undefined\else + \nag@warn{\lq center\rq\space environment in \@captype.\MessageBreak + Maybe you want \protect\centering\space instead}% + \fi +}% %% The latter two are used by KOMA-Script, the last by hypcap. \g@addto@macro\nag@captions{,caption,captionabove,captionbelow,hc@caption,topcaption}% @@ -104,7 +166,10 @@ \@for\sectioning:=frontmatter,mainmatter,backmatter\do{% \expandafter\NotAnEnvironment\expandafter{\sectioning}% } -%% \S 3.3 handled by onlyamsmath. +%% \S 3.3 +%% It's more trouble than it's worth to have another warning for +%% align*, since it passes through align. +\ObsoleteEnv{eqnarray}{amsmath's align} %% \S 3.4 -- nothing to be done -- %%X Local Variables: %%X mode: latex diff --git a/Master/texmf-dist/tex/latex/nag/nag-orthodox.cfg b/Master/texmf-dist/tex/latex/nag/nag-orthodox.cfg index 5552c9b0b67..224543b8db8 100644 --- a/Master/texmf-dist/tex/latex/nag/nag-orthodox.cfg +++ b/Master/texmf-dist/tex/latex/nag/nag-orthodox.cfg @@ -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 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 -- cgit v1.2.3