\newcommand\erratafiledate{1999/06/05}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% To produce a printed version of this errata file run this file through
% LaTeX. It will unpack a small class file (if not already present) and
% a configuration file with the extension .cfg. You might want to modify
% the setting in this configuration file to print only a partial errata
% suitable for your printed revision of this book, see details in the
% .cfg file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{filecontents}{ttcterrata.cls}
%%
%% Copyright (C) 1997-2021 Frank Mittelbach
%% This class file is licenced under LPPL latest version;
%% see https://www.latex-project.org/lppl
%
%
% It sets up a few commands used to format the errata entries for books in the
% Addison-Wesley Series:
%
%    Tools and Techniques for Computer Typesetting
%
% hence the name. However, anybody who likes to use it is free to apply it for
% errata files of other books.
%
% Changes:
%
% v1.0a - changed name from errata.cls to ttcterrata.cls
% v1.0b - added \arraybackslash
% v1.0c - and took it out again and used \tabularnewline instead

\ProvidesClass{ttcterrata}
  [2021/08/03 v1.0c Mini class for errata files; subject to change (FMi)]

\LoadClass{article}

\setcounter{secnumdepth}{-1}
\addtolength\textwidth{5cm}
\addtolength\oddsidemargin{-3cm}

\addtolength\textheight{36pt}

\RequirePackage{shortvrb}
\MakeShortVerb{\|}

\RequirePackage{array,longtable}
\RequirePackage{multicol}


\newcommand\erratagetnumber{}
\def\erratagetnumber#1/#2/#3\erratagetnumber{#1#2#3}


\newcommand\gobbleerrata{%
  \setbox\@tempboxa\vbox\bgroup
     \let\endgobble\egroup
     \let\hideamp\relax
     \let\\\relax
     \let\tabularnewline\relax
     \let\par\@@par}

\newcommand*\hideamp{&}

\let\endgobble\relax


\newcommand\erratastartdate{}
\newcommand\myprinting{1}


\newcommand\doweprint[2]{%
  \ifnum \myprinting < \if!#2!1000 \else \ifx s#2 1000\else#2 \fi\fi
   \ifnum \expandafter\erratagetnumber\erratastartdate\erratagetnumber <
          \erratagetnumber#1\erratagetnumber \relax
     \@tempswatrue
   \else
     \@tempswafalse
   \fi
  \else
    \@tempswafalse
  \fi
}



\newcommand\includedentries{entries after = \erratastartdate}
\newcommand\printedentries{between \erratastartdate\space and}

\newcommand\showallerrors{%
 \renewcommand\includedentries{all errata entries}%
 \renewcommand\printedentries{up to}
 \renewcommand\doweprint[2]{\@tempswatrue}}


\newcommand\displayrevisionfix[2]{%
    \if!#2!\textbf{#1}\else\textit{#1}\rlap{\textsuperscript{#2}}\fi}

\newcommand\norevisionnumbers{%
  \renewcommand\displayrevisionfix[2]{\textbf{##1}}}

\IfFileExists{\jobname.cfg}
  {
   \input{\jobname.cfg}
   \typeout{***************************************************}
   \typeout{*}
   \typeout{* Configuration file for \jobname.err found }
   \typeout{*}
   \typeout{***************************************************}
  \AtEndDocument{
   \typeout{***************************************************}
   \typeout{*}
   \typeout{* If you wish to generate an errata listing}
   \typeout{* containing only errors found after a certain revision}
   \typeout{* and/or only errors found after a certain date}
   \typeout{* modify the information stored in \jobname.cfg}
   \typeout{*}
   \typeout{* Current settings are:}
   \typeout{*}
   \typeout{* \@spaces  printing of your book = \myprinting}
   \typeout{* \@spaces  include \includedentries}
   \typeout{*}
   \typeout{***************************************************}
  }}
  {}

%% \erroronpage <page> <line info> <contributor> <date> <fixed in revision>

\newcommand\erroronpage[5]{%
   \endgobble
   \doweprint{#4}{#5}%
   \if@tempswa
     \typeout{Typesetting entry #1 #2 #3 #4}%
   \else
     \typeout{Ignoring entry #1 #2 #3 #4}%
     \expandafter\gobbleerrata
   \fi
   \hideamp \tabularnewline
   \displayrevisionfix{#1}{#5}
   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
}

\newcommand\seriouserroronpage[5]{%
   \endgobble
   \doweprint{#4}{#5}%
   \if@tempswa
     \typeout{Typesetting entry #1 #2 #3 #4}%
   \else
     \typeout{Ignoring entry #1 #2 #3 #4}%
     \expandafter\gobbleerrata
   \fi
   \hideamp \tabularnewline
   \fbox{\bfseries !!}\hfill
   \displayrevisionfix{#1}{#5}
   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
}

\newcommand\CHAPTER[1]{\endgobble
  &\tabularnewline[4pt]%
  \multicolumn{4}{l}{\framebox[10cm][l]{\textbf{\normalsize\strut#1}}} \tabularnewline}

\newenvironment{erratalist}
  {\begin{longtable}{r>{\raggedright}p{2cm}l>{\raggedright}p{10cm}l}}
  {\endgobble\end{longtable}}

\newcommand\erratatitle[2]
  {\begin{center}\LARGE\bfseries
      Errata list for #1\\[5pt](\myprinting.\ printing)\\[10pt]
      \small Includes all entries found \printedentries\space #2\\
      (For other periods/print runs reprocess this document
      with different config settings)
   \end{center}%
   \markright{Errata for #1 (\printedentries\space #2)}%
   \thispagestyle{plain}%
   \vspace{20pt}}

\pagestyle{myheadings}

\AtBeginDocument{\small}

\setlength\parindent{0pt}
\setlength\parskip{2pt}

\newcommand\contributor[2]{\makebox[1cm][l]{\sffamily#1} #2\par}

% some special shortcuts overwriting existing commands:

\let\u\underline
\renewcommand\>{$\to$}

%%% some code suggested by Thorsten Hansen to count the number of
%%% contributions by individuals (will work only if we do not get
%%% too many :-)

\def\count@contributors#1/#2/#3\@nil{
   \@ifundefined{c@#1}{\newcounter{#1}}{}\stepcounter{#1}%
%%%   also count secondary:
%%%   \@ifundefined{c@#2}{\newcounter{#2}}{}\stepcounter{#2}%
}

\renewcommand\erroronpage[5]{%
   \count@contributors#3/secondary/\@nil
   \endgobble
   \doweprint{#4}{#5}%
   \if@tempswa
     \typeout{Typesetting entry #1 #2 #3 #4}%
   \else
     \typeout{Ignoring entry #1 #2 #3 #4}%
     \expandafter\gobbleerrata
   \fi
   \hideamp \tabularnewline
   \displayrevisionfix{#1}{#5}
   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
}

\renewcommand\seriouserroronpage[5]{%
   \count@contributors#3/secondary/\@nil
   \endgobble
   \doweprint{#4}{#5}%
   \if@tempswa
     \typeout{Typesetting entry #1 #2 #3 #4}%
   \else
     \typeout{Ignoring entry #1 #2 #3 #4}%
     \expandafter\gobbleerrata
   \fi
   \hideamp \tabularnewline
   \fbox{\bfseries !!}\hfill
   \displayrevisionfix{#1}{#5}
   \hideamp #2 \hideamp (\textsf{#3}) \hideamp
}

\renewcommand\contributor[2]{\makebox[1cm][l]{%
  \sffamily#1} #2\@ifundefined{c@#1}{}{ (\arabic{#1})}\par}

\end{filecontents}


\begin{filecontents}{\jobname.cfg}
%
%
% Configuration file for the errata listing of
%
%  The LaTeX Web Companion
%
%
% \erratastartdate
%
%    Specifies the date from which on
%    errata entries should be listed.
%
%    The format is YYYY/MM/DD.
%
%    The default below ensures that all
%    entries are typeset.
%
\renewcommand\erratastartdate{1999/05/01}

%
% \myprinting
%
%    Specifies which (revised) printing you
%    own. For example, if you have the second
%    printing set this to 2 so that errors
%    already corrected in that printing will not
%    appear in your errata listing.
%
%    The default below ensures that all
%    entries are typeset.
%
\renewcommand\myprinting{1}
%
%
% \norevisionnumbers
%
% Specifies that all page numbers in the errata are shown in the same
%    format (bold face) irregardless of whether or not they are fixed
%    in some revision. The default is to print corrected errors in
%    italic and add the revision number as a superscript.
%
%
% \showallerrors
%
% With this command you tell the program that all errata entries are
%    supposed to be generated. This makes \myprinting and
%    \erratastartdate basically obsolete so this isn't turned on by
%    default.
%
%
\endinput
\end{filecontents}



\documentclass{ttcterrata}


\begin{document}

\erratatitle{The \LaTeX{} Web Companion}{\erratafiledate}


\begin{verbatim}
@book(A-W:GR99,
   author = {Michel Goossens and Sebastian Rahtz},
   title = {The {\LaTeX} Web Companion},
   substitle = {Integrating {\TeX}, HTML, and XML},
   series =       "Tools and Techniques for Computer Typesetting",
   publisher = {Addison-Wesley},
   address   = {Reading, Massachusetts},
   year = 1999,
   ISBN =         "0-201-43311-7",
   LCCN =         "QA76.76.H94G66 1999",
   pagenums = {xxii + 522},
   source-infos = {yes},
   bibliography = {yes},
   index = {yes},
   price = "US\$39.95",
   note  = "With Eitan M. Gurari and Ross Moore and Robert S.
            Sutor.",
)
\end{verbatim}

\begin{list}{}{\setlength\leftmargin{0cm}\setlength\rightmargin{5cm}}
\item[]
The latest version of this file (\texttt{\jobname.err}) can be found
as part of the \LaTeX{} distribution.

The first column in the table shows the page number of the errata
entry.  Superscript numbers in the first column refer to the printed
revision in which this entry was corrected. The second column gives
the precise location, negative line numbers are counted from the
bottom of the page. The third column shows the first finder of the
problem.

\end{list}


\begin{erratalist}

%=======================================================================
\CHAPTER{Chapter 6}

\erroronpage{247}{3 para l.5}{MGo}{1999/06/05}{}
   GenCod \> GenCode

\CHAPTER{Appendix B}

\erroronpage{418}{3 para}{MGo}{1999/06/05}{}
   The \texttt{book} element types (lines 10--\u{15})

\end{erratalist}



%==========================================================================

\bigskip


\begin{multicols}{3}[Thanks to all who have found errors or
   omissions. Listed are the people who found an errata entry first.]
\contributor{MGo}{Michel Goossens}
\end{multicols}


If you find further errors please report them to one of the authors
\begin{quote}\ttfamily
  sebastian.rahtz@oucs.ox.ac.uk\\
  goossens@cern.ch
\end{quote}
preferable in a form usable for this file, i.e.,
\begin{flushleft}
|\erroronpage{|\textit{page-number}|}{|\textit{line-identification}|}{|%
   \textit{your-initials}|}{|\textit{date}|}{}| \\
   \hspace*{2em}\textit{description of the the errata}
\end{flushleft}
Here is an example:
\begin{verbatim}
\erroronpage{4}{l.-7}{PMcJ}{1998/06/11}{}
   surprisingly \> surprising
\end{verbatim}


\end{document}
