summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/errata/errata.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/errata/errata.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/errata/errata.sty')
-rw-r--r--macros/latex/contrib/errata/errata.sty75
1 files changed, 75 insertions, 0 deletions
diff --git a/macros/latex/contrib/errata/errata.sty b/macros/latex/contrib/errata/errata.sty
new file mode 100644
index 0000000000..0c8930acd8
--- /dev/null
+++ b/macros/latex/contrib/errata/errata.sty
@@ -0,0 +1,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'.