summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/todonotes
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-22 22:57:57 +0000
committerKarl Berry <karl@freefriends.org>2011-10-22 22:57:57 +0000
commitfee76acaf5371903e4593a8431d62a28be18ff27 (patch)
tree4b88c2c378f45107f0fd029de499a2ad76c712b1 /Master/texmf-dist/source/latex/todonotes
parenta2b557e7d2c3387ce36891f50c32974c80287978 (diff)
todonotes (22oct11)
git-svn-id: svn://tug.org/texlive/trunk@24362 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/todonotes')
-rw-r--r--Master/texmf-dist/source/latex/todonotes/todonotes.dtx160
1 files changed, 141 insertions, 19 deletions
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 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{todonotes}
%<*package>
- [2011/04/21 .dtx Todonotes source and documentation.]
+ [2011/10/22 .dtx Todonotes source and documentation.]
%</package>
%
%<*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 @@
%</driver>
% \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