summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/warning/warning-doc.tex
blob: 82a93be17ebaf27dd82bbf41720f7a64d5587e31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
\documentclass[parskip=half,fontsize=12pt,DIV=11]{scrartcl}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[svgnames]{xcolor}
\usepackage{listings}
\usepackage{microtype}
\usepackage{hyperref}

\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}}
\newcommand*{\pkg}[1]{\textsf{#1}}
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
\makeatletter
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
\makeatother
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}

\addtokomafont{title}{\rmfamily}
\deffootnote{1em}{1em}{\textsuperscript{\thefootnotemark}}

\lstset{%
  language=[LaTeX]TeX,%
  columns=flexible,%
  upquote=true,%
  numbers=left,%
  basicstyle=\ttfamily,%
  keywordstyle=\color{Navy},%
  commentstyle=\color{DimGray},%
  stringstyle=\color{SeaGreen},%
  numberstyle=\scriptsize\color{SlateGray}%
}

\title{The \pkg{warning} package\thanks{This manual corresponds to \pkg{warning.sty}~v0.10, dated~2023-03-18.}}
\subtitle{Global warnings at the end of the screen output\\and the logfile}
\author{Harald Harders\thanks{\mail{harald.harders@gmx.de}}\hspace{0.7em}(inactive)}
\date{2023-03-18}% (2023-03-18 update done by H.-Martin Münch, <Martin dot Muench at Uni-Bonn dot de>)

\begin{document}
\maketitle

{\large\color{red}
\textbf{Note: This package is obsolete. For \LaTeX-format \hbox{2020-10-01} and newer:
Instead of }\verb|\addglobalwarning{ something }|\textbf{ use }
\verb|\AddToHook{enddocument/info}{ something }|\textbf{ 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
\verb+\AtEndDocument{\PackageWarningNoLine+\marg{packagename}\marg{warning}\verb+}+
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 \cmd{\addglobalwarning} as it can be seen in the example below.

This package could be useful for the warnings generated e.\,g.\ by
the packages \pkg{changebar.sty} or \pkg{longtable.sty}.

Harald Harders

\newpage

\minisec{Example:}

\begin{lstlisting}
\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}
\end{lstlisting}

For \LaTeX-format 2020-10-01 and newer use:
\begin{lstlisting}
\documentclass{article}
\AddToHook{enddocument/info}{%
  \ClassWarningNoLine{testclass}{This is a global warning}}
\AddToHook{enddocument/info}{%
  \PackageWarningNoLine{testpackage}{This is another global warning}}
\begin{document}
Hello
\end{document}
\end{lstlisting}
\end{document}