% Created by Juan Rada-Vilela % jcrada@fuzzylite.com \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{easy-todo}[2014/01/01] \def\@todoindexas{section} \newcommand{\todoindexas}[1]{\def\@todoindexas{#1}} \def\@todoenable{true} \newcommand{\todoenable}[1]{\def\@todoenable{#1}} \def\@todoobeyfinal{false} \newcommand{\todoobeyfinal}[1]{\def\@todoobeyfinal{#1}} \DeclareOption{chapter}{\todoindexas{chapter}} \DeclareOption{section}{\todoindexas{section}} \DeclareOption{obeyFinal}{\todoobeyfinal{true}} \DeclareOption{enable}{\todoenable{true}} \DeclareOption{disable}{\todoenable{false}} \DeclareOption*{% \PackageError{easy-todo}{What is \CurrentOption ?}{Options available: enable, disable, obeyFinal, chapter, section}% \todoindexas{chapter} } \ProcessOptions \RequirePackage{color} %to add colour \RequirePackage{tocloft} %to create index \RequirePackage{ifthen} %to ifthenelse conditions \RequirePackage{ifdraft} %to detect draft/final options \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}\unskip% } %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}\unskip% } %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{\@todoobeyfinal}{true}}{% \ifoptionfinal{\todoenable{false}}{\todoenable{true}}% }{}% \ifthenelse{\equal{\@todoenable}{true}}{% \refstepcounter{todos}% \noindent{\todocolor\normalfont\scriptsize{\bfseries{\thetodos.#1}}}% \addcontentsline{lod}{todos}{\protect{\thetodos. }#2}% }{}% }