summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ed/ed.sty
blob: fdc38fd63f265995f4319d3323a8e22aa832e6db (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
%%
%% This is file `ed.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ed.dtx  (with options: `package')
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{ed}[2012/01/29 v1.8 Editorial Notes]
\newif\ifshowednotes\showednotesfalse
\newif\ifmargins\marginstrue
\DeclareOption{show}{\showednotestrue\message{ed.sty: showing ednotes}}
\DeclareOption{hide}{\showednotesfalse\message{ed.sty: hiding ednotes}}
\DeclareOption{draft}{\showednotestrue\message{ed.sty: showing ednotes}}
\DeclareOption{final}{\showednotesfalse\message{ed.sty: hiding ednotes}}
\DeclareOption{nomargins}{\marginsfalse}
\ProcessOptions
\ifshowednotes
\RequirePackage{paralist}
\RequirePackage{xcolor}
\else
\RequirePackage{verbatim}
\fi
\newcommand\ednoteshape{\sffamily}
\newcounter{ednote}
\newcommand\ed@foot[3]% text, type, label
{\def\@test{#3}\footnotetext[\arabic{ednote}]%
{{\scshape{#2}\if\@test\@empty\else\label{ed:#3}[{#3}]\fi:} \ednoteshape #1}}
\newcommand\ed@footnote[3]{\footnotemark[\arabic{ednote}]\ed@foot{#1}{#2}{#3}}
\newcommand\ed@margin[1]{\ifmargins\marginpar{#1}\fi}
\newcommand\Ed@note[3]% text, type, label
{\addtocounter{ednote}{1}\message{#2!}%
\ifshowednotes\ed@footnote{#1}{#2}{#3}\fi}
\newcommand\ed@note[4]% text, type, label, margin
{\Ed@note{#1}{#2}{#3}\ifshowednotes\ed@margin{#4:\arabic{ednote}}\fi}
\newcommand\ednote@label{EdNote}
\newcommand\ednote@margin{EdN}
\newcommand\ednotelabel[1]{\def\ednote@label{#1}}
\newcommand\ednotemargin[1]{\def\ednote@margin{#1}}
\newcommand{\Ednote}[2][]{\Ed@note{#2}\ednote@label{#1}}
\newcommand{\ednote}[2][]{\ed@note{#2}\ednote@label{#1}\ednote@margin}
\newcommand\tweaklabel[1]{\def\tweak@label{#1}}
\newcommand\tweak@label{Tweak}
\newcommand\tweakmargin[1]{\def\tweak@margin{#1}}
\newcommand\tweak@margin{Tw}
\newcommand{\tweak}[2][]{\ed@note{#2}\tweak@label{#1}\tweak@margin}
\newcommand{\Tweak}[2][]{\Ed@note{#2}\tweak@label{#1}}
\newcommand\edissue@label{Issue}
\newcommand\edissuelabel[1]{\def\edissue@label{#1}}
\newcommand\edissue@margin{Is}
\newcommand\edissuemargin[1]{\def\edissue@margin{#1}}
\providecommand{\issue}[2][]{\ed@note{#2}\edissue@label{#1}\edissue@margin}
\providecommand{\Issue}[2][]{\Ed@note{#2}\edissue@label{#1}}
\newcommand{\edissue}[2][]{\ed@note{#2}\edissue@label{#1}\edissue@margin}
\newcommand{\edIssue}[2][]{\Ed@note{#2}\edissue@label{#1}}
\newenvironment{Ed@part}[3]% text, mess, start
{\addtocounter{ednote}{1}\edef\new@number{\theednote}\message{#2!\new@number}
\ifshowednotes\ed@foot{#1}{#2}{}\fi}
{}
\def\ed@part#1#2#3#4% text, mess, start, margin
{\Ed@part{#1}{#2}{#3}\ifshowednotes\ed@margin{#4:\new@number}\fi}
\def\ended@part#1{\endEd@part\ifshowednotes\ed@margin{#1:\new@number}\fi}
\newcommand\b@newpart@label{BegNP}\newcommand\e@newpart@label{EndNP}
\newcommand\b@newpart@margin{BNP}\newcommand\e@newpart@margin{ENP}
\newcommand\newpartmargins[2]{\def\b@newpart@margin{#1}\def\e@newpart@margin{#2}}
\newenvironment{Newpart}[1]{\Ed@part{#1}{New Part}\b@newpart@label}{\endEd@part}
\newenvironment{newpart}[1]{\ed@part{#1}{New Part}\b@newpart@label\b@newpart@margin}{\ended@part\e@newpart@margin}
\newcommand\oldpartlabels[2]{\def\b@oldpart@label{#1}\def\e@oldpart@label{#2}}
\newcommand\oldpartmargins[2]{\def\b@oldpart@margin{#1}\def\e@oldpart@margin{#2}}
\newcommand\b@oldpart@label{BegOP}\newcommand\e@oldpart@label{EndOP}
\newcommand\b@oldpart@margin{BOP}\newcommand\e@oldpart@margin{EOP}
\newenvironment{Oldpart}[1]%
{\Ed@part{#1}{Old Part}\b@oldpart@label\ifshowednotes\color{gray}\fi}
{\endEd@part}
\newenvironment{oldpart}[1]%
{\ed@part{#1}{Old Part}\b@oldpart@label\b@oldpart@margin\ifshowednotes\color{gray}\fi}
{\ended@part\e@oldpart@margin}
\newcommand\todolabels[2]{\def\b@todo@label{#1}\def\e@todo@label{#2}}
\newcommand\todomargins[2]{\def\b@todo@margin{#1}\def\e@todo@margin{#2}}
\newcommand\b@todo@label{ToDo}\newcommand\e@todo@label{Done}
\newcommand\b@todo@margin{ToDo}\newcommand\e@todo@margin{Done}
\newenvironment{Todo}[1]%
{\Ed@part{#1}{To Do}\b@todo@label\ifshowednotes\bgroup\ednoteshape\else\comment\fi}
{\endEd@part\e@todo@label\ifshowednotes\egroup\else\endcomment\fi}
\newenvironment{todo}[1]%
{\ed@part{#1}{To Do}\b@todo@label\b@todo@margin\ifshowednotes\bgroup\ednoteshape\else\comment\fi}
{\ended@part\e@todo@margin\ifshowednotes\egroup\else\endcomment\fi}
\newenvironment{Todolist}[1]{% the comment
\ifshowednotes\message{todolist!}{{\ednoteshape To Do: #1}}\bgroup\ednoteshape\begin{compactenum}%
\else\comment%
\fi}
{\ifshowednotes\end{compactenum}\egroup\else\endcomment\fi}
\newenvironment{todolist}[1]{\ifshowednotes\ed@margin{{\ednoteshape ToDo}}\Todolist{#1}\fi}
{\endTodolist}
\newenvironment{musings}{\ifshowednotes\color{blue}\fi}{}
\def\ed@stubURI{}
\newcommand\edstuURI[1]{\gdef\ed@stubURI{#1}}
\newif\ifhref\hreffalse
\AtBeginDocument{\@ifpackageloaded{hyperref}{\hreftrue}{\hreffalse}}
\newenvironment{edstub}[2][]
{\def\@test{#1}\begin{center}\huge\color{red}
\ifx\@test\@empty The following blue text \else #1 \fi is only a provisional stub\\\Large
the Office document
\ifx\ed@stubURI\@empty{#2}\else\ifhref\href{\ed@stubURI}{#2}\else{#2}\fi\fi\
contains more text\\which will be merged for the final document
  \end{center}\color{blue}}
{}
\newcommand\@ednotemessage{\ifnum\value{ednote}>0\typeout{}%
\typeout{There are still \arabic{ednote} EdNotes, New/Oldparts, and Issues to resolve!}%
\typeout{}\fi}
\AtEndDocument{\@ednotemessage}
\newcommand\ednotemessage{\PackageWarning{ed}{The `\ednotemessage' macro is obsolete, the message
  is generated automatically now.}}
\newcommand\edexplanation{\todolist{we will use the ednote system to communicate}
\item use the {\tt{\char92ednote\char123author: some explanatory text\char125}}
  like a footnote to say what you have done or what should still be
  done\ednote{MiKo: this is an example of an ednote}. Ednotes are numbered and
  marked in the margin for easy recognition.
\item use the {\tt{\char92issue\char123author: explanation of the
      issue\char125}} variant of ednote for issues\issue{this is an example of
    an issue} that still have to be discussed.
\item finally, the {\tt{todolist}} environment is a list environment that can be
  used to mark up todo lists. This explanation is an example of a todo list, it
  is inserted into the text in a different font.
\item the {\tt{newpart}} environment can be used to mark up changed text blocks.
  {\tt{\char92begin\char123newpart\char125}} takes an argument that is
  interpreted as a comment and is treated like an {\tt{\char92ednote}} comment.
\item the {\tt{oldpart}} environment is similar to {\tt{newpart}} but is used
  for old parts of text copied from another document that still need to be
  changed in a document.
\item putting the macro {\tt{\char92ednotemessage}} just before the
  {\tt{char92end\char123document\char125}} will generate a message with
  cardinality information for the ednotes into the log file.
\item all of these text decorations and meta-annotations are only inserted into
  the text, if the {\tt{show}} package option in the {\tt{\char92 usepackage}}
  directive in the preamble of the document is set: {\tt{\char92
      usepackage[show]\char123ed\char125}} will show the decorations, while
  {\tt{\char92 usepackage\char123ed\char125}} will not. This is useful for
  preparing ``clean'' version for outside consumption without loosing the
  management metadata.
\endtodolist}
\endinput
%%
%% End of file `ed.sty'.