% 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}% }{} }