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/doc/latex/nag/nag.pdf | Bin 170338 -> 193564 bytes Master/texmf-dist/doc/latex/nag/nagdemo.tex | 88 ++++-- Master/texmf-dist/source/latex/nag/nag.dtx | 349 +++++++++++++++++---- Master/texmf-dist/source/latex/nag/nag.ins | 6 +- 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 +++-- Master/texmf-dist/tpm/nag.tpm | 11 +- Master/texmf/lists/nag | 1 + 11 files changed, 523 insertions(+), 126 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/nag/nag-experimental.cfg diff --git a/Master/texmf-dist/doc/latex/nag/nag.pdf b/Master/texmf-dist/doc/latex/nag/nag.pdf index 6fb94df3b65..efc1ce598a5 100644 Binary files a/Master/texmf-dist/doc/latex/nag/nag.pdf and b/Master/texmf-dist/doc/latex/nag/nag.pdf differ diff --git a/Master/texmf-dist/doc/latex/nag/nagdemo.tex b/Master/texmf-dist/doc/latex/nag/nagdemo.tex index bd17016207c..6506eb5c933 100644 --- a/Master/texmf-dist/doc/latex/nag/nagdemo.tex +++ b/Master/texmf-dist/doc/latex/nag/nagdemo.tex @@ -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 @@ -21,56 +21,68 @@ %% %% Test document: finding and complaining about obsolete macros. %% -\RequirePackage[l2tabu, orthodox]{nag} +\RequirePackage[l2tabu, orthodox, experimental]{nag}[2007/04/23] \documentclass{article} %% some usual culprits \usepackage{times, a4wide, epsfig, palatino} +%% some fancy packages +\usepackage{subfig, topcapt, caption, hyperref} \begin{document} +\typeout{Next: no complaint because frontmatter is not defined} +\ifx\frontmatter\undefined +\else + \typeout{FAILURE! I shouldn't know frontmatter!} +\fi +\typeout{Next: no complaing about label outside float not preceded by caption} +\section{Tests}\label{sec:tests} \typeout{Next: it and bf complaints} -{\it f{\bf oo}f}highter +{\it italics {\bf not bold italics}} \typeout{Next: not-an-env complaints} \begin{Large} \begin{sffamily} - Foo! + Large and sans. \end{sffamily} \end{Large} \typeout{Next: center in float complaint} \begin{figure} \begin{center} - Foo. + Center in float. \end{center} - \caption{\label{fig}Higher!} + \caption{\label{fig}Figs and dates.} \end{figure} \typeout{Next: no complaints: manually fake caption} \begin{figure} - Foo. + I have a caption, you just can't see it. \makeatletter\nag@hascaptiontrue\makeatother \label{date} \end{figure} +\typeout{Next: no complaing about label outside float not preceded by caption} +\section{More Tests}\label{sec:tests2} + \typeout{Next: put-label-after-caption complaint} \begin{figure} - Foo. - \label{coconut}\caption{Bar.} + \label{coconut}\caption{Preceded, not followed, by label.} \end{figure} \typeout{Next: no-caption complaint} \begin{figure} - Foo. + No caption, even a fake one. \end{figure} \typeout{Next: no complaint about subfloat and topcapt} \begin{figure} - \subfloat{\label{sf:1}Subfig with label.} + \subfloat{\label{sf:1}Subfig number~\ref{sf:1} with label.} + \subfloat[\label{sf:17}Strange subfig]{Subfig~\ref{sf:17} with label elsewhere.} \caption{Figure} \end{figure} \begin{figure} - \topcaption{Figure} - \subfloat{\label{sf:2}Subfig with label.} + \topcaption{A topcaption.} + \subfloat{\label{sf:2}Subfig~\ref{sf:2} with label, but no caption.} \end{figure} \typeout{Next: no robustness issues} @@ -78,23 +90,63 @@ foo\footnote{bar} \end{minipage} +\typeout{Shouldn't cause trouble to have dollars in headings.} +\section{Maths tests, like if $1+1=2$} + +\typeout{Next: three complaints in total concerning $$ end eqnarray} + +A \TeX-style displayed equation: +$$ 1+1=2 $$ + +Not an equation at all: +$ $ 1+1=2 $ $ + +An in line equation: +$1+1=2$ + +Two inline equations, double dollar is dollar dollar in resticted +horizontal mode (onlyamsmath gets this wrong): +$a+b=c$$1+1=2$ + +An eqnarray: +\begin{eqnarray} +1+1 &=& 2 +\end{eqnarray} + +A bracket-style equation: +\[1+1=2\] + +A starred eqnarray: +\begin{eqnarray*} +1+1 &=& 2 +\end{eqnarray*} + +A double-dollar in a hbox: +\hbox{$$} + \typeout{Next: appendix complaints} \begin{appendix} \begin{center} - Foo. + It's a center environment. \end{center} \typeout{Next: no over complaint, centerline complaint, no frac complaint} - \centerline{Ferner gilt $4\over 2=2$.} + Over etc. warning removed for compatibility with \LaTeX\ without amsmath. + + \centerline{Furthermore, $4\over 2=2$.} $\frac 42$ \end{appendix} \typeout{Next: unmatched endflushright} +This is not flushright, in spite of a endflushright coming up. \endflushright \typeout{Next: unclosed center} -{\center Smack in the middle!} +{\center Smack in the middle, but center used as a switch\par} \typeout{Next: mismatched endflushright} + +Another endflushright, this is brace-mismatched and otherwise totally +unsuited for closing the center command above. \endflushright -\typeout{You should get 17 warnings.} +\AtEndDocument{\typeout{You should get 20 warnings.}} \end{document} %%X Local Variables: %%X mode: latex diff --git a/Master/texmf-dist/source/latex/nag/nag.dtx b/Master/texmf-dist/source/latex/nag/nag.dtx index c55efeaa860..ee9c988f834 100644 --- a/Master/texmf-dist/source/latex/nag/nag.dtx +++ b/Master/texmf-dist/source/latex/nag/nag.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2005 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 version 1.3a or, at your @@ -30,56 +30,68 @@ %<*nagdemo> %% Test document: finding and complaining about obsolete macros. %% -\RequirePackage[l2tabu, orthodox]{nag} +\RequirePackage[l2tabu, orthodox, experimental]{nag}[2007/04/23] \documentclass{article} %% some usual culprits \usepackage{times, a4wide, epsfig, palatino} +%% some fancy packages +\usepackage{subfig, topcapt, caption, hyperref} \begin{document} +\typeout{Next: no complaint because frontmatter is not defined} +\ifx\frontmatter\undefined +\else + \typeout{FAILURE! I shouldn't know frontmatter!} +\fi +\typeout{Next: no complaing about label outside float not preceded by caption} +\section{Tests}\label{sec:tests} \typeout{Next: it and bf complaints} -{\it f{\bf oo}f}highter +{\it italics {\bf not bold italics}} \typeout{Next: not-an-env complaints} \begin{Large} \begin{sffamily} - Foo! + Large and sans. \end{sffamily} \end{Large} \typeout{Next: center in float complaint} \begin{figure} \begin{center} - Foo. + Center in float. \end{center} - \caption{\label{fig}Higher!} + \caption{\label{fig}Figs and dates.} \end{figure} \typeout{Next: no complaints: manually fake caption} \begin{figure} - Foo. + I have a caption, you just can't see it. \makeatletter\nag@hascaptiontrue\makeatother \label{date} \end{figure} +\typeout{Next: no complaing about label outside float not preceded by caption} +\section{More Tests}\label{sec:tests2} + \typeout{Next: put-label-after-caption complaint} \begin{figure} - Foo. - \label{coconut}\caption{Bar.} + \label{coconut}\caption{Preceded, not followed, by label.} \end{figure} \typeout{Next: no-caption complaint} \begin{figure} - Foo. + No caption, even a fake one. \end{figure} \typeout{Next: no complaint about subfloat and topcapt} \begin{figure} - \subfloat{\label{sf:1}Subfig with label.} + \subfloat{\label{sf:1}Subfig number~\ref{sf:1} with label.} + \subfloat[\label{sf:17}Strange subfig]{Subfig~\ref{sf:17} with label elsewhere.} \caption{Figure} \end{figure} \begin{figure} - \topcaption{Figure} - \subfloat{\label{sf:2}Subfig with label.} + \topcaption{A topcaption.} + \subfloat{\label{sf:2}Subfig~\ref{sf:2} with label, but no caption.} \end{figure} \typeout{Next: no robustness issues} @@ -87,24 +99,63 @@ foo\footnote{bar} \end{minipage} +\typeout{Shouldn't cause trouble to have dollars in headings.} +\section{Maths tests, like if $1+1=2$} + +\typeout{Next: three complaints in total concerning $$ end eqnarray} + +A \TeX-style displayed equation: +$$ 1+1=2 $$ + +Not an equation at all: +$ $ 1+1=2 $ $ + +An in line equation: +$1+1=2$ + +Two inline equations, double dollar is dollar dollar in resticted +horizontal mode (onlyamsmath gets this wrong): +$a+b=c$$1+1=2$ + +An eqnarray: +\begin{eqnarray} +1+1 &=& 2 +\end{eqnarray} + +A bracket-style equation: +\[1+1=2\] + +A starred eqnarray: +\begin{eqnarray*} +1+1 &=& 2 +\end{eqnarray*} + +A double-dollar in a hbox: +\hbox{$$} \typeout{Next: appendix complaints} \begin{appendix} \begin{center} - Foo. + It's a center environment. \end{center} \typeout{Next: no over complaint, centerline complaint, no frac complaint} - \centerline{Ferner gilt $4\over 2=2$.} + Over etc. warning removed for compatibility with \LaTeX\ without amsmath. + + \centerline{Furthermore, $4\over 2=2$.} $\frac 42$ \end{appendix} \typeout{Next: unmatched endflushright} +This is not flushright, in spite of a endflushright coming up. \endflushright \typeout{Next: unclosed center} -{\center Smack in the middle!} +{\center Smack in the middle, but center used as a switch\par} \typeout{Next: mismatched endflushright} + +Another endflushright, this is brace-mismatched and otherwise totally +unsuited for closing the center command above. \endflushright -\typeout{You should get 17 warnings.} +\AtEndDocument{\typeout{You should get 20 warnings.}} \end{document} % % @@ -142,12 +193,13 @@ %\changes{0.4}{2006/04/19}{Handling command vs. environment; bugfixes} % \changes{0.5}{2006/07/08}{Handle the case that somebody else relaxes % the ver@-commands. Stack-based NotASwitch.} +%\changes{0.55}{2007/03/31}{Some spaces crept in in 0.5} % %\GetFileInfo{nag.sty} %\newcommand\pkg[1]{\textsf{#1}} %\title{The \pkg{nag} package\ignorespaces% % \thanks{This document corresponds to \pkg{nag}~\fileversion, -% dated~\filedate.}} +% dated~\filedate. Other versions can be found at http://absatzen.de/}} % \author{Ulrich Michael Schwarz\ignorespaces% % \thanks{\texttt{ulmi@absatzen.de}}} % @@ -216,17 +268,17 @@ % It is beyond the possibilities of this package to detect things like % use of \TeX\ assignment syntax, or direct change of paper % parameters, or reliable detection of user-issued |\sloppy|. -% Outdated maths environments are not treated because those can -% already be handled by Harald Harders' \pkg{onlyamsmath}. +% eqnarray is handled as of 0.60alpha4, and there is code for \$\$ in +% experimental since 0.60alpha4, which has been moved to l2tabu in 0.60. % -% Be warned, hence, that this package will possibly balk at +% {\bfseries\label{disclaimer} Be warned, that this package will possibly balk at % legitimate use, and not find illegitimate use in all cases. It is a -% tool, not a replacement for study of \pkg{l2tabu}. +% tool, not a replacement for study of \pkg{l2tabu}.} % % \begin{macrocode} %<*l2tabunag> \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. %% @@ -235,7 +287,91 @@ \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 +% \end{macrocode} +% Hacking galore ahead! We will make the dollar active. Since unlike +% \pkg{onlyamsmath}, we do not change the user's command to \LaTeX\ or +% \pkg{amsmath} commands, we need to store the old double dollar +% sequence as well as the single dollar. +% \begin{macrocode} +\def\nag@doubledollar{$$}%$$ +\def\nag@singledollar{$}%$ +% \end{macrocode} +% This is used to hide our redefinition in unprotected expanding +% context. This should not happen: you are expected to \emph{always} +% use protected means of expansion in \LaTeX, but fecal matter +% happens. See below for a good trick to distinguish expansion from +% executing context. +% \begin{macrocode} +\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 + }% +} +% \end{macrocode} +% If the user doesn't load \pkg{hyperref}, we have to fake its +% \cmd{\texorpdfstring} command. Note that this will break any package that +% is foolish enough to detect \pkg{hyperref} by testing for +% definedness of \cmd{\texorpdfstring}. +% \begin{macrocode} +\AtBeginDocument{\providecommand\texorpdfstring{\@firstoftwo}} +\AtBeginDocument{\catcode`$\active}%$ +% \end{macrocode} +% Now, the proper testing. (Yes, the above is just the +% technicalities.) We use the kernel's \cmd{\@ifnextchar} to look for +% a possible second dollar. Note however, this would allow skipping of +% spaces between them, and \$\_\$ is not a displayed equation start in +% \TeX. We work around this by re\cmd{\let}ting \cmd{\@sptoken} to +% something that cannot legally appear in the source. +% \begin{macrocode} +\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. @@ -301,6 +437,14 @@ %% \S 3.1 \NagDeclareFloat{figure}\NagDeclareFloat{table}% \g@addto@macro\nag@labels{,label}% +% \changes{0.60}{2007/03/31}{alternate center-in-float check, doesn't +% take up as many macro names} +\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. % \changes{0.53}{2007/03/21}{hypcap support. (H.G.Krauth\"auser)} % \changes{0.53}{2007/03/21}{topcapt support.} @@ -312,7 +456,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 -- % % \end{macrocode} @@ -366,6 +513,14 @@ } % % \end{macrocode} +%<*experimentalnag> +%\subsection{\texttt{nag-experimental.cfg}} +% Functionality that needs more testing. +% \begin{macrocode} +\ProvidesFile{nag-experimental.cfg} + [2007/06/10 v0.1b experimental additions to nag (ulmi)] +% \end{macrocode} +% % %<*nag> % \section{Author-side considerations and implementation.} @@ -381,7 +536,7 @@ % Identify ourselves. % \begin{macrocode} \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 % \end{macrocode} @@ -403,27 +558,44 @@ % (With thanks to Juergen Goebel, Heiko Oberdiek and Rolf Niepraschk % (\pkg{savesym})) % +% From $0.60\alpha_2$ on, nag is more robust about not defining +% commands that are not there. Now, they're not even relaxed. +% \begin{macrocode} +\newcommand\nag@ifundefined[1]{% + \begingroup + \@ifundefined{#1}{\endgroup\@firstoftwo}{\endgroup\@secondoftwo}% +} +% \end{macrocode} % \changes{0.51}{2006/10/21}{bugfix} % Don't define the macro if it's not there. This confuses caption, % which loads ragged2e AtBeginDocument, at which point, RaggedLeft % et al. were already defined by us. % \changes{0.52}{2007/02/25}{info} +% \changes{0.60alpha2}{2007/04/08}{don't even relax unknown +% commands (J.Sommer)} % \dots but \emph{do} log a message. % \begin{macrocode} \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 \csname #1\endcsname \@xa\nag@pr@p@nd\csname #1\@xa\endcsname \csname nag@@#1@\thenag@c\endcsname{#2}% +% \end{macrocode} +% Fun with scoping: one might think we can get away with a (non-local) +% |\advance\c@nag@c 1\relax| here. This would lead to less hashtable +% usage. Problem: if a nag@@foo@17 macro ever escapes its scope, it +% might be bound to something else entirely. This might occur with +% some of the fancier table packages which use external files? +% \begin{macrocode} \stepcounter{nag@c}% - } + }% } \newcommand\nag@pr@p@nd[3]{% \def#1{#3#2}% @@ -470,6 +642,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\ObsoleteEnv} +% \changes{0.60alpha4}{2007/04/23}{There was no ObsoleteEnv?!} +% \begin{macrocode} +\newcommand\ObsoleteEnv[3][obsolete]{% + \AtBeginDocument{% + \nag@prepend{#2}{% + \nag@warn{% + Environment #2 is #1. + \MessageBreak + Use #3 instead}% + }% + }% +} +% \end{macrocode} +% \end{macro} +% % \subsection{Obsoletifying packages and classes.} % % Checking for packages and classes is done by looking for @@ -578,23 +766,37 @@ % environment, which gives them plenty of time to call % |\csname nag@haslabeltrue\endcsname| et al. % (Thanks to Markus Kohm for pointing out this need.) +% We initialize |\nag@hascaption| to be true because since 0.60, +% |\label| always checks if it's after a caption, even outside of +% floats. % \begin{macrocode} \newif\ifnag@haslabel -\newif\ifnag@hascaption +\newif\ifnag@hascaption\nag@hascaptiontrue % \end{macrocode} -% Now, to the work proper: first, add the endcenter check, then, -% prepare to set up the caption/label checks locally to the floats, -% and finally, add the code that generates the warning. +% Now, to the work proper: as of 0.60, it is sufficient to set the +% label and caption flags to false. |\endcenter| now always checks +% if it is inside a float (looking at |\@captype|). The label and +% caption commands are amended only once. This should be +% sufficient: captions are not handled by letting |\caption| to the +% proper command upon float entry, so we assume nobody redefines +% |\caption| at runtime, or they provide more entries to +% |\nag@captions|. Similar for |\label|, and we do not care about +% the flag setting outside of floats. % \begin{macrocode} \newcommand\nag@hackfloat[1]{% \nag@prepend{#1}{% - \nag@prepend{endcenter}{% + \global\nag@haslabelfalse\global\nag@hascaptionfalse + }% + \nag@prepend{end#1}{% + \ifnag@hascaption\relax\else \nag@warn% - {\lq center\rq\space environment in #1.\MessageBreak - Maybe you want \protect\centering\space instead} - }% - } - \nag@prepend{#1}{% + {#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) + }% +} % \end{macrocode} % Add checks to all macros named by |\nag@labels| % and |\nag@captions|, respectively. @@ -604,30 +806,35 @@ % Well, maybe I should do it the way the kernel does, which means % a label is just as local as |\refstepcounter|'s |\@currentlabel| % information as of v0.4. I think we can leave captions global. +% \changes{0.60}{2007/03/31}{Captions/Labels now done only once, and not every time +% we enter a float} +% \changes{0.60}{2007/03/31}{@preamblecmds} +% Big old hack: we do this at |\@preamblecmds|-time, which is after +% |\AtBeginDocument|, since hyperref loads nameref ABD, and nameref +% steps all over label. \emph{Note:} We cannot use |\nag@prepend| +% for this, since it would break the pkgindoc package, which nobody +% has ever heard of, but it's in the kernel and relies on certain +% tokens being present in the expansion of |\@preamblecmds|. Now, +% you pretty much cannot get any later than this. % % \emph{Note:} we cannot exchange the order of the for loops here: % if a cs generates both a label and a caption, it shouldn't get % complained about. % \begin{macrocode} - \@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 +\AtBeginDocument{% +\g@addto@macro{\@preamblecmds}{% + \@for\labelprovider:=\nag@labels\do{% + \ifx\labelprovider\@empty\else + \nag@prepend{\labelprovider}% + {\nag@captioncheck\nag@haslabeltrue}% + \fi }% - \nag@prepend{end#1}{% - \ifnag@hascaption\relax\else - \nag@warn% - {#1 with no \protect\caption}% + \@for\captionprovider:=\nag@captions\do{% + \ifx\captionprovider\@empty\else + \nag@prepend{\captionprovider}{\global\nag@hascaptiontrue}% \fi - }% + }% +}% } \newcommand\nag@captioncheck{% \ifnag@hascaption\else @@ -692,7 +899,7 @@ % dangerous in because it tends to \emph{almost} work. % (Consider font size commands in particular, but also |\centering| % vs. |center| environment.) As usual, ``it's not an error if you -% know what you're doing''. In particular, it is perfectly valied +% know what you're doing''. In particular, it is perfectly valid % code to use the |\foo|\dots|\endfoo| syntax. So, |\NotASwitch| % needs to trace the calls to |\foo| and see if they match with % corresponding |\endfoo|s with its own stack. This might still be @@ -740,6 +947,7 @@ % Issue an error if the user calls |\command| and not % |\begin{command}| and mis-nests calls or doesn't call % |\endcommand| at all. +% \changes{0.54}{2007/03/27}{bugfix: can't get around the token register. (J\"org Sommer)} % \begin{macrocode} % we need to maintain a stack of environments that are used in the % \foo...\endfoo way. @@ -748,13 +956,16 @@ \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. @@ -974,6 +1185,9 @@ \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 @@ -1038,6 +1252,19 @@ \newcommand*\NagDeclareFloat[1]{\g@addto@macro\nag@floats{,#1}} % \end{macrocode} % +% \subsection{The \pkg{topcapt} package and the \pkg{subfig} package} +% nagdemo exhibits an error when topcapt and subfig are used +% together, i.e. \pkg{subfig} thinks the caption has not been +% stepped already. This is not a bug in \pkg{nag}. +% +% \subsection{The \pkg{rotating} package} +% \pkg{rotating} uses \cmd{\centerline} to place rotated floats. As +% far as I can see, the usage is legitimate there, and using +% \cmd{\centering} instead would change behaviour when the float's +% dimension are larger than the text body. (Currently, the height +% of the figure may exceed \cmd{\textwidth} without warning.) If this +% bothers you, go read the warning on p.~\pageref{disclaimer} again. +% % % \section{Loading extensions} % Finally, we deal with package options. diff --git a/Master/texmf-dist/source/latex/nag/nag.ins b/Master/texmf-dist/source/latex/nag/nag.ins index 3c8dbe0b1bd..28ecaab65a5 100644 --- a/Master/texmf-dist/source/latex/nag/nag.ins +++ b/Master/texmf-dist/source/latex/nag/nag.ins @@ -8,9 +8,9 @@ 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 +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 @@ -24,6 +24,7 @@ http://www.latex-project.org/lppl.txt \file{nag-l2tabu.cfg}{\from{nag.dtx}{l2tabunag}} \file{nag-abort.cfg}{\from{nag.dtx}{abortnag}} \file{nag-orthodox.cfg}{\from{nag.dtx}{orthodoxnag}} + \file{nag-experimental.cfg}{\from{nag.dtx}{experimentalnag}} \file{nagdemo.tex}{\from{nag.dtx}{nagdemo}}} \Msg{*********************************************************} \Msg{*} @@ -34,6 +35,7 @@ http://www.latex-project.org/lppl.txt \Msg{* \space\space nag-l2tabu.cfg} \Msg{* \space\space nag-abort.cfg} \Msg{* \space\space nag-orthodox.cfg} +\Msg{* \space\space nag-experimental.cfg} \Msg{*} \Msg{* To produce the fully-indexed documentation run} \Msg{latex nag.dtx} 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 diff --git a/Master/texmf-dist/tpm/nag.tpm b/Master/texmf-dist/tpm/nag.tpm index 1ff94716a2f..da9e59136c3 100644 --- a/Master/texmf-dist/tpm/nag.tpm +++ b/Master/texmf-dist/tpm/nag.tpm @@ -3,7 +3,7 @@ nag Package - 2007/04/03 21:21:18 + 2007/06/17 23:23:36 karl @@ -18,22 +18,23 @@ l2tabu. [description copied from TeX Catalogue] - 230235 + 230242 - + texmf-dist/tex/latex/nag/nag-abort.cfg +texmf-dist/tex/latex/nag/nag-experimental.cfg texmf-dist/tex/latex/nag/nag-l2tabu.cfg texmf-dist/tex/latex/nag/nag-orthodox.cfg texmf-dist/tex/latex/nag/nag.sty texmf-dist/tpm/nag.tpm - + texmf-dist/doc/latex/nag/README texmf-dist/doc/latex/nag/nag.pdf texmf-dist/doc/latex/nag/nagdemo.tex - + texmf-dist/source/latex/nag/nag.dtx texmf-dist/source/latex/nag/nag.ins diff --git a/Master/texmf/lists/nag b/Master/texmf/lists/nag index 5f5817dce80..f99d3d7d302 100644 --- a/Master/texmf/lists/nag +++ b/Master/texmf/lists/nag @@ -4,6 +4,7 @@ texmf-dist/doc/latex/nag/nagdemo.tex texmf-dist/source/latex/nag/nag.dtx texmf-dist/source/latex/nag/nag.ins texmf-dist/tex/latex/nag/nag-abort.cfg +texmf-dist/tex/latex/nag/nag-experimental.cfg texmf-dist/tex/latex/nag/nag-l2tabu.cfg texmf-dist/tex/latex/nag/nag-orthodox.cfg texmf-dist/tex/latex/nag/nag.sty -- cgit v1.2.3