blob: a4bbeec7d4f29755e01d98f8ccc1aa7a1e799402 (
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
|
% Created by Juan Rada-Vilela
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{easy-todo}[2013/11/15]
\def\@todoindexas{chapter}
\newcommand{\todoindexas}[1]{\def\@todoindexas{#1}}
\def\@todoenable{true}
\newcommand{\todoenable}[1]{\def\@todoenable{#1}}
\DeclareOption{chapter}{\todoindexas{chapter}}
\DeclareOption{section}{\todoindexas{section}}
\DeclareOption{final}{\todoenable{false}}
\DeclareOption{enabled}{\todoenable{true}}
\DeclareOption{enable}{\todoenable{true}}
\DeclareOption{disabled}{\todoenable{false}}
\DeclareOption{disable}{\todoenable{false}}
\DeclareOption*{%
\PackageError{easy-todo}{What is \CurrentOption ?}{Options available: final, enable(d), disable(d), chapter, section}%
\todoindexas{chapter}
}
\ProcessOptions
\RequirePackage{color} %to add colour
\RequirePackage{tocloft} %to create index
\RequirePackage{ifthen}
\newcommand{\todoindextitle}{ToDo}
\newcommand{\todoindexpagetitle}{P.}
\newcommand{\todocolor}{\color{red}}
\newcommand{\listoftodosname}{\todoindextitle}
\newlistof[part]{todos}{lod}{\listoftodosname}
%Command: listoftodos
%Description: Creates the todo list (Section or Chapter)
\renewcommand{\listoftodos}{
{
\ifthenelse{\equal{\@todoenable}{true}}
{
\todocolor
\ifthenelse{\equal{\@todoindexas}{chapter}}
{\chapter*{\todoindextitle}}
{
\ifthenelse{\equal{\@todoindexas}{section}}
{\centering\section*{\todoindextitle}}
{\PackageError{easy-todo}{Index as \@todoindexas NOT valid}{Choose between chapter or section}}
}
\flushright{\textbf{\todoindexpagetitle}}
\@starttoc{lod}}
\newpage
}
{}
}
\renewcommand{\thetodos}{\@arabic\c@todos}
%Command: todo
%Description: Creates a todo note with the number and information
%Parameter: TODO note
\newcommand{\todo}[1]{%
\todoii{#1}{#1}%
}
%Command: todoi
%Description: Creates a todo note with just a number
%Parameters: [1] the information to show at the list
\newcommand{\todoi}[1]{
\todoii{}{#1}
}
%Command: todoii
%Description: Creates a todo note
%Parameters: [1] the note to show, [2] the information to show at the list
\newcommand{\todoii}[2]{
\ifthenelse{\equal{\@todoenable}{true}}{%
\refstepcounter{todos}%
\noindent{\todocolor\normalfont\scriptsize{\bfseries{\thetodos.#1}}}%
\addcontentsline{lod}{todos}{\protect{\thetodos. }#2}%
}{}
}
|