summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/todo/todo.sty
blob: 96a033704dde5b0b227b294d1040e801ffafa825 (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
%%
%% This is file `todo.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% todo.dtx  (with options: `package')
%% 
%% Copyright 2002-10 Federico Garcia
%% 
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{todo}[2010/03/31 v2.4142 To-do list (Federico Garcia)]
\RequirePackage{amssymb}
\newtoks\@todotoks\@todotoks{}
\newif\if@todo\@todotrue
\newcounter{todo}\setcounter{todo}{0}
\newcommand*\todomark{To~do}
\newcommand*\todoname{To do\dots}
\newcommand\@todomark{}
\let\@todohide\relax
\let\todoformat\bfseries
\DeclareOption{nothing}{\renewcommand*\@tododisplay[1]{}}
\DeclareOption{hide}{\let\@todohide\@gobble
    \renewcommand*\@tododisplay[1]{%
    \PackageWarning{todo}{`hide' option used, ignoring \string\todo's}}}
\DeclareOption{superscript}{\let\@tododisplay\textsuperscript}
\DeclareOption{marginpar}{\renewcommand*\todoformat{\sffamily\raggedright\small}%
    \let\@tododisplay\marginpar}
\DeclareOption*{\typeout{Unknown option (`\CurrentOption')}}
\ExecuteOptions{superscript}
\ProcessOptions
\newcommand\todos{%
    \ifnum\c@todo>0
        \@todohide{%
        \clearpage\section*{\todoname}\large%
        \begin{list}{$\Box$%
                \quad\arabic{todo}}{}%
            \usecounter{todo}
            \the\@todotoks
        \end{list}}
        \renewcommand*\todo{%
            \PackageWarning{todo}{All \string\todo\space commands are ignored after
                \string\todos}%
            \@ifnextchar*{\@todogobble}{\@todogobble*}}%
        \let\Todo\todo
        \renewenvironment{todoenv}{\PackageWarning{todo}{\string\todoenv\space after
            \string\todos\space not processed as a todo item}}{}%
        \renewcommand\todos{\PackageError{todo}{Second \string\todos\space ignored}%
            {I can only make one list of todo items. I'll be Ok if you press enter,
            but all \string\todo\space commands after the first \string\todos\space
            have been ignored.}}%
    \else
        \PackageWarning{todo}{Nothing \string\todo! I'm ignoring the \string\todos\space
            command}%
    \fi
    }
\newcommand\@todogobble[1]{\@@todogobble}
\newcommand\@@todogobble[2][\todomark]{\relax}
\newcommand\todoitem[2]{%
    \item \label{todolbl:\thetodo}%
    (p.~\pageref{todopage:\thetodo}):
    {\todoformat\ifx#1\todomark\else#1 \fi}#2}%
\newcommand\doneitem[2]{%
    \stepcounter{todo}%
    \item[\rlap{$\checkmark$}$\Box$\quad
        \arabic{todo}]\@nameuse{@done\the\c@todo}(p.~\pageref{todopage:\thetodo}):
        {\todoformat\ifx#1\todomark\else#1 \fi}#2}
\newcommand\done[2][\relax]{%
    \ifx#2\todo\@todofalse\else
        \ifx#2\Todo\@todofalse\else
        \PackageWarning{Floating \string\done\space ignored.}%
    \fi\fi
    \@tempcnta\c@todo\advance\@tempcnta1
    \@namedef{@done\the\@tempcnta}{#1 }#2%
    }
\newcommand\@newtodo{\refstepcounter{todo}\label{todopage:\thetodo}}
\newcommand*\todo{\@ifnextchar*{\@newtodo\@displaynothing}{%
    \@newtodo
    \if@todo
        \expandafter\@displaytodo
    \else
        \expandafter\@donetodo
    \fi}}
\newcommand\Todo{\@ifnextchar*{%
    \PackageWarning{todo}{Starred \string\Todo* taken as\string\todo*}%
        \expandafter\todo}%
    {\@newtodo\@displayfulltodo}}
\newenvironment{todoenv}{\@newtodo
    \global\@todotoks\expandafter{\the\@todotoks\relax\todoitem
        {}{{\itshape see text.}}}%
    \todoopen\todoenvformat}{\todoclose}
\newcommand*\astodos[1]{\@tododisplay{{\todoformat #1}}}
\newcommand*\todoopen{\astodos{\todomark\ begin}}
\newcommand*\todoclose{\astodos{\todomark\ end
    \normalfont(\ref{todolbl:\thetodo})}}\newcommand\todoenvformat{}
\newcommand\@displaytodo[2][\todomark]{%
    \@tododisplay{{\todoformat #1} (\ref{todolbl:\thetodo})}%
    \global\@todotoks\expandafter{\the\@todotoks\todoitem{#1}{#2}}%
    \@todotrue
    }
\newcommand\@displaynothing[1]{\@@displaynothing}
\newcommand\@@displaynothing[2][\todomark]{%
    \if@todo
        \global\@todotoks\expandafter{\the\@todotoks\todoitem{#1}{#2}}%
    \else
        \global\@todotoks\expandafter{\the\@todotoks\doneitem{#1}{#2}}%
    \fi
    \@todotrue
    }
\newcommand\@displayfulltodo[2][\todomark]{%
    \if@todo
        \@tododisplay{{\todoformat #1} #2 (\ref{todolbl:\thetodo})}%
        \global\@todotoks\expandafter{\the\@todotoks\todoitem{#1}{#2}}%
    \else
        \global\@todotoks\expandafter{\the\@todotoks\doneitem{#1}{#2}}%
    \fi
    \@todotrue
    }
\newcommand\@donetodo[2][\todomark]{%
    \global\@todotoks\expandafter{\the\@todotoks\doneitem{#1}{#2}}%
    \@todotrue
    }
\endinput
%%
%% End of file `todo.sty'.