From fee76acaf5371903e4593a8431d62a28be18ff27 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 22 Oct 2011 22:57:57 +0000 Subject: todonotes (22oct11) git-svn-id: svn://tug.org/texlive/trunk@24362 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/latex/todonotes/todonotes.pdf | Bin 330702 -> 349878 bytes .../doc/latex/todonotes/todonotesexample.pdf | Bin 48995 -> 49098 bytes .../source/latex/todonotes/todonotes.dtx | 160 ++++++++++++++++++--- .../texmf-dist/tex/latex/todonotes/todonotes.sty | 63 +++++--- 4 files changed, 188 insertions(+), 35 deletions(-) diff --git a/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf b/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf index 72663179748..6b800b99830 100644 Binary files a/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf and b/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf differ diff --git a/Master/texmf-dist/doc/latex/todonotes/todonotesexample.pdf b/Master/texmf-dist/doc/latex/todonotes/todonotesexample.pdf index b5bd8eff4ac..6448749559d 100644 Binary files a/Master/texmf-dist/doc/latex/todonotes/todonotesexample.pdf and b/Master/texmf-dist/doc/latex/todonotes/todonotesexample.pdf differ diff --git a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx index 40cd0464682..9a97f38c63a 100644 --- a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx +++ b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx @@ -22,14 +22,14 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{todonotes} %<*package> - [2011/04/21 .dtx Todonotes source and documentation.] + [2011/10/22 .dtx Todonotes source and documentation.] % % %<*driver> \documentclass{ltxdoc} \usepackage{wrapfig} \usepackage[colorlinks, linkcolor=black]{hyperref} -\usepackage[colorinlistoftodos, shadow]{todonotes}[2011/04/21] +\usepackage[colorinlistoftodos, shadow]{todonotes}[2011/10/22] \usepackage{amsmath} \usepackage{setspace} \setcounter{tocdepth}{2} @@ -46,7 +46,7 @@ % % \fi % -% \CheckSum{495} +% \CheckSum{541} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -161,6 +161,9 @@ % \changes{0.9.7}{2011/03/07}{Updated documentation.} % \changes{0.9.8}{2011/04/21}{Suppress warnings about underfull / overful boxes % generated by the inserted todonotes. Patch by Peter M Schuler.} +% \changes{0.9.9}{2011/10/22}{Added author option, implementation provided by +% Xavier Alameda-Pineda. Example of modifying the +% listoftodos removing some protect commands with no effect.} % \GetFileInfo{todonotes.dtx} % % \DoNotIndex{\newcommand,\newenvironment} @@ -361,7 +364,7 @@ % options, see section \ref{subsecPackageOptions}. % Default values can be set by the color % options when the todonotes package is loaded. -% \todo[color=green!40]{And a green note withaverylongwordthathastocausesometrouble} +% \todo[color=green!40]{And a green note} % The todo notes inserted in this paragraph is created with the % command % |\todo[color=green!40]{And a green note}|. @@ -477,6 +480,17 @@ % \todo[fancyline]{Testing.} % \end{verbatim} % +% +% \DescribeMacro{author} +% The |author| option takes a parameter, the name of the author. +% The given name is inserted in the todonote. +% \todo[author=Xavier]{Testing author option.} +% \todo[author=Xavier, inline]{Testing author option.} +% \begin{verbatim} +% \todo[author=Xavier]{Testing author option.} +% \todo[author=Xavier, inline]{Testing author option.} +% \end{verbatim} +% % \subsection{Options for the missingfigure command} % % \DescribeMacro{figwidth} @@ -587,6 +601,23 @@ % relies on) is inserted in the other margin. % % +% \subsubsection{Todonotes in footnotes} +% Placing todonotes in footnotes throws a lot of errors. +% Richard Stanton comes with the following work around. +% \begin{verbatim} +% \renewcommand{\marginpar}{\marginnote} +% \end{verbatim} +% +% +% \subsubsection{List of todo heading is not correctly formatted} +% If using natbib, the todonotes list title gets screwed up unless +% you do something like this: +% \begin{verbatim} +% \makeatletter\let\chapter\@undefined\makeatother +% \end{verbatim} +% Suggestion by Richard Stanton. +% +% % \subsection{Things to improve} % This is a list of things I consider to improve sometime in the % future. It have not been done yet as I lack the time or skills to @@ -938,6 +969,18 @@ % Using this approach it is possible to customize the behavior of the inserted notes % to a very high degree. % +% +% \subsubsection{Alter the appearance of the list of todos} +% Marco Daniel gives the following example of how to add section +% numbers to the elements in the list of todos. +% The code is slightly modified from +% \url{http://tex.stackexchange.com/questions/18838/replacing-page-number-with-other-counter-in-listoftodos}. +% An example of the modified list of todos is shown below, the complete +% code example is given in appendix \ref{appssecAlterAppearenceOfListoftodos}.\\ +% \noindent +% \begin{tikzpicture} +% \draw node[shape=rectangle, fill=black!30, inner sep=1mm]{\includegraphics[width=\linewidth-2mm]{img/AlteredAppearenceOfListOfTodos.png}}; +% \end{tikzpicture} % % \iffalse % \StopEventually{\PrintChanges\PrintIndex} @@ -949,11 +992,12 @@ % % Identifies the package and loads the packages dependences. % \begin{macrocode} -\ProvidesPackage{todonotes}[2011/04/21] +\ProvidesPackage{todonotes}[2011/10/22] \RequirePackage{ifthen} \RequirePackage{xkeyval} \RequirePackage{xcolor} \RequirePackage{tikz} +\usetikzlibrary{positioning} \RequirePackage{calc} % \end{macrocode} % Some default values are set @@ -1053,7 +1097,7 @@ \@todonotes@SetTodoListName{Lista de tareas pendientes}% \@todonotes@SetMissingFigureText{Figura}% \@todonotes@SetMissingFigureUp{Figura}% - \@todonotes@SetMissingFigureDown{pendient}% + \@todonotes@SetMissingFigureDown{pendiente}% } % \end{macrocode} % Create a counter, for storing the number of inserted todos. @@ -1231,6 +1275,15 @@ \define@key{todonotes}{fancyline}[]{\@todonotes@fancylinetrue}% \define@key{todonotes}{nofancyline}[]{\@todonotes@fancylinefalse}% % \end{macrocode} +% Author option. +% \begin{macrocode} +\newcommand{\@todonotes@author}{}% +\newif\if@todonotes@authorgiven% +\define@key{todonotes}{author}{% + \renewcommand{\@todonotes@author}{#1}% + \@todonotes@authorgiventrue}% +\define@key{todonotes}{noauthor}[]{\@todonotes@authorgivenfalse}% +% \end{macrocode} % Should the text in the list of todos be different from the text % in the todonote? % \begin{macrocode} @@ -1258,6 +1311,7 @@ nodisable,% noinline,% nocaption,% + noauthor,% figwidth=\@todonotes@figwidth,% line, list, size=\@todonotes@textsize}{}% % \end{macrocode} @@ -1405,12 +1459,12 @@ % \begin{macrocode} \newcommand{\@todonotes@addElementToListOfTodos}{% \if@todonotes@colorinlistoftodos% - \addcontentsline{tdo}{todo}{\protect{% + \addcontentsline{tdo}{todo}{% \colorbox{\@todonotes@currentbackgroundcolor}% {\textcolor{\@todonotes@currentbackgroundcolor}{o}}% - \ \@todonotes@caption}}% + \ \@todonotes@caption}% \else% - \addcontentsline{tdo}{todo}{\protect{\@todonotes@caption}}% + \addcontentsline{tdo}{todo}{\@todonotes@caption}% \fi}% % \end{macrocode} % \end{macro} @@ -1421,12 +1475,21 @@ \if@todonotes@dviStyle% {\par\noindent\begin{tikzpicture}[remember picture]% \draw node[inlinenotestyle] {};\end{tikzpicture}\par}% - {\noindent \@todonotes@sizecommand \@todonotes@text}% + \if@todonotes@authorgiven% + {\noindent \@todonotes@sizecommand \@todonotes@author:\,\@todonotes@text}% + \else% + {\noindent \@todonotes@sizecommand \@todonotes@text}% + \fi {\par\noindent\begin{tikzpicture}[remember picture]% \draw node[inlinenotestyle] {};\end{tikzpicture}\par}% \else% {\par\noindent\begin{tikzpicture}[remember picture]% - \draw node[inlinenotestyle,font=\@todonotes@sizecommand] {\@todonotes@text};% + \draw node[inlinenotestyle,font=\@todonotes@sizecommand] {% + \if@todonotes@authorgiven% + {\noindent \@todonotes@sizecommand \@todonotes@author:\,\@todonotes@text}% + \else% + {\noindent \@todonotes@sizecommand \@todonotes@text}% + \fi};% \end{tikzpicture}\par}% \fi}% % \end{macrocode} @@ -1440,20 +1503,34 @@ \draw node[notestyle] {};% \end{tikzpicture}\\ % \begin{minipage}{\@todonotes@textwidth}% - \@todonotes@sizecommand \@todonotes@text% + \if@todonotes@authorgiven% + \@todonotes@sizecommand \@todonotes@author \@todonotes@text% + \else% + \@todonotes@sizecommand \@todonotes@text% + \fi% \end{minipage}\\% \begin{tikzpicture}[remember picture]% \draw node[notestyle] (inNote) {};% \end{tikzpicture}% \else% - \let\originalHbadness\hbadness - \hbadness 100000 + \let\originalHbadness\hbadness + \hbadness 100000 \begin{tikzpicture}[remember picture,baseline=(X.base)]% - \node(X){\vphantom{X}};% + \node(X){\vphantom{X}};% \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% {\@todonotes@text};% + \if@todonotes@authorgiven% + \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% + {\@todonotes@sizecommand\@todonotes@author};% + \node(Y)[below=of X]{};% + \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.south)% + {\@todonotes@text};% + \else% + \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% + {\@todonotes@text};% + \fi% \end{tikzpicture}% - \hbadness \originalHbadness + \hbadness \originalHbadness \fi}% % \end{macrocode} % \end{macro} @@ -1512,9 +1589,9 @@ % \begin{macro}{\missingfigure} % Defines the |\missingfigure| macro. % \begin{macrocode} -\newcommand{\missingfigure}[2][]{ +\newcommand{\missingfigure}[2][]{% \setkeys{todonotes}{#1}% -\addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: \protect{#2}}% +\addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: #2}% \par \noindent \begin{tikzpicture} @@ -1549,10 +1626,55 @@ % \begin{macro}{\todo} % Define the |\todo| command as a redirection to |\@todo|. % \begin{macrocode} -\newcommand{\todo}[2][]{\@todo[#1]{#2}} +\newcommand{\todo}[2][]{\@todo[#1]{#2}}% % \end{macrocode} % \end{macro} +% \appendix +% \section{Longer code examples} +% \subsection{Alter appearence of the list of todos} +% \label{appssecAlterAppearenceOfListoftodos} +% \begin{verbatim} +% \documentclass{book} +% +% \usepackage{todonotes} +% \usepackage{lipsum} +% \makeatletter +% \def\myaddcontentsline#1#2#3{% +% \addtocontents{#1}{\protect\contentsline{#2}{#3}{see \thesection\ at p. \thepage}}} +% \renewcommand{\@todonotes@addElementToListOfTodos}{% +% \if@todonotes@colorinlistoftodos% +% \myaddcontentsline{tdo}{todo}{{% +% \colorbox{\@todonotes@currentbackgroundcolor}% +% {\textcolor{\@todonotes@currentbackgroundcolor}{o}}% +% \ \@todonotes@caption}}% +% \else% +% \myaddcontentsline{tdo}{todo}{{\@todonotes@caption}}% +% \fi}% +% \newcommand*\mylistoftodos{% +% \begingroup +% \setbox\@tempboxa\hbox{see 9.9 at p. 99}% +% \renewcommand*\@tocrmarg{\the\wd\@tempboxa}% +% \renewcommand*\@pnumwidth{\the\wd\@tempboxa}% +% \listoftodos% +% \endgroup +% } +% \makeatother +% +% \begin{document} +% \chapter{My first chapter} +% \section{A first section} +% \lipsum +% \todo{This is a note} +% \section{Another section} +% \lipsum +% \todo{This is another note} +% +% \tableofcontents +% \mylistoftodos +% \end{document} +% \end{verbatim} % +% \newpage % \Finale \endinput diff --git a/Master/texmf-dist/tex/latex/todonotes/todonotes.sty b/Master/texmf-dist/tex/latex/todonotes/todonotes.sty index 6e6e391ec02..cd2ea8935d1 100644 --- a/Master/texmf-dist/tex/latex/todonotes/todonotes.sty +++ b/Master/texmf-dist/tex/latex/todonotes/todonotes.sty @@ -22,13 +22,14 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{todonotes} - [2011/04/21 .dtx Todonotes source and documentation.] + [2011/10/22 .dtx Todonotes source and documentation.] -\ProvidesPackage{todonotes}[2011/04/21] +\ProvidesPackage{todonotes}[2011/10/22] \RequirePackage{ifthen} \RequirePackage{xkeyval} \RequirePackage{xcolor} \RequirePackage{tikz} +\usetikzlibrary{positioning} \RequirePackage{calc} \newcommand{\@todonotes@text}{}% \newcommand{\@todonotes@backgroundcolor}{orange} @@ -115,7 +116,7 @@ \@todonotes@SetTodoListName{Lista de tareas pendientes}% \@todonotes@SetMissingFigureText{Figura}% \@todonotes@SetMissingFigureUp{Figura}% - \@todonotes@SetMissingFigureDown{pendient}% + \@todonotes@SetMissingFigureDown{pendiente}% } \newcounter{@todonotes@numberoftodonotes} \newif{\if@todonotes@obeyDraft} @@ -194,6 +195,12 @@ \newif\if@todonotes@fancyline\@todonotes@fancylinefalse% \define@key{todonotes}{fancyline}[]{\@todonotes@fancylinetrue}% \define@key{todonotes}{nofancyline}[]{\@todonotes@fancylinefalse}% +\newcommand{\@todonotes@author}{}% +\newif\if@todonotes@authorgiven% +\define@key{todonotes}{author}{% + \renewcommand{\@todonotes@author}{#1}% + \@todonotes@authorgiventrue}% +\define@key{todonotes}{noauthor}[]{\@todonotes@authorgivenfalse}% \newcommand{\@todonotes@caption}{}% \newif\if@todonotes@captiongiven% \define@key{todonotes}{caption}% @@ -212,6 +219,7 @@ nodisable,% noinline,% nocaption,% + noauthor,% figwidth=\@todonotes@figwidth,% line, list, size=\@todonotes@textsize}{}% \if@todonotes@disabled% @@ -293,23 +301,32 @@ }% \newcommand{\@todonotes@addElementToListOfTodos}{% \if@todonotes@colorinlistoftodos% - \addcontentsline{tdo}{todo}{\protect{% + \addcontentsline{tdo}{todo}{% \colorbox{\@todonotes@currentbackgroundcolor}% {\textcolor{\@todonotes@currentbackgroundcolor}{o}}% - \ \@todonotes@caption}}% + \ \@todonotes@caption}% \else% - \addcontentsline{tdo}{todo}{\protect{\@todonotes@caption}}% + \addcontentsline{tdo}{todo}{\@todonotes@caption}% \fi}% \newcommand{\@todonotes@drawInlineNote}{% \if@todonotes@dviStyle% {\par\noindent\begin{tikzpicture}[remember picture]% \draw node[inlinenotestyle] {};\end{tikzpicture}\par}% - {\noindent \@todonotes@sizecommand \@todonotes@text}% + \if@todonotes@authorgiven% + {\noindent \@todonotes@sizecommand \@todonotes@author:\,\@todonotes@text}% + \else% + {\noindent \@todonotes@sizecommand \@todonotes@text}% + \fi {\par\noindent\begin{tikzpicture}[remember picture]% \draw node[inlinenotestyle] {};\end{tikzpicture}\par}% \else% {\par\noindent\begin{tikzpicture}[remember picture]% - \draw node[inlinenotestyle,font=\@todonotes@sizecommand] {\@todonotes@text};% + \draw node[inlinenotestyle,font=\@todonotes@sizecommand] {% + \if@todonotes@authorgiven% + {\noindent \@todonotes@sizecommand \@todonotes@author:\,\@todonotes@text}% + \else% + {\noindent \@todonotes@sizecommand \@todonotes@text}% + \fi};% \end{tikzpicture}\par}% \fi}% \newcommand{\@todonotes@drawMarginNote}{% @@ -318,20 +335,34 @@ \draw node[notestyle] {};% \end{tikzpicture}\\ % \begin{minipage}{\@todonotes@textwidth}% - \@todonotes@sizecommand \@todonotes@text% + \if@todonotes@authorgiven% + \@todonotes@sizecommand \@todonotes@author \@todonotes@text% + \else% + \@todonotes@sizecommand \@todonotes@text% + \fi% \end{minipage}\\% \begin{tikzpicture}[remember picture]% \draw node[notestyle] (inNote) {};% \end{tikzpicture}% \else% -\let\originalHbadness\hbadness -\hbadness 100000 + \let\originalHbadness\hbadness + \hbadness 100000 \begin{tikzpicture}[remember picture,baseline=(X.base)]% - \node(X){\vphantom{X}};% + \node(X){\vphantom{X}};% \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% {\@todonotes@text};% + \if@todonotes@authorgiven% + \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% + {\@todonotes@sizecommand\@todonotes@author};% + \node(Y)[below=of X]{};% + \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.south)% + {\@todonotes@text};% + \else% + \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% + {\@todonotes@text};% + \fi% \end{tikzpicture}% -\hbadness \originalHbadness + \hbadness \originalHbadness \fi}% \newcommand{\@todonotes@drawLineToRightMargin}{% \if@todonotes@line% @@ -375,9 +406,9 @@ \end{tikzpicture}% \fi% \fi} -\newcommand{\missingfigure}[2][]{ +\newcommand{\missingfigure}[2][]{% \setkeys{todonotes}{#1}% -\addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: \protect{#2}}% +\addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: #2}% \par \noindent \begin{tikzpicture} @@ -399,7 +430,7 @@ \addcontentsline{toc}{\@ifundefined{chapter}{section}{chapter}}{\@todonotes@todolistname} \fi } -\newcommand{\todo}[2][]{\@todo[#1]{#2}} +\newcommand{\todo}[2][]{\@todo[#1]{#2}}% \endinput %% %% End of file `todonotes.sty'. -- cgit v1.2.3