blob: 0c8930acd8620ab92a869c253dc941f61afbe5ce (
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
|
%%
%% This is file `errata.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% errata.dtx (with options: `package')
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{errata}[2006/11/121v0.3 Errata Management]
\newif\ifmargins\marginsfalse
\newif\iffoots\footsfalse
\newif\ifrecord\recordfalse
\DeclareOption{show}{\marginstrue\footstrue}
\DeclareOption{hide}{}
\DeclareOption{margins}{\marginstrue}
\DeclareOption{foots}{\footstrue}
\DeclareOption{record}{\recordtrue}
\ProcessOptions
\RequirePackage{keyval}[1997/11/10]
\define@key{erratum}{id}{\def\erratum@id{#1}}
\define@key{erratum}{type}{\def\erratum@type{#1}}
\define@key{erratum}{date}{\def\erratum@date{#1}}
\define@key{erratum}{reported-by}{\def\erratum@reported-by{#1}}
\newcounter{erratum}
\newcounter{erratum@note}[erratum]
\ifrecord\newwrite\errata@file
\immediate\openout\errata@file=\jobname-errata.tex
\AtEndDocument{\closeout\errata@file}\fi
\def\ErratumRef{\@ifundefined{thechapter}{}{\arabic{chapter}.}%
\@ifundefined{thesection}{}{\ifnum\value{section}>0{}\arabic{section}\fi}%
\@ifundefined{thesubsection}{}{\ifnum\value{subsection}>0.\arabic{subsection}\fi}%
\@ifundefined{thesubsubsection}{}{\ifnum\value{subsubsection}>0.\arabic{subsubsection}\fi}}
\def\record@erratum#1{\ifrecord\protected@write\errata@file{}%
{\string\erratumItem{\ErratumRef}{#1}}\fi}
\def\erratumItem#1#2{\item[#1] #2}
\def\printerrata#1{\IfFileExists{#1-errata.tex}{\begin{errata}\input{#1-errata}\end{errata}}{}}
\def\PrintErrata{\ifrecord\immediate\closeout\errata@file\fi\printerrata\jobname}
\newenvironment{errata}{\begin{description}}{\end{description}}
\newcommand{\erratumAdd}[3][]% keyvals, explanation, new
{\setkeys{erratum}{#1}\stepcounter{erratum}\record@erratum{#2}%
\marginpar{Err(\arabic{erratum})}\immediate\typeout{Erratum!}%
[#3]$_a^{\arabic{erratum}}$%
\footnotetext[\value{erratum}]{{\scshape{Erratum!}}%
\@ifundefined{erratum@type}{}{(\erratum@type)} #2 (added text)}}
\newcommand{\erratumDelete}[3][]% keyvals, explanation, old
{\setkeys{erratum}{#1}\stepcounter{erratum}\record@erratum{#2}%
\marginpar{Err(\arabic{erratum})}\immediate\typeout{Erratum!}%
[]$_d^{\arabic{erratum}}$%
\footnotetext[\value{erratum}]{{\scshape{Erratum!}}%
\@ifundefined{erratum@type}{}{(\erratum@type)} #2 (deleted ``#3'')}}
\newcommand{\erratumReplace}[4][]% keyvals, explanation, old, new
{\setkeys{erratum}{#1}\stepcounter{erratum}\record@erratum{#2}%
\marginpar{Err(\arabic{erratum})}\immediate\typeout{Erratum!}%
[#4]$_r^{\arabic{erratum}}$%
\footnotetext[\value{erratum}]{{\scshape{Erratum!}}%
\@ifundefined{erratum@type}{}{(\erratum@type)} #2 (original text was: ``#3'')}}
\newenvironment{erratum}[2][]% keys, explanation
{\setkeys{erratum}{#1}\stepcounter{erratum}
\edef\new@number{\theerratum}\message{Erratum \new@number!}
\iffoots\footnotetext[\value{erratum}]{{\scshape{Erratum}%
\@ifundefined{erratum@type}{}{(\erratum@type)}: #2}}\marginpar{BErr(\new@number)}\fi
\record@erratum{#2}
\def\eAdd##1{[##1]$_a$}%
\def\eDelete##1{\erratum@mark[]$_d^{\@thefnmark}$\@footnotetext{deleted: ##1}}%
\def\eReplace##1##2{\erratum@mark[##2]$_r^{\@thefnmark}$\@footnotetext{was: ##1}}}%
{\ifmargins\marginpar{EErr(\new@number)}\fi}
\def\erratum@mark{\stepcounter{erratum@note}{}
\def\@thefnmark{\arabic{erratum}:\arabic{erratum@note}}}
\def\ednotemessage{\ifnum\value{erratum}>0\typeout{}%
\typeout{This document contains \arabic{erratum} Errata; see \jobname-errata.tex!}%
\typeout{}\fi}
\endinput
%%
%% End of file `errata.sty'.
|