]> git.donarmstrong.com Git - lib.git/blob - texmf/tex/latex/fixme.sty
f7a7271c984d3ec0767153b71008ec9365d1766c
[lib.git] / texmf / tex / latex / fixme.sty
1 %%
2 %% This is file `fixme.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% fixme.dtx 
8 %% 
9
10
11 %% Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Didier Verna
12
13 %% This file is part of FiXme.
14
15 %% FiXme may be distributed and/or modified under the
16 %% conditions of the LaTeX Project Public License, either version 1.1
17 %% of this license or (at your option) any later version.
18 %% The latest version of this license is in
19 %% http://www.latex-project.org/lppl.txt
20 %% and version 1.1 or later is part of all distributions of LaTeX
21 %% version 1999/06/01 or later.
22
23 %% FiXme consists of the files listed in the file `README'.
24
25 %% \CharacterTable
26 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
27 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
28 %%   Digits        \0\1\2\3\4\5\6\7\8\9
29 %%   Exclamation   \!     Double quote  \"     Hash (number) \#
30 %%   Dollar        \$     Percent       \%     Ampersand     \&
31 %%   Acute accent  \'     Left paren    \(     Right paren   \)
32 %%   Asterisk      \*     Plus          \+     Comma         \,
33 %%   Minus         \-     Point         \.     Solidus       \/
34 %%   Colon         \:     Semicolon     \;     Less than     \<
35 %%   Equals        \=     Greater than  \>     Question mark \?
36 %%   Commercial at \@     Left bracket  \[     Backslash     \\
37 %%   Right bracket \]     Circumflex    \^     Underscore    \_
38 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
39 %%   Right brace   \}     Tilde         \~}
40 \NeedsTeXFormat{LaTeX2e}
41
42 \ProvidesPackage{fixme}[2005/01/31 v3.1
43                         Insert fixme notes in your documents]
44
45 \RequirePackage{ifthen}
46 \RequirePackage{verbatim}
47
48 \newcommand*\fixmelogo{\textsf{FiXme}}
49
50 \newcommand\listoffixmes{}
51 \def\listoffixmes@final{}
52 \def\listoffixmes@draft{%
53   \IfFileExists{\jobname .lox}{\@listoffixmes@pretoc}{}%
54   \@starttoc{lox}%
55   \IfFileExists{\jobname .lox}{\@listoffixmes@posttoc}{}%
56   }
57
58 \newcommand*\listfixmename{}
59
60 \def\@listoffixmes@pretoc@article{%
61   \section*{\listfixmename%
62     \@mkboth{\MakeUppercase\listfixmename}{\MakeUppercase\listfixmename}}%
63   }
64 \def\@listoffixmes@posttoc@article{}
65 \def\l@fixme@article{\@dottedtocline{1}{1.5em}{2.3em}}
66
67 \def\@listoffixmes@pretoc@report{%
68   \if@twocolumn
69     \@restonecoltrue\onecolumn
70   \else
71     \@restonecolfalse
72   \fi
73   \chapter*{\listfixmename%
74     \@mkboth{\MakeUppercase\listfixmename}{\MakeUppercase\listfixmename}}%
75   }
76 \def\@listoffixmes@posttoc@report{\if@restonecol\twocolumn\fi}
77 \def\l@fixme@report{\@dottedtocline{1}{1.5em}{2.3em}}
78
79 \def\@listoffixmes@pretoc@book{%
80   \if@twocolumn
81     \@restonecoltrue\onecolumn
82   \else
83     \@restonecolfalse
84   \fi
85   \chapter*{\listfixmename%
86     \@mkboth{\MakeUppercase\listfixmename}{\MakeUppercase\listfixmename}}%
87   }
88 \def\@listoffixmes@posttoc@book{\if@restonecol\twocolumn\fi}
89 \def\l@fixme@book{\@dottedtocline{1}{1.5em}{2.3em}}
90
91 \def\@listoffixmes@pretoc@scrartcl{%
92   \section*{\listfixmename%
93     \@mkboth{\listfixmename}{\listfixmename}}%
94   }
95 \def\@listoffixmes@posttoc@scrartcl{}
96 \def\l@fixme@scrartcl{\@dottedtocline{1}{1.5em}{2.3em}}
97
98 \def\@listoffixmes@pretoc@scrreprt{%
99   \if@twocolumn
100     \@restonecoltrue\onecolumn
101   \else
102     \@restonecolfalse
103   \fi
104   \chapter*{\listfixmename%
105     \@mkboth{\listfixmename}{\listfixmename}}%
106   }
107 \def\@listoffixmes@posttoc@scrreprt{\if@restonecol\twocolumn\fi}
108 \def\l@fixme@scrreprt{\@dottedtocline{1}{1.5em}{2.3em}}
109
110 \def\@listoffixmes@pretoc@scrbook{%
111   \if@twocolumn
112     \@restonecoltrue\onecolumn
113   \else
114     \@restonecolfalse
115   \fi
116   \chapter*{\listfixmename%
117     \@mkboth{\listfixmename}{\listfixmename}}%
118   }
119 \def\@listoffixmes@posttoc@scrbook{\if@restonecol\twocolumn\fi}
120 \def\l@fixme@scrbook{\@dottedtocline{1}{1.5em}{2.3em}}
121
122 \newcommand\FXInline[2]{%
123   \textbf{#1}: \emph{#2}}
124 \newcommand\FXMargin[2]{%
125   \marginpar{\footnotesize\raggedleft\textbf{#1}: \emph{#2}}}
126 \newcommand\FXFootnote[2]{%
127   \footnote{\textbf{#1}: \emph{#2}}}
128
129 \newcommand*\fixmeindexname{}
130 \newcommand\FXIndex[1]{%
131   \index{***@\fixmeindexname:!#1}}
132
133 \newcommand*\fixmefatalprefix{}
134 \newcommand\FiXmeInline[1]{\FXInline{\fixmefatalprefix}{#1}}
135 \newcommand\FiXmeMargin[1]{\FXMargin{\fixmefatalprefix}{#1}}
136 \newcommand\FiXmeFootnote[1]{\FXFootnote{\fixmefatalprefix}{#1}}
137 \newcommand\FiXmeUser[1]{}
138 \let\FiXmeUser\empty
139
140 \newcommand\FiXmeIndex[1]{\FXIndex{#1}}
141 \newcommand\FiXmeInfo[1]{}
142 \newcommand\FiXmeWarning[1]{}
143
144 \newif\iffixme@inline
145 \newif\iffixme@margin
146 \newif\iffixme@footnote
147 \newif\iffixme@user
148 \newif\iffixme@index
149
150 \def\fixme@text#1#2{%
151   \iffixme@inline\FXInline{#1}{#2}\fi%
152   \iffixme@margin\FXMargin{#1}{#2}\fi%
153   \iffixme@footnote\FXFootnote{#1}{#2}\fi%
154   \iffixme@user\FXUser{#1}{#2}\fi}
155
156 \DeclareOption{inline}{\fixme@inlinetrue}
157 \DeclareOption{noinline}{\fixme@inlinefalse}
158 \DeclareOption{margin}{\fixme@margintrue}
159 \DeclareOption{nomargin}{\fixme@marginfalse}
160 \DeclareOption{footnote}{\fixme@footnotetrue}
161 \DeclareOption{nofootnote}{\fixme@footnotefalse}
162 \DeclareOption{user}{\fixme@usertrue}
163 \DeclareOption{nouser}{\fixme@userfalse}
164 \DeclareOption{index}{\fixme@indextrue}
165 \DeclareOption{noindex}{\fixme@indexfalse}
166
167 \DeclareOption{info}{}
168 \DeclareOption{noinfo}{}
169 \DeclareOption{warning}{}
170 \DeclareOption{nowarning}{}
171
172 \newcommand\FXNote[1]{%
173   \GenericInfo{%
174     (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
175     Package FiXme Note: `#1'}}
176 \newcommand\FXWarning[1]{%
177   \PackageWarning{FiXme}{`#1'}}
178 \newcommand\FXError[1]{%
179   \GenericWarning{%
180     (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
181     Package FiXme Error: `#1'}}
182 \newcommand\FXFatal[1]{%
183   \GenericWarning{%
184     (FiXme)\@spaces\@spaces\@spaces\@spaces}{%
185     Package FiXme: `#1'}}
186
187 \newif\iffixme@silent
188
189 %% Options that control whether to be silent or not:
190 \DeclareOption{silent}{\fixme@silenttrue}
191 \DeclareOption{nosilent}{\fixme@silentfalse}
192
193 \newcounter{fixmecount}
194 \newcounter{fixmenotecount}
195 \newcounter{fixmewarningcount}
196 \newcounter{fixmeerrorcount}
197 \newcounter{fixmefatalcount}
198
199 \newcommand*\fixmenoteprefix{}
200 \newcommand*\fixmenoteindexname{}
201 \def\fixme@note@draft#1{%
202   \fixme@text{\fixmenoteprefix}{#1}%
203   \iffixme@index\FXIndex{\fixmenoteindexname\thefixmenotecount: #1}\fi%
204   \iffixme@silent\else\FXNote{#1}\fi%
205   \addcontentsline{lox}{fixme}{\fixmenoteprefix: #1}}
206 \def\fixme@note@final#1{%
207   \iffixme@silent\else\FXNote{#1}\fi%
208   \addcontentsline{lox}{fixme}{\fixmenoteprefix: #1}}
209
210 \newcommand*\fixmewarningprefix{}
211 \newcommand*\fixmewarningindexname{}
212 \def\fixme@warning@draft#1{%
213   \fixme@text{\fixmewarningprefix}{#1}%
214   \iffixme@index\FXIndex{\fixmewarningindexname\thefixmewarningcount: #1}\fi%
215   \iffixme@silent\else\FXWarning{#1}\fi%
216   \addcontentsline{lox}{fixme}{\fixmewarningprefix: #1}}
217 \def\fixme@warning@final#1{%
218   \iffixme@silent\else\FXWarning{#1}\fi%
219   \addcontentsline{lox}{fixme}{\fixmewarningprefix: #1}}
220
221 \newcommand*\fixmeerrorprefix{}
222 \newcommand*\fixmeerrorindexname{}
223 \def\fixme@error@draft#1{%
224   \fixme@text{\fixmeerrorprefix}{#1}%
225   \iffixme@index\FXIndex{\fixmeerrorindexname\thefixmeerrorcount: #1}\fi%
226   \iffixme@silent\else\FXError{#1}\fi%
227   \addcontentsline{lox}{fixme}{\fixmeerrorprefix: #1}}
228 \def\fixme@error@final#1{%
229   \iffixme@silent\else\FXError{#1}\fi%
230   \addcontentsline{lox}{fixme}{\fixmeerrorprefix: #1}}
231
232 \newcommand*\fixmefatalindexname{}
233 \def\fixme@fatal@draft#1{%
234   \iffixme@inline\FiXmeInline{#1}\fi%
235   \iffixme@margin\FiXmeMargin{#1}\fi%
236   \iffixme@footnote\FiXmeFootnote{#1}\fi%
237   \iffixme@user\FiXmeUser{#1}\fi%
238   \iffixme@index\FiXmeIndex{%
239     \fixmefatalindexname\thefixmefatalcount: #1}\fi%
240   \iffixme@silent\else\FXFatal{#1}\fi%
241   \addcontentsline{lox}{fixme}{\fixmefatalprefix: #1}}
242 \def\fixme@fatal@final#1{%
243   \PackageError{FiXme}{`#1' fixme left in final version}{%
244     You are processing your document in final mode,\MessageBreak
245     but you still have some critical FiXme's left behind.\MessageBreak
246     Type X to quit, fix your document, and rerun LaTeX.}}
247
248 \def\@@fixme#1#2{%
249   \stepcounter{fixmecount}%
250   \stepcounter{fixme#1count}%
251   \csname fixme@#1\endcsname{#2}}
252 \def\@fixme#1[#2]#3{%
253   \bgroup%
254   \fixme@inlinefalse%
255   \fixme@marginfalse%
256   \fixme@footnotefalse%
257   \fixme@userfalse%
258   \fixme@indexfalse%
259   \@for\fixme@option:=#2\do{%
260     \expandafter\ifx\csname fixme@\fixme@option true\endcsname\relax
261       \PackageError{FiXme}{Unknown layout option `\fixme@option'}{%
262         You have given an invalid option to \string\fixme, %
263         or an \string\fx command.\MessageBreak
264         Valid options are `inline', `margin', `footnote' and `index'.%
265         \MessageBreak
266         Type X to quit, fix your document, and rerun LaTeX.}%
267       \else%
268       \csname fixme@\fixme@option true\endcsname%
269     \fi}%
270   \@@fixme{#1}{#3}%
271   \egroup}
272 \newcommand\fxnote{\@ifnextchar[%]
273   {\@fixme{note}}{\@@fixme{note}}}
274 \newcommand\fxwarning{\@ifnextchar[%]
275   {\@fixme{warning}}{\@@fixme{warning}}}
276 \newcommand\fxerror{\@ifnextchar[%]
277   {\@fixme{error}}{\@@fixme{error}}}
278 \newcommand\fixme{\@ifnextchar[%]
279   {\@fixme{fatal}}{\@@fixme{fatal}}}
280
281 \newcommand\FXEnvBegin{\begin{quotation}}
282 \newcommand\FXEnvEnd{\end{quotation}}
283
284 \def\@fxenvbegin@draft#1#2{%
285   \FXEnvBegin
286   \edef\fixme@args{inline\iffixme@index,index\fi}%
287   \csname#1\endcsname[\fixme@args]{#2}}
288 \def\@fxenvbegin@final#1#2{
289   \edef\fixme@args{inline\iffixme@index,index\fi}%
290   \csname#1\endcsname[\fixme@args]{#2}
291   \comment
292 }
293
294 \def\@fxenvend@draft{\FXEnvEnd}
295 \def\@fxenvend@final{\endcomment}
296
297 \newenvironment{anfxnote}[1][]{%
298   \@fxenvbegin{fxnote}{#1}}{%
299   \@fxenvend}
300 \newenvironment{anfxwarning}[1][]{%
301   \@fxenvbegin{fxwarning}{#1}}{%
302   \@fxenvend}
303 \newenvironment{anfxerror}[1][]{%
304   \@fxenvbegin{fxerror}{#1}}{%
305   \@fxenvend}
306 \newenvironment{afixme}[1][]{%
307   \@fxenvbegin{fixme}{#1}}{%
308   \@fxenvend}
309
310 \DeclareOption{english}{%
311   \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Note}
312   \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Warning}
313   \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Error}
314   \renewcommand*\fixmefatalprefix{\fixmelogo}
315   \renewcommand*\fixmeindexname{\fixmelogo}
316   \renewcommand*\fixmenoteindexname{**a@Notes:!}
317   \renewcommand*\fixmewarningindexname{**b@Warnings:!}
318   \renewcommand*\fixmeerrorindexname{**c@Errors:!}
319   \renewcommand*\fixmefatalindexname{}
320   \renewcommand*{\listfixmename}{List of Corrections}}
321 \DeclareOption{french}{%
322   \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Note}
323   \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Attention}
324   \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Erreur}
325   \renewcommand*\fixmefatalprefix{\fixmelogo}
326   \renewcommand*\fixmeindexname{\fixmelogo}
327   \renewcommand*\fixmenoteindexname{**a@Notes:!}
328   \renewcommand*\fixmewarningindexname{**b@Avertissements:!}
329   \renewcommand*\fixmeerrorindexname{**c@Erreurs:!}
330   \renewcommand*\fixmefatalindexname{}
331   \renewcommand*{\listfixmename}{Liste des Corrections}}
332 \DeclareOption{francais}{\ExecuteOptions{french}}
333 \DeclareOption{spanish}{%
334   \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Nota}
335   \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Aviso}
336   \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Error}
337   \renewcommand*\fixmefatalprefix{\fixmelogo}
338   \renewcommand*\fixmeindexname{\fixmelogo}
339   \renewcommand*\fixmenoteindexname{**a@Notas:!}
340   \renewcommand*\fixmewarningindexname{**b@Avisos:!}
341   \renewcommand*\fixmeerrorindexname{**c@Errores:!}
342   \renewcommand*\fixmefatalindexname{}
343   \renewcommand*{\listfixmename}{Lista de Correcciones}}
344 \DeclareOption{italian}{%
345   \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Nota}
346   \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Avviso}
347   \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Errore}
348   \renewcommand*\fixmefatalprefix{\fixmelogo}
349   \renewcommand*\fixmeindexname{\fixmelogo}
350   \renewcommand*\fixmenoteindexname{**a@Note:!}
351   \renewcommand*\fixmewarningindexname{**b@Avvisi:!}
352   \renewcommand*\fixmeerrorindexname{**c@Errori:!}
353   \renewcommand*\fixmefatalindexname{}
354   \renewcommand*{\listfixmename}{Corrigenda}}
355 \DeclareOption{german}{%
356   \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Anm}
357   \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Warnung}
358   \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Fehler}
359   \renewcommand*\fixmefatalprefix{\fixmelogo}
360   \renewcommand*\fixmeindexname{\fixmelogo}
361   \renewcommand*\fixmenoteindexname{**a@Anmerkungen:!}
362   \renewcommand*\fixmewarningindexname{**b@Warnungen:!}
363   \renewcommand*\fixmeerrorindexname{**c@Fehler:!}
364   \renewcommand*\fixmefatalindexname{}
365   \renewcommand*{\listfixmename}{Verzeichnis der Korrekturen}}
366 \DeclareOption{ngerman}{%
367   \ExecuteOptions{german}}
368 \DeclareOption{danish}{%
369   \renewcommand*\fixmenoteprefix{\fixmelogo\nobreakspace Note}
370   \renewcommand*\fixmewarningprefix{\fixmelogo\nobreakspace Advarsel}
371   \renewcommand*\fixmeerrorprefix{\fixmelogo\nobreakspace Fejl}
372   \renewcommand*\fixmefatalprefix{\fixmelogo}
373   \renewcommand*\fixmeindexname{\fixmelogo}
374   \renewcommand*\fixmenoteindexname{**a@Noter:!}
375   \renewcommand*\fixmewarningindexname{**b@Advarsler:!}
376   \renewcommand*\fixmeerrorindexname{**c@Fejl:!}
377   \renewcommand*\fixmefatalindexname{}
378   \renewcommand*{\listfixmename}{Rettelser}}
379
380 \DeclareOption{final}{
381   \let\fixme@note\fixme@note@final
382   \let\fixme@warning\fixme@warning@final
383   \let\fixme@error\fixme@error@final
384   \let\fixme@fatal\fixme@fatal@final
385   \let\@fxenvbegin\@fxenvbegin@final
386   \let\@fxenvend\@fxenvend@final
387   \let\listoffixmes\listoffixmes@final
388   }
389
390 \DeclareOption{draft}{
391   \let\fixme@note\fixme@note@draft
392   \let\fixme@warning\fixme@warning@draft
393   \let\fixme@error\fixme@error@draft
394   \let\fixme@fatal\fixme@fatal@draft
395   \let\@fxenvbegin\@fxenvbegin@draft
396   \let\@fxenvend\@fxenvend@draft
397   \let\listoffixmes\listoffixmes@draft
398   \@ifclassloaded{article}{
399     \let\@listoffixmes@pretoc\@listoffixmes@pretoc@article
400     \let\@listoffixmes@posttoc\@listoffixmes@posttoc@article
401     \let\l@fixme\l@fixme@article}{
402     \@ifclassloaded{report}{
403       \let\@listoffixmes@pretoc\@listoffixmes@pretoc@report
404       \let\@listoffixmes@posttoc\@listoffixmes@posttoc@report
405       \let\l@fixme\l@fixme@report}{
406       \@ifclassloaded{book}{
407         \let\@listoffixmes@pretoc\@listoffixmes@pretoc@book
408         \let\@listoffixmes@posttoc\@listoffixmes@posttoc@book
409         \let\l@fixme\l@fixme@book}{
410         \@ifclassloaded{scrartcl}{
411           \let\@listoffixmes@pretoc\@listoffixmes@pretoc@scrartcl
412           \let\@listoffixmes@posttoc\@listoffixmes@posttoc@scrartcl
413           \let\l@fixme\l@fixme@scrartcl}{
414           \@ifclassloaded{scrreprt}{
415             \let\@listoffixmes@pretoc\@listoffixmes@pretoc@scrreprt
416             \let\@listoffixmes@posttoc\@listoffixmes@posttoc@scrreprt
417             \let\l@fixme\l@fixme@scrreprt}{
418             \@ifclassloaded{scrbook}{
419               \let\@listoffixmes@pretoc\@listoffixmes@pretoc@scrbook
420               \let\@listoffixmes@posttoc\@listoffixmes@posttoc@scrbook
421               \let\l@fixme\l@fixme@scrbook}{
422               %% Use the article layout by default.
423               \let\@listoffixmes@pretoc\@listoffixmes@pretoc@article
424               \let\@listoffixmes@posttoc\@listoffixmes@posttoc@article
425               \let\l@fixme\l@fixme@article}
426             }
427           }
428         }
429       }
430     }
431   }
432
433 \ExecuteOptions{english,final,margin,nosilent}
434 \ProcessOptions*
435
436 \AtBeginDocument{%
437   \ifx\FiXmeUser\empty
438     \renewcommand\FiXmeUser[1]{\FXUser{\fixmefatalprefix}{#1}}
439   \fi}
440
441 \AtEndDocument{%
442   \GenericWarning{%
443     (FiXme)\@spaces\@spaces\@spaces\@spaces
444   }{%
445     Package FiXme Summary: Number of notes: \thefixmenotecount,\MessageBreak%
446     Number of warnings: \thefixmewarningcount,\MessageBreak%
447     Number of errors: \thefixmeerrorcount,\MessageBreak%
448     Number of fatal errors: \thefixmefatalcount,\MessageBreak%
449     Total: \thefixmecount\@gobble%
450   }}
451 \endinput
452 %%
453 %% End of file `fixme.sty'.