summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/warning/warning.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/warning/warning.sty')
-rw-r--r--macros/latex/contrib/warning/warning.sty118
1 files changed, 55 insertions, 63 deletions
diff --git a/macros/latex/contrib/warning/warning.sty b/macros/latex/contrib/warning/warning.sty
index 67f9746839..0a8e3e5b7d 100644
--- a/macros/latex/contrib/warning/warning.sty
+++ b/macros/latex/contrib/warning/warning.sty
@@ -1,80 +1,72 @@
%%
-%% warning.sty
+%% Project: warning
+%% Version: 2023-03-18 v0.10
+%% Info: Global warnings at the end of the screen output and the logfile
%%
-%% Global warnings at the end of the screen output and the logfile
+%% Copyright © 2001, 2023 Harald Harders (harald.harders@gmx.de; inactive)
+%% (2023-03-18 update done by H.-Martin Münch, <Martin dot Muench at Uni-Bonn dot de>)
%%
-%% Copyright 2001 Harald Harders (h.harders@tu-bs.de)
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option) any later
+%% version. This version of this license is in
+%% https://www.latex-project.org/lppl/lppl-1-3c.txt
+%% and the latest version of this license is in
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of
+%% LaTeX version 2005-12-01 or later.
%%
-%% License: LPPL
+%% Note: This package is obsolete. For LaTeX-format 2020-10-01 and newer:
+%% Instead of \addglobalwarning{ something } use
+%% \AddToHook{enddocument/info}{ something }
+%% and do not load the warning package.
%%
-%% Sometimes a class or package has to make a global warning such as
-%% ``Rerun for this or that reason'' or ``This is draft, change this
-%% before the final run''. If you are generating them with
-%% \AtEndDocument{\PackageWarningNoLine{packagename}{warning}}
-%% the warning appears very early before the filelist. Then the
-%% warning can easily be overseen. This package provides a command
-%% that surely puts the warning at the end near to the global
-%% warnings generated by LaTeX itself.
-%% You can add a warning to a list of user defined warnings using the
-%% command \addglobalwarning as it can be seen in the example below.
-%%
-%% This package could be useful for the warnings generated e.g. by
-%% the packages changebar.sty or longtable.sty.
-%%
-%% Harald Harders
-%%
-%%
-%% Example:
-%%
-%% \documentclass{article}
-%% \usepackage{warning}
-%% \addglobalwarning{%
-%% \ClassWarningNoLine{testclass}{This is a global warning}}
-%% \addglobalwarning{%
-%% \PackageWarningNoLine{testpackage}{This is another global warning}}
-%% \begin{document}
-%% Hello
-%% \end{document}
-%%
-%%
-\ProvidesPackage{warning}[2001/08/17 v0.01 Global warnings at end of logfile]
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{warning}[2023/03/18 v0.10 Global warnings at end of logfile]
+
+\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
+\IfFormatAtLeastTF{2020/10/01}{
+ \NewDocumentCommand\addglobalwarning{m}{\AddToHook{enddocument/info}{#1}}
+ \addglobalwarning{%
+ \PackageWarningNoLine{warning}{Package warning is obsolete.\MessageBreak%
+ Instead of \string\addglobalwarning{ something } use \MessageBreak%
+ \string\AddToHook{enddocument/info}{ something }\MessageBreak%
+ and do not load the warning package}
+ }
+ \def\wrn@warning{\endinput}
+ }{\let\wrn@warning\relax
+ \AtBeginDocument{\addglobalwarning{\PackageWarningNoLine{warning}{%
+ Used LaTeX-format: \fmtversion, more recent LaTeX-format is available}}}
+ }
+
+\wrn@warning% is \endinput for LaTeX since 2020-10-01 and \relax for older LaTeX.
% Define a command that adds new warnings to the list of warnings.
% Modification of the \addto command provided by babel.def.
\def\addglobalwarning#1{%
- \ifx\wrn@warning\@undefined
- \def\wrn@warning{#1}%
- \else
- \ifx\wrn@warning\relax
- \def\wrn@warning{#1}%
- \else
- {\toks@\expandafter{\wrn@warning#1}%
- \xdef\wrn@warning{\the\toks@}}%
- \fi
- \fi
+ {\toks@\expandafter{\wrn@warning#1}%
+ \xdef\wrn@warning{\the\toks@}}%
}
-% Expand \@@end command. I have the feeling that is not too stable.
-% Thus not used.
-%\let\wrn@end\@@end
-%\def\@@end{\wrn@warning\wrn@end}
-
-% Expand \@refundefined command. This does not work if undefined
-% references appear after the execution of \AtEndDocument which can happen.
-% Thus not used.
-%\AtEndDocument{%
-% \let\wrn@refundefined=\@refundefined
-% \def\@refundefined{\wrn@refundefined\wrn@warning}}
-
% Expand \@dofilelist
-% This works with or without \listfiles because \listfile has to be
-% used in the preamble and therefor is executed before this definition.
\AtBeginDocument{%
- \let\wrn@dofilelist\@dofilelist
+ \let\wrn@dofilelist\@dofilelist%
\def\@dofilelist{\wrn@dofilelist\wrn@warning}%
}
-
-\let\wrn@warning\relax
-
\endinput
+% This works with or without \listfiles because \listfile has to be
+% used in the preamble and therefor is executed before this definition.
+%
+% Expand \@@end command
+% I have the feeling that is not too stable. Thus not used.
+%\let\wrn@end\@@end
+%\def\@@end{\wrn@warning\wrn@end}
+%
+% Expand \@refundefined command
+% This does not work if undefined references appear after the execution
+% of \AtEndDocument which can happen. Thus not used.
+%\AtEndDocument{%
+% \let\wrn@refundefined=\@refundefined
+% \def\@refundefined{\wrn@refundefined\wrn@warning}}
+%
%% EOF \ No newline at end of file