summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/nag/nag.dtx448
-rw-r--r--Master/texmf-dist/source/latex/nag/nag.ins12
2 files changed, 343 insertions, 117 deletions
diff --git a/Master/texmf-dist/source/latex/nag/nag.dtx b/Master/texmf-dist/source/latex/nag/nag.dtx
index 3a39009b428..73b41b15b40 100644
--- a/Master/texmf-dist/source/latex/nag/nag.dtx
+++ b/Master/texmf-dist/source/latex/nag/nag.dtx
@@ -17,7 +17,9 @@
\GetFileInfo{nag.sty}
\typeout{\fileversion}
\usepackage[T1]{fontenc}
-\usepackage{bera}% much smaller pdf now.
+%\usepackage{bera}% much smaller pdf now.
+\usepackage{fourier}
+\usepackage[scaled=0.87]{luximono}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -25,92 +27,10 @@
\DocInput{nag.dtx}
\end{document}
%</driver>
-%<*l2tabunag>
-\ProvidesFile{l2tabu.nag}[2005/03/23 v1.7 l2tabu rules for nag.sty (ulmi)]
-%%
-%% The sins.
-%%
-%% Section numbers refer to l2tabuen 1.7 revised/enlarged dated 2004OCT24
-%% \S 1.1
-\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.7 cannot reasonably be checked programmatically
-%% \S 1.8 \sloppy is called by parbox, among others, and would
-%% give many spurious warnings.
-%% \S 2.1.1
-\ObsoleteCS[an old LaTeX 2.09 command]{bf}{\protect\bfseries\space or \protect\textbf}
-\ObsoleteCS[an old LaTeX 2.09 command]{it}{\protect\itshape\space or \protect\textit}
-\ObsoleteCS[an old LaTeX 2.09 command]{rm}{\protect\rmfamily\space or \protect\textrm}
-\ObsoleteCS[an old LaTeX 2.09 command]{sc}{\protect\scshape\space or \protect\textsc}
-\ObsoleteCS[an old LaTeX 2.09 command]{sf}{\protect\sffamily\space or \protect\textsf}
-\ObsoleteCS[an old LaTeX 2.09 command]{sl}{\protect\slshape\space or \protect\textsl}
-\ObsoleteCS[an old LaTeX 2.09 command]{tt}{\protect\ttfamily\space or \protect\texttt}
-\ObsoleteCS[an old LaTeX 2.09 command]{cal}{\protect\mathcal}% Hmm, this is not in l2tabu?
-%% \S 2.1.2
-\ObsoleteCS[TeX]{over}{\protect\frac}
-\ObsoleteCS[TeX]{choose}{\protect\frac\space or amsmath's \protect\binom}
-%% \S 2.1.3
-\ObsoleteCS[TeX]{centerline}{\protect\centering\space or center environment}
-%% \S 2.2.1
-\ObsoleteClass{scrlettr}{the scrlttr2 package}
-%% \S 2.2.2
-\ObsoletePackage{epsf}{the graphicx package}
-\ObsoletePackage{psfig}{the graphicx package}
-\ObsoletePackage[deprecated]{epsfig}{the graphicx package directly}
-%% \S 2.2.3
-\ObsoletePackage{doublespace}{the setspace package}
-%% \S 2.2.4
-\ObsoletePackage{fancyheadings}{the fancyhdr or scrpage2 packages}
-\ObsoletePackage{scrpage}{the scrpage2 package}
-%% \S 2.2.5
-\ObsoletePackage{isolatin}{the inputenc package with option latin1}
-\ObsoletePackage{umlaut}{the inputenc package with suitable option
- (latin1, utf8 ...)}
-\ObsoletePackage{isolatin1}{the inputenc package with option latin1}
-%% \S 2.2.6
-\ObsoletePackage{t1enc}{the fontenc package with option T1}
-%% \S 2.2.7 we don't check for bst yet.
-%% (This is in l2tabu 1.8)
-\ObsoletePackage{caption2}{the caption package v3.0 or later}
-%% \S 2.3.1-3
-\ObsoletePackage{times}{the mathptmx, helvet (option scaled=.9), courier packages}
-\ObsoletePackage{pslatex}{the mathptmx, helvet (option scaled=.9), courier packages}
-\ObsoletePackage{mathptm}{the mathptmx package}
-%% \S 2.3.4-5
-\ObsoletePackage{palatino}{the mathpazo, helvet (option scaled=.95), courier packages}
-\ObsoletePackage{mathpple}{the mathpazo package}
-%% \S 2.3.6 can't be checked
-%% \S 2.3.7
-\ObsoletePackage{euler}{the eulervm package}
-\ObsoletePackage{utopia}{the fourier package}
-%% \S 3.1
-\g@addto@macro\nag@floats{,figure,table}%
-%% \S 3.2
-\ObsoleteCS[a misuse]{endappendix}{%
- \protect\appendix\space as a switch, not an environment.\MessageBreak
- \protect\end{appendix} detected}
-%% \S 3.3 handled by onlyamsmath.
-%% \S 3.4 -- nothing to be done --
-%</l2tabunag>
-%
-%<*abortnag>
-\ProvidesFile{abort.nag}[2005/05/08 v0.1 treat complaints as errors (ulmi)]
-\renewcommand\nag@warn[1]{%
- \addtocounter{nag@sins}{1}%
- \PackageError{nag}{#1}{#1}%
-}
-\renewcommand\nag@warnNoLine[1]{%
- \addtocounter{nag@sins}{1}%
- \PackageError{nag}{#1}{#1}%
-}
-%</abortnag>
-%
%<*nagdemo>
%% Test document: finding and complaining about obsolete macros.
%%
-\RequirePackage[l2tabu]{nag}
+\RequirePackage[l2tabu, orthodox]{nag}
\documentclass{article}
%% some usual culprits
\usepackage{times, a4wide, epsfig, palatino}
@@ -118,6 +38,13 @@
\typeout{Next: it and bf complaints}
{\it f{\bf oo}f}highter
+\typeout{Next: not-an-env complaints}
+\begin{Large}
+ \begin{sffamily}
+ Foo!
+ \end{sffamily}
+\end{Large}
+
\typeout{Next: center in float complaint}
\begin{figure}
\begin{center}
@@ -144,19 +71,26 @@
Foo.
\end{figure}
+\typeout{Next: appendix complaints}
\begin{appendix}
\begin{center}
Foo.
\end{center}
-\typeout{Next: over complaint, centerline complaint}
+\typeout{Next: no over complaint, centerline complaint, no frac complaint}
\centerline{Ferner gilt $4\over 2=2$.}
-\typeout{Next: appendix complaints}
+ $\frac 42$
\end{appendix}
-\typeout{You should get 13 warnings.}
+\typeout{Next: unmatched endflushright}
+\endflushright
+\typeout{Next: unclosed center}
+{\center Smack in the middle!}
+\typeout{Next: mismatched endflushright}
+\endflushright
+
+\typeout{You should get 17 warnings.}
\end{document}
%</nagdemo>
%
-%<*!(l2tabunag,abortnag,nagdemo)>
%\fi
%
% \CharacterTable
@@ -174,7 +108,7 @@
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
-%\CheckSum{169}
+%\CheckSum{298}
%
%\DoNotIndex{\if,\else,\fi,\PackageWarning,\PackageWarningNoLine,\typeout}
%\DoNotIndex{\@for,\addtocounter,\arabic,\centering,\csname,\CurrentOption}
@@ -188,6 +122,9 @@
%Patrick Happel.}
%\changes{0.2}{2005/05/08}{Added abort.nag, suggested by Michael Zedler}
%\changes{0.3}{2005/07/07}{New ifdefined that won't relax the commands}
+%\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.}
%
%\newcommand\pkg[1]{\textsf{#1}}
%\title{The \pkg{nag} package\ignorespaces%
@@ -212,8 +149,8 @@
%
% \subsection{Installation.}
%
-% Process \texttt{nag.ins} with \LaTeX\ to obtain four files:
-% \texttt{nag.sty} and \texttt{l2tabu.nag} must go to a place where
+% Process \texttt{nag.ins} with \LaTeX\ to obtain some files:
+% \texttt{nag.sty} and \texttt{nag-l2tabu.cfg} et al. must go to a place where
% \LaTeX\ will find them, like the local TEXMF tree. (If all else fails and
% you need it to work \emph{right now}, having them in the same
% directory as the \LaTeX\ file you want to use them on may work under
@@ -229,19 +166,20 @@
% Add the following to the beginning your main document (Comments and
% |\listfiles| can be safely left before it, though):
% \begin{verbatim}
-% \RequirePackage[l2tabu]{nag}\end{verbatim}
+% \RequirePackage[l2tabu, orthodox]{nag}\end{verbatim}
% This will check for many common mistakes, and give some hints on what
% to use instead. However, you should always refer to l2tabu for a more
% detailed explanation of the whats and whys: it gives more information
-% than can be possibly pressed into two lines of error message.
+% than can be possibly pressed into two lines of error message.
+% Orthodox checks for pitfalls that are not technically incorrect. If
+% you know what you're doing, omit orthodox.
%
-% \subsection{\texttt{l2tabu.nag}}
+% \subsection{\texttt{nag-l2tabu.cfg}}
%
-% In a nutshell, \texttt{l2tabu.nag} detects the following:
+% In a nutshell, \texttt{nag-l2tabu.cfg} detects the following:
% \begin{itemize}
% \item Usage of the 2.09-style font commands |\it|, |\bf|, |\rm|,
% |\sc|, |\sl|, |\tt| and |\cal|.
-% \item Usage of the \TeX-style commands |\over| and |\choose|.
% \item Usage of |\centerline|.
% \item Usage of the outdated packages \pkg{epsfig}, \pkg{psfig},
% \pkg{epsf}, \pkg{doublespace}, \pkg{fancyheadings}, \pkg{scrpage},
@@ -267,10 +205,145 @@
% legitimate use, and not find illegitimate use in all cases. It is a
% tool, not a replacement for study of \pkg{l2tabu}.
%
-% \subsection{\texttt{abort.nag}}
+% \begin{macrocode}
+%<*l2tabunag>
+\ProvidesFile{nag-l2tabu.cfg}
+ [2006/04/19 v1.8 l2tabu rules for nag.sty (ulmi)]
+%%
+%% The sins.
+%%
+%% Section numbers refer to l2tabuen 1.7 revised/enlarged dated 2004OCT24
+%% \S 1.1
+\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.7 cannot reasonably be checked programmatically
+%% \S 1.8 \sloppy is called by parbox, among others, and would
+%% give many spurious warnings.
+%% \S 2.1.1
+\ObsoleteCS[an old LaTeX 2.09 command]{bf}
+ {\protect\bfseries\space or \protect\textbf}
+\ObsoleteCS[an old LaTeX 2.09 command]{it}
+ {\protect\itshape\space or \protect\textit}
+\ObsoleteCS[an old LaTeX 2.09 command]{rm}
+ {\protect\rmfamily\space or \protect\textrm}
+\ObsoleteCS[an old LaTeX 2.09 command]{sc}
+ {\protect\scshape\space or \protect\textsc}
+\ObsoleteCS[an old LaTeX 2.09 command]{sf}
+ {\protect\sffamily\space or \protect\textsf}
+\ObsoleteCS[an old LaTeX 2.09 command]{sl}
+ {\protect\slshape\space or \protect\textsl}
+\ObsoleteCS[an old LaTeX 2.09 command]{tt}
+ {\protect\ttfamily\space or \protect\texttt}
+\ObsoleteCS[an old LaTeX 2.09 command]{cal}
+ {\protect\mathcal}% Hmm, this is not in l2tabu?
+%% \S 2.1.2
+%% Gone with 1.8 because this never worked for the kernel \frac anyway.
+%% \ObsoleteCS[TeX]{over}{\protect\frac}
+%% \ObsoleteCS[TeX]{choose}{\protect\frac\space or amsmath's \protect\binom}
+%% \S 2.1.3
+\ObsoleteCS[TeX]{centerline}{\protect\centering\space or center environment}
+%% \S 2.2.1
+\ObsoleteClass{scrlettr}{the scrlttr2 package}
+%% \S 2.2.2
+\ObsoletePackage{epsf}{the graphicx package}
+\ObsoletePackage{psfig}{the graphicx package}
+\ObsoletePackage[deprecated]{epsfig}{the graphicx package directly}
+%% \S 2.2.3
+\ObsoletePackage{doublespace}{the setspace package}
+%% \S 2.2.4
+\ObsoletePackage{fancyheadings}{the fancyhdr or scrpage2 packages}
+\ObsoletePackage{scrpage}{the scrpage2 package}
+%% \S 2.2.5
+\ObsoletePackage{isolatin}{the inputenc package with option latin1}
+\ObsoletePackage{umlaut}{the inputenc package with suitable option
+ (latin1, utf8 ...)}
+\ObsoletePackage{isolatin1}{the inputenc package with option latin1}
+%% \S 2.2.6
+\ObsoletePackage{t1enc}{the fontenc package with option T1}
+%% \S 2.2.7 we don't check for bst yet.
+%% (This is in l2tabu 1.8)
+\ObsoletePackage{caption2}{the caption package v3.0 or later}
+%% \S 2.3.1-3
+\ObsoletePackage{times}
+ {the mathptmx, helvet (option scaled=.9), courier packages}
+\ObsoletePackage{pslatex}
+ {the mathptmx, helvet (option scaled=.9), courier packages}
+\ObsoletePackage{mathptm}
+ {the mathptmx package}
+%% \S 2.3.4-5
+\ObsoletePackage{palatino}
+ {the mathpazo, helvet (option scaled=.95), courier packages}
+\ObsoletePackage{mathpple}{the mathpazo package}
+%% \S 2.3.6 can't be checked
+%% \S 2.3.7
+\ObsoletePackage{euler}{the eulervm package}
+\ObsoletePackage{utopia}{the fourier package}
+%% \S 3.1
+\g@addto@macro\nag@floats{,figure,table}%
+%% \S 3.2
+\NotAnEnvironment{appendix}%
+%% In the same vein:
+\@for\sectioning:=frontmatter,mainmatter,backmatter\do{%
+ \expandafter\NotAnEnvironment\expandafter{\sectioning}%
+}
+%% \S 3.3 handled by onlyamsmath.
+%% \S 3.4 -- nothing to be done --
+%</l2tabunag>
+% \end{macrocode}
+%
+% \subsection{\texttt{nag-orthodox.cfg}}
+% \texttt{nag-orthodox.cfg} warns about usage that is not technically
+% incorrect, but will mostly do things an unwary user may not expect.
+% This includes in particular the usage of font size and style switches
+% as environments (line spacing will be off if the environment does not
+% contain a trailing \string\par, spurious spaces might occur since the
+% switches don't \string\ignorespaces), and, conversely, the usage of
+% center etc. environments as unclosed switches. (Detection of the
+% latter might still be somewhat brittle.)
+% \begin{macrocode}
+%<*orthodoxnag>
+\ProvidesFile{nag-orthodox.cfg}
+ [2006/04/19 v1.8 strict rules for nag.sty (ulmi)]
+\@for\fontcmd:=tiny,small,footnotesize,normalsize,large,Large,%
+ LARGE,huge,Huge\do{%
+ \expandafter\NotAnEnvironment\expandafter{\fontcmd}%
+}%
+\@for\fontcmd:=sffamily,rmfamily,ttfamily,%
+ bfseries,mdseries,scshape,%
+ itshape,upshape\do{%
+ \expandafter\NotAnEnvironment\expandafter{\fontcmd}%
+}%
+\@for\justsw:=centering,raggedleft,raggedright,%
+ RaggedLeft,RaggedRight\do{%
+ \expandafter\NotAnEnvironment\expandafter{\justsw}%
+}
+\@for\justenv:=center,flushleft,flushright\do{%
+ \expandafter\NotASwitch\expandafter{\justenv}%
+}
+%</orthodoxnag>
+% \end{macrocode}
+%
+% \subsection{\texttt{nag-abort.cfg}}
% Requesting this nag file will turn all complaints into errors.
%
+% \begin{macrocode}
+%<*abortnag>
+\ProvidesFile{nag-abort.cfg}
+ [2005/05/08 v0.1 treat complaints as errors (ulmi)]
+\renewcommand\nag@warn[1]{%
+ \addtocounter{nag@sins}{1}%
+ \PackageError{nag}{#1}{#1}%
+}
+\renewcommand\nag@warnNoLine[1]{%
+ \addtocounter{nag@sins}{1}%
+ \PackageError{nag}{#1}{#1}%
+}
+%</abortnag>
+% \end{macrocode}
%\StopEventually{\PrintChanges}
+%<*nag>
% \section{Author-side considerations and implementation.}
% If you are a package or class author and want to extend the range
% of \pkg{nag} (or prevent \pkg{nag} from criticizing
@@ -284,7 +357,9 @@
% Identify ourselves.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{nag}[2005/07/07 0.3 warning about nag things (ulmi)]
+\ProvidesPackage{nag}[2006/07/08 0.5 warning about old commands (ulmi)]
+\let\@xa\expandafter
+\let\@nx\noexpand
% \end{macrocode}
% First of all, two counters we need. The first is used to
% generate running numbers for replacement macros, the latter is
@@ -306,11 +381,11 @@
%
% \begin{macrocode}
\newcommand\nag@prepend[2]{%
- \expandafter\let
- \csname nag@@#1@\the\value{nag@c}\expandafter\endcsname
+ \@xa\let
+ \csname nag@@#1@\thenag@c\@xa\endcsname
\csname #1\endcsname
- \expandafter\nag@pr@p@nd\csname #1\expandafter\endcsname
- \csname nag@@#1@\the\value{nag@c}\endcsname{#2}%
+ \@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]{%
@@ -349,7 +424,7 @@
\AtBeginDocument{%
\nag@prepend{#2}{%
\nag@warn{%
- Command \expandafter\protect\csname #2\endcsname\space is #1.
+ Command \@backslashchar#2 is #1.
\MessageBreak
Use #3 instead}%
}%
@@ -382,7 +457,11 @@
\nag@ifcsname{ifcsname}{%
\renewcommand*\nag@ifcsname[3]{%
\begingroup
- \ifcsname #1\endcsname #2\else #3\fi
+ \ifcsname #1\endcsname
+ % It still might be relax from some other test. Thanks to J\"org
+ % Sommer for finding this bug.
+ \@ifundefined{#1}{#3}{#2}%
+ \else #3\fi
\endgroup
}%
% \end{macrocode}
@@ -404,6 +483,7 @@
% \begin{macrocode}
\newcommand\ObsoletePackage[3][obsolete]{%
\AtEndDocument{%
+% |\@clsextension| is onlypreamble, for some reason.
\nag@ifcsname{ver@#2.sty}{%
\nag@warnNoLine{%
Package #2 is #1.\MessageBreak
@@ -425,6 +505,7 @@
% \begin{macrocode}
\newcommand\ObsoleteClass[3][obsolete]{%
\AtEndDocument{%
+% |\@clsextension| is onlypreamble, for some reason.
\nag@ifcsname{ver@#2.cls}{%
\nag@warnNoLine{%
Class #2 is #1.\MessageBreak
@@ -477,6 +558,10 @@
% those should be hidden by groups. In particular, a center or
% minipage environment would hide the caption inside from a label
% outside.
+% \changes{0.4}{2006/04/19}{bugfix}
+% Well, maybe I should do it the way the kernel does, which means
+% a label is just as local as |\refstepcounter|'s |\@currentlabel|
+% information. I think we can leave captions global.
%
% \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
@@ -484,7 +569,7 @@
% \begin{macrocode}
\@for\labelprovider:=\nag@labels\do{%
\nag@prepend{\labelprovider}%
- {\nag@captioncheck\global\nag@haslabeltrue}
+ {\nag@captioncheck\nag@haslabeltrue}
}%
\@for\captionprovider:=\nag@captions\do{%
\nag@prepend{\captionprovider}{\global\nag@hascaptiontrue}%
@@ -522,7 +607,7 @@
% \begin{macrocode}
\newcommand\nag@floatsetup{%
\@for\flo:=\nag@floats\do{%
- \expandafter\nag@hackfloat\expandafter{\flo}%
+ \@xa\nag@hackfloat\@xa{\flo}%
}%
}
% \end{macrocode}
@@ -549,23 +634,162 @@
}
% \end{macrocode}
%
+% \section{Switch vs. Environment}
+%
+% People often use switches as environments and vice versa. This is
+% 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
+% 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
+% brittle. Fortunately, it is currently only needed for
+% nag-orthodox, where it checks for the justification environments.
+%
+% First of all, a helper macro we hinge upon:
+% \begin{macrocode}
+\newcommand\nag@ifCurrentEnvironment[3]{%
+ \bgroup
+ \def\tmp@a{#1}%
+ \ifx\@currenvir\tmp@a
+ #2%
+ \else
+ #3%
+ \fi
+ \egroup
+}
+% \end{macrocode}
+% And now, the two variations there are:
+% \begin{macro}{\NotAnEnvironment}
+% Usage:|\NotAnEnvironment|\marg{command}
+% Issue an error if the user calls |\begin{command}| and not
+% |\command| directly.
+% \begin{macrocode}
+\newcommand\NotAnEnvironment[1]{%
+ \AtBeginDocument{%
+ \nag@prepend{#1}{%
+ \nag@ifCurrentEnvironment{#1}{%
+ \nag@warn{%
+ There is no environment ``#1''.\MessageBreak
+ Maybe you want a grouped \@backslashchar#1
+ }%
+ }{% OK case.
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% |\NotASwitch| is a bit more involved:
+% \begin{macro}{\NotASwitch}
+% Usage:|\NotASwitch|\marg{command}
+% Issue an error if the user calls |\command| and not
+% |\begin{command}| and mis-nests calls or doesn't call
+% |\endcommand| at all.
+% \begin{macrocode}
+% we need to maintain a stack of environments that are used in the
+% \foo...\endfoo way.
+\newcommand\nag@envstack{\relax}
+
+\newcommand\nag@beginenv[1]{%
+ % push a begin-entry onto the stack. Form is
+ % |{\foo{lineno}}| for environment foo.
+ \xdef\nag@envstack{%
+ \@nx{%
+ \@xa\@nx\csname #1\endcsname
+ \@nx{\the\inputlineno\@nx}%
+ \@nx}%
+ \@xa\@nx\nag@envstack
+ }%
+}
+\newcommand\nag@endenv[1]{%
+ % extract the first entry.
+ \@xa\nag@end@nv\nag@envstack\@nil #1\@nil
+}
+
+\def\nag@end@nv#1#2\@nil #3\@nil{%
+ \def\tmp@a{#1}%
+ \def\tmp@b{\relax}%
+ \ifx\tmp@a\tmp@b
+ % This was the end-of-stack flag.
+ \nag@warn{``\@backslashchar end#3'' without matching
+ ``\@backslashchar #3''}
+ \else
+ % We may assume this is a proper entry. See if the begin-token on
+ % the stack matches what |\nag@endenv| was passed.
+ \@xa\ifx\csname #3\@xa\endcsname\@firstoftwo #1%
+ %OK case, just pop the entry.
+ \gdef\nag@envstack{#2}%
+ \else
+ % error case
+ \nag@warn{%
+ You cannot close ``\@xa\string\@firstoftwo #1'' on line
+ \@secondoftwo #1 with ``\@backslashchar end#3''%
+ }%
+ % leave it on the stack. Some case of misnesting will always cause
+ % horrible amounts of follow-up errors. Also, scare them!
+ \fi
+ \fi
+}
+% \end{macrocode}
+% At the end, we complain about all the entries that are still on
+% the stack.
+% \begin{macrocode}
+\AtEndDocument{%
+ \@xa\@tfor\@xa\looseends\@xa:\@xa=\nag@envstack\do{%
+ \@xa\ifx\looseends\relax\else
+ \nag@warnNoLine{Unmatched
+ ``\@xa\@xa\@xa\string\@xa\@firstoftwo\looseends''
+ command on line
+ \@xa\@xa\@xa\string\@xa\@secondoftwo\looseends%
+ }%
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+% Now, the user-side command is easy.
+% \begin{macrocode}
+\newcommand\NotASwitch[1]{%
+ \AtBeginDocument{%
+ \nag@prepend{#1}{%
+ \nag@beginenv{#1}%
+ }%
+ \nag@prepend{end#1}{%
+ \nag@endenv{#1}%
+ }%
+ }%
+}
+% \end{macrocode}
+%
% Finally, we deal with package options.
% This is simple: just try to input appropriate nag files.
+% \changes{0.4}{2006/04/19}{config file names changed to free extension}
% \begin{macrocode}
\DeclareOption*{%
- \InputIfFileExists{\CurrentOption.nag}{%
- \typeout{package nag: Loaded \CurrentOption.nag}%
+ \InputIfFileExists{nag-\CurrentOption.cfg}{%
+ \PackageInfo{nag}{%
+ Loaded nag-\CurrentOption.cfg
+ }
}{%
- \PackageWarningNoLine{nag}{Required ruleset
- \CurrentOption.nag, and it wasn't there}
- }%
+ \InputIfFileExists{\CurrentOption.nag}{%
+ \PackageWarningNoLine{nag}{%
+ Loaded old-style config file \CurrentOption.nag.\MessageBreak
+ Consider renaming the file to nag-\CurrentOption.cfg
+ }%
+ }{%
+ \PackageWarningNoLine{nag}{Required ruleset
+ \CurrentOption, and it wasn't there}
+ }%
+ }
}
\ProcessOptions*
% \end{macrocode}
+%</nag>
%\PrintIndex
%\Finale
%\iffalse
-%</!(l2tabunag,abortnag,nagdemo)>
%%X Local Variables:
%%X mode: latex
%%X End:
diff --git a/Master/texmf-dist/source/latex/nag/nag.ins b/Master/texmf-dist/source/latex/nag/nag.ins
index ea449ef3b41..3c8dbe0b1bd 100644
--- a/Master/texmf-dist/source/latex/nag/nag.ins
+++ b/Master/texmf-dist/source/latex/nag/nag.ins
@@ -10,7 +10,7 @@ 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.
+Copyright (C) 2005, 2006 by Ulrich M. Schwarz.
This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
@@ -21,8 +21,9 @@ http://www.latex-project.org/lppl.txt
\endpreamble
\generate{\file{nag.sty}{\from{nag.dtx}{nag}}
- \file{l2tabu.nag}{\from{nag.dtx}{l2tabunag}}
- \file{abort.nag}{\from{nag.dtx}{abortnag}}
+ \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{nagdemo.tex}{\from{nag.dtx}{nagdemo}}}
\Msg{*********************************************************}
\Msg{*}
@@ -30,8 +31,9 @@ http://www.latex-project.org/lppl.txt
\Msg{* following files into a directory searched by TeX:}
\Msg{*}
\Msg{* \space\space nag.sty}
-\Msg{* \space\space l2tabu.nag}
-\Msg{* \space\space abort.nag}
+\Msg{* \space\space nag-l2tabu.cfg}
+\Msg{* \space\space nag-abort.cfg}
+\Msg{* \space\space nag-orthodox.cfg}
\Msg{*}
\Msg{* To produce the fully-indexed documentation run}
\Msg{latex nag.dtx}