From 2a8bfdf220d7f65a85d288b2edef58e46dd9f654 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 3 Apr 2010 15:37:37 +0000 Subject: todo 2.4142 (31mar10) git-svn-id: svn://tug.org/texlive/trunk@17660 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/todo/todo.sty | 147 +++++++++++++++++++++--------- 1 file changed, 105 insertions(+), 42 deletions(-) (limited to 'Master/texmf-dist/tex/latex/todo') diff --git a/Master/texmf-dist/tex/latex/todo/todo.sty b/Master/texmf-dist/tex/latex/todo/todo.sty index 67769f6fb4b..96a033704dd 100644 --- a/Master/texmf-dist/tex/latex/todo/todo.sty +++ b/Master/texmf-dist/tex/latex/todo/todo.sty @@ -6,57 +6,120 @@ %% %% todo.dtx (with options: `package') %% -%% Copyright 2002 Federico Garcia +%% Copyright 2002-10 Federico Garcia %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{todo}[2002/07/25 v1.1 To-do list (Federico Garcia)] +\ProvidesPackage{todo}[2010/03/31 v2.4142 To-do list (Federico Garcia)] +\RequirePackage{amssymb} +\newtoks\@todotoks\@todotoks{} +\newif\if@todo\@todotrue +\newcounter{todo}\setcounter{todo}{0} +\newcommand*\todomark{To~do} +\newcommand*\todoname{To do\dots} \newcommand\@todomark{} -\newcommand\@todohide{} -\DeclareOption{hide}{\renewcommand\@todohide[1]{% - \PackageWarning{todo}{`hide' option used, % - ignoring \noexpand\todo's}}} -\DeclareOption{show}{\renewcommand\@todohide[1]{#1}} -\DeclareOption{superscript}{\renewcommand\@todomark{% - \@todosupermark}} -\DeclareOption{marginpar}{\renewcommand\@todomark{% - \@todomarginpar}} -\DeclareOption{nothing}{\let\@todomark\@gobble} +\let\@todohide\relax +\let\todoformat\bfseries +\DeclareOption{nothing}{\renewcommand*\@tododisplay[1]{}} +\DeclareOption{hide}{\let\@todohide\@gobble + \renewcommand*\@tododisplay[1]{% + \PackageWarning{todo}{`hide' option used, ignoring \string\todo's}}} +\DeclareOption{superscript}{\let\@tododisplay\textsuperscript} +\DeclareOption{marginpar}{\renewcommand*\todoformat{\sffamily\raggedright\small}% + \let\@tododisplay\marginpar} \DeclareOption*{\typeout{Unknown option (`\CurrentOption')}} -\ExecuteOptions{superscript,show} +\ExecuteOptions{superscript} \ProcessOptions -\newtoks\@todotoks\@todotoks{} -\newcounter{todo}\setcounter{todo}{0} -\newcommand{\todomark}{To~do} -\newcommand{\todoname}{To do\dots} -\newcommand{\todo}[2][\todomark]{\@bsphack\@todohide{% - \refstepcounter{todo}\label{todopage:\thetodo}% - \@todomark{#1}% - \@todotoks\expandafter{\the\@todotoks\relax% - \todoitem{#1}{#2}}% - }\@esphack} -\newcommand{\@todosupermark}[1]{% - \leavevmode - \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi - \textsuperscript{\textbf{#1} (\ref{todolbl:\thetodo})} - \ifhmode\spacefactor\@x@sf\fi - \relax} -\newcommand{\@todomarginpar}[1]{\marginpar{#1 (\ref{todolbl:\thetodo})}} -\newcommand{\todoitem}[2]{% - \item \label{todolbl:\thetodo} % - \ifx#1\todomark% - \else\textbf{#1 }% - \fi% - (p.~\pageref{todopage:\thetodo})\ #2} -\newcommand{\todos}{\@todohide{% +\newcommand\todos{% + \ifnum\c@todo>0 + \@todohide{% \clearpage\section*{\todoname}\large% - \begin{list}{\fbox{\vphantom{Ap}\hphantom{A}}% - \quad\arabic{todo}.}{}% + \begin{list}{$\Box$% + \quad\arabic{todo}}{}% \usecounter{todo} \the\@todotoks \end{list}} - \renewcommand{\todo}[1]{% - \PackageWarning{todo}{\noexpand\todos already issued, % - ignoring \noexpand\todo}}} + \renewcommand*\todo{% + \PackageWarning{todo}{All \string\todo\space commands are ignored after + \string\todos}% + \@ifnextchar*{\@todogobble}{\@todogobble*}}% + \let\Todo\todo + \renewenvironment{todoenv}{\PackageWarning{todo}{\string\todoenv\space after + \string\todos\space not processed as a todo item}}{}% + \renewcommand\todos{\PackageError{todo}{Second \string\todos\space ignored}% + {I can only make one list of todo items. I'll be Ok if you press enter, + but all \string\todo\space commands after the first \string\todos\space + have been ignored.}}% + \else + \PackageWarning{todo}{Nothing \string\todo! I'm ignoring the \string\todos\space + command}% + \fi + } +\newcommand\@todogobble[1]{\@@todogobble} +\newcommand\@@todogobble[2][\todomark]{\relax} +\newcommand\todoitem[2]{% + \item \label{todolbl:\thetodo}% + (p.~\pageref{todopage:\thetodo}): + {\todoformat\ifx#1\todomark\else#1 \fi}#2}% +\newcommand\doneitem[2]{% + \stepcounter{todo}% + \item[\rlap{$\checkmark$}$\Box$\quad + \arabic{todo}]\@nameuse{@done\the\c@todo}(p.~\pageref{todopage:\thetodo}): + {\todoformat\ifx#1\todomark\else#1 \fi}#2} +\newcommand\done[2][\relax]{% + \ifx#2\todo\@todofalse\else + \ifx#2\Todo\@todofalse\else + \PackageWarning{Floating \string\done\space ignored.}% + \fi\fi + \@tempcnta\c@todo\advance\@tempcnta1 + \@namedef{@done\the\@tempcnta}{#1 }#2% + } +\newcommand\@newtodo{\refstepcounter{todo}\label{todopage:\thetodo}} +\newcommand*\todo{\@ifnextchar*{\@newtodo\@displaynothing}{% + \@newtodo + \if@todo + \expandafter\@displaytodo + \else + \expandafter\@donetodo + \fi}} +\newcommand\Todo{\@ifnextchar*{% + \PackageWarning{todo}{Starred \string\Todo* taken as\string\todo*}% + \expandafter\todo}% + {\@newtodo\@displayfulltodo}} +\newenvironment{todoenv}{\@newtodo + \global\@todotoks\expandafter{\the\@todotoks\relax\todoitem + {}{{\itshape see text.}}}% + \todoopen\todoenvformat}{\todoclose} +\newcommand*\astodos[1]{\@tododisplay{{\todoformat #1}}} +\newcommand*\todoopen{\astodos{\todomark\ begin}} +\newcommand*\todoclose{\astodos{\todomark\ end + \normalfont(\ref{todolbl:\thetodo})}}\newcommand\todoenvformat{} +\newcommand\@displaytodo[2][\todomark]{% + \@tododisplay{{\todoformat #1} (\ref{todolbl:\thetodo})}% + \global\@todotoks\expandafter{\the\@todotoks\todoitem{#1}{#2}}% + \@todotrue + } +\newcommand\@displaynothing[1]{\@@displaynothing} +\newcommand\@@displaynothing[2][\todomark]{% + \if@todo + \global\@todotoks\expandafter{\the\@todotoks\todoitem{#1}{#2}}% + \else + \global\@todotoks\expandafter{\the\@todotoks\doneitem{#1}{#2}}% + \fi + \@todotrue + } +\newcommand\@displayfulltodo[2][\todomark]{% + \if@todo + \@tododisplay{{\todoformat #1} #2 (\ref{todolbl:\thetodo})}% + \global\@todotoks\expandafter{\the\@todotoks\todoitem{#1}{#2}}% + \else + \global\@todotoks\expandafter{\the\@todotoks\doneitem{#1}{#2}}% + \fi + \@todotrue + } +\newcommand\@donetodo[2][\todomark]{% + \global\@todotoks\expandafter{\the\@todotoks\doneitem{#1}{#2}}% + \@todotrue + } \endinput %% %% End of file `todo.sty'. -- cgit v1.2.3