summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easy-todo/easy-todo.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/easy-todo/easy-todo.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/easy-todo/easy-todo.sty')
-rw-r--r--macros/latex/contrib/easy-todo/easy-todo.sty94
1 files changed, 94 insertions, 0 deletions
diff --git a/macros/latex/contrib/easy-todo/easy-todo.sty b/macros/latex/contrib/easy-todo/easy-todo.sty
new file mode 100644
index 0000000000..359475fe23
--- /dev/null
+++ b/macros/latex/contrib/easy-todo/easy-todo.sty
@@ -0,0 +1,94 @@
+% 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}%
+}{}%
+}
+
+
+
+