fiet/Home: todo.sty

File todo.sty, 2.7 KB (added by fiet, 3 years ago)
Line 
1\ProvidesPackage{todo}[23/09/2007 v1.0 todo]%
2%
3% By Marc Schinnenburg
4%
5% This package has two options:
6%   * final: This ensures that no todo is left in the document ...
7%   * nice:  Render nicer Todo boxes
8%   * none:  Disable all Todos
9% Usage:
10%   One of the following to include it:
11%   \usepackage[]{todo}
12%   \usepackage[none]{todo}
13%   \usepackage[nice]{todo}
14%   \usepackage[final]{todo}
15%
16%
17%   Place \todo{rephrase}{this needs rephrasing} anywhere in your tex document
18%
19\newcounter{todoCounter}
20\newif\ifTodoFinal%
21\TodoFinalfalse%
22\newif\ifTodoNone%
23\TodoNonefalse%
24\newif\ifTodoNice%
25\TodoNicefalse%
26\DeclareOption{nice}{%
27\TodoNicetrue%
28}%
29\DeclareOption{none}{%
30\TodoNonetrue%
31}
32\DeclareOption{final}{%
33\TodoFinaltrue%
34}%
35%
36\ProcessOptions%
37%
38\ifTodoFinal%
39\newcommand \listoftodos[0]{}
40\newcommand{\todo}[3][]{%
41\stepcounter{todoCounter}
42\PackageError{todo}{No todo allowed in final version (Todo \arabic{todoCounter}: #2)}{Remove the todo}%
43}%
44\else%
45\ifTodoNone%
46\newcommand \listoftodos[0]{}
47\newcommand{\todo}[3][]{%
48\stepcounter{todoCounter}
49{#2}%
50}%
51\else%
52\RequirePackage{setspace}%
53\RequirePackage{color}%
54\ifTodoNice%
55\RequirePackage{tikz}%
56\fi
57\definecolor{todoTextColor}{rgb}{.8,0.0,0.0}%
58\ifTodoNice%
59\definecolor{todoBackgroundColor}{rgb}{1.0,.6,.6}
60\newcommand{\todo}[3][]{%
61\stepcounter{todoCounter}
62\addcontentsline{tdo}{todo}{\protect{#2}}%
63\textcolor{todoTextColor}{#3}%
64\def\@todoReference{#1}%
65%
66\begin{tikzpicture}[remember picture, baseline=-0.75ex]%
67\node [coordinate](inText){};%
68\end{tikzpicture}%
69%
70% Make the margin par
71\marginpar{%
72\begin{tikzpicture}[remember picture]%
73\draw node[draw=black, fill=todoBackgroundColor, text width = \marginparwidth](inNote){%
74\begin{spacing}{0.5}%
75\textsf{\scriptsize{Todo~\arabic{todoCounter}: #2\ifx\@todoReference\@empty\relax\else\\(p.~\pageref{\@todoReference}, \ref{\@todoReference})\fi}}%
76\end{spacing}};%
77\end{tikzpicture}%
78}%
79\begin{tikzpicture}[remember picture, overlay]%
80\draw[draw=todoTextColor, thick]([yshift=-0.2cm] inText) -| ([xshift=-0.2cm] inNote.west) -| (inNote.west);%
81\end{tikzpicture}%
82}%
83\else%
84\newcommand{\todo}[3][]{%
85\addcontentsline{tdo}{todo}{\protect{#2}}%
86\stepcounter{todoCounter}
87\def\@todoReference{#1}%
88\textcolor{todoTextColor}{#3}%
89\marginpar{%
90\begin{spacing}{0.5}%
91\textsf{\scriptsize{\textcolor{todoTextColor}{Todo~\arabic{todoCounter}: \it{#2}\ifx\@todoReference\@empty\relax\else\\(p.~\pageref{\@todoReference}, \ref{\@todoReference})\fi}}}%
92\end{spacing}%
93}%
94}%
95\fi%
96\makeatletter \newcommand \listoftodos{\chapter{ToDo list} \@starttoc{tdo}}%
97\newcommand\l@todo[2]%
98{\par\noindent \textit{#2}, \parbox{10cm}{#1}\par} \makeatother%
99\fi%
100\fi%
101%