summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/todonotes/todonotes.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-27 00:39:06 +0000
committerKarl Berry <karl@freefriends.org>2010-09-27 00:39:06 +0000
commit3a7ed51293855b6db86b4ce41e7f2403cc02c774 (patch)
treeae29ed561be3d582e3f4c3d06dca866816e9efc7 /Master/texmf-dist/source/latex/todonotes/todonotes.dtx
parent6f75f25fe8d374ef4209118bd8849d742410ccd1 (diff)
todonotes 0.9.5 (26sep10)
git-svn-id: svn://tug.org/texlive/trunk@19905 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/todonotes/todonotes.dtx')
-rw-r--r--Master/texmf-dist/source/latex/todonotes/todonotes.dtx165
1 files changed, 107 insertions, 58 deletions
diff --git a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx
index a90f2f5cca9..46991c905d6 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>
- [2010/09/13 .dtx Todonotes source and documentation.]
+ [2010/09/26 .dtx Todonotes source and documentation.]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{wrapfig}
\usepackage[colorlinks, linkcolor=black]{hyperref}
-\usepackage[colorinlistoftodos, shadow]{todonotes}[2010/09/13]
+\usepackage[colorinlistoftodos, shadow]{todonotes}[2010/09/26]
\usepackage{amsmath}
\usepackage{setspace}
\setcounter{tocdepth}{2}
@@ -46,7 +46,7 @@
%</driver>
% \fi
%
-% \CheckSum{451}
+% \CheckSum{458}
%
% \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
@@ -153,6 +153,10 @@
% \changes{0.9.2}{2010/09/13}{Use chapter (if available) for the list of todos heading.}
% \changes{0.9.3}{2010/09/13}{Make an internal definition of the todo command,
% for easing redefinition of the command behaviour.}
+% \changes{0.9.4}{2010/09/26}{Make the disable option work on a local scale as
+% suggested by Stefan Pinnow.}
+% \changes{0.9.5}{2010/09/26}{Code simplification by extracting functionality to
+% smaller macros.}
%
% \GetFileInfo{todonotes.dtx}
%
@@ -335,6 +339,10 @@
% command. All the options are described here and often I have
% included examples of the change in visual appearance.
%
+% \DescribeMacro{disable}
+% The |disable| option can be given directly to the todo command.
+% If given the command has no effect.
+%
% \DescribeMacro{color}
% \DescribeMacro{backgroundcolor}
% \DescribeMacro{linecolor}
@@ -925,7 +933,7 @@
%
% Identifies the package and loads the packages dependences.
% \begin{macrocode}
-\ProvidesPackage{todonotes}[2010/09/13]
+\ProvidesPackage{todonotes}[2010/09/26]
\RequirePackage{ifthen}
\RequirePackage{xkeyval}
\RequirePackage{xcolor}
@@ -1170,6 +1178,12 @@
\newcommand{\@todonotes@sizecommand}{}%
\define@key{todonotes}{size}{\renewcommand{\@todonotes@sizecommand}{#1}}%
% \end{macrocode}
+% Should the todo item be disabled?
+% \begin{macrocode}
+\newif\if@todonotes@localdisable%
+\define@key{todonotes}{disable}[]{\@todonotes@localdisabletrue}%
+\define@key{todonotes}{nodisable}[]{\@todonotes@localdisablefalse}%
+% \end{macrocode}
% Should the todo item be included in the list of todos?
% \begin{macrocode}
\newif\if@todonotes@appendtolistoftodos%
@@ -1217,6 +1231,7 @@
{linecolor=\@todonotes@linecolor,%
backgroundcolor=\@todonotes@backgroundcolor,%
bordercolor=\@todonotes@bordercolor,%
+ nodisable,%
noinline,%
nocaption,%
figwidth=\@todonotes@figwidth,%
@@ -1272,7 +1287,7 @@
% \end{macrocode}
%
% \begin{macro}{\@todo}
-% Define the |\@todo| command
+% Define the |\@todo| command.
% \begin{macrocode}
\newcommand{\@todo}[2][]{%
% \end{macrocode}
@@ -1284,12 +1299,17 @@
\@todonotes@prependcaptionfalse%
\fi%
% \end{macrocode}
-% Store the original text for later usage.
+% Store the original text for later usage and parse the given options.
% \begin{macrocode}
\renewcommand{\@todonotes@text}{#2}%
\renewcommand{\@todonotes@caption}{#2}%
\setkeys{todonotes}{#1}%
% \end{macrocode}
+% If the option |disable| is given to the command, no output is generated.
+% \begin{macrocode}
+\if@todonotes@localdisable%
+\else%
+% \end{macrocode}
% Add the item to the list of todos. When the option
% |colorinlistoftodos| is given to the package a small colored
% square is added in front of the text.
@@ -1301,14 +1321,7 @@
\else%
\renewcommand{\@todonotes@caption}{#2}%
\fi%
- \if@todonotes@colorinlistoftodos%
- \addcontentsline{tdo}{todo}{\protect{%
- \colorbox{\@todonotes@currentbackgroundcolor}%
- {\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
- \ \@todonotes@caption}}%
- \else%
- \addcontentsline{tdo}{todo}{\protect{\@todonotes@caption}}%
- \fi%
+ \@todonotes@addElementToListOfTodos
\fi%
% \end{macrocode}
% Prepend the short caption given if it is requested
@@ -1323,18 +1336,19 @@
% marginpar), below is the code for the inline placement.
% \begin{macrocode}
\if@todonotes@inlinenote%
- \if@todonotes@dviStyle%
- {\par\noindent\begin{tikzpicture}[remember picture]%
- \draw node[inlinenotestyle] {};\end{tikzpicture}\par}%
- {\noindent \@todonotes@sizecommand \@todonotes@text}%
- {\par\noindent\begin{tikzpicture}[remember picture]%
- \draw node[inlinenotestyle] {};\end{tikzpicture}\par}%
- \else%
- {\par\noindent\begin{tikzpicture}[remember picture]%
- \draw node[inlinenotestyle] {\@todonotes@sizecommand \@todonotes@text};%
- \end{tikzpicture}\par}%
- \fi%
+ \@todonotes@drawInlineNote
\else%
+ \@todonotes@drawMarginNoteWithLine
+\fi %\if@todonotes@inlinenote
+\fi %\if@todonotes@localdisable
+\ignorespaces%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{drawMarginNoteWithLine}
+% Define helper function |drawMarginNoteWithLine|.
+% \begin{macrocode}
+\newcommand{\@todonotes@drawMarginNoteWithLine}{%
% \end{macrocode}
% When the todonote should be placed inside a marginpar, the code
% below is applied.
@@ -1345,30 +1359,8 @@
\node [coordinate] (inText) {};%
\end{tikzpicture}%
\marginpar[{% Draw note in left margin
-\if@todonotes@dviStyle%
- \begin{tikzpicture}[remember picture]%
- \draw node[notestyle] {};%
- \end{tikzpicture}\\ %
- \begin{minipage}{\@todonotes@textwidth}%
- \@todonotes@sizecommand \@todonotes@text%
- \end{minipage}\\%
- \begin{tikzpicture}[remember picture]%
- \draw node[notestyle] (inNote) {};%
- \end{tikzpicture}%
-\else%
- \begin{tikzpicture}[remember picture]%
- \draw node[notestyle] (inNote)%
- {\@todonotes@sizecommand \@todonotes@text};%
- \end{tikzpicture}%
-\fi%
-\if@todonotes@line%
- \begin{tikzpicture}[remember picture, overlay]%
- \draw[connectstyle]%
- ([yshift=-0.2cm] inText)%
- -| ([xshift=0.2cm] inNote.east)%
- -| (inNote.east);%
- \end{tikzpicture}%
-\fi%
+ \@todonotes@drawMarginNote%
+ \@todonotes@drawLineToLeftMargin%
% \end{macrocode}
% In the book documentclass (which is a twoside layout), the
% |\marginpar| marginpar macro takes two arguments
@@ -1378,10 +1370,51 @@
% commands.
% \begin{macrocode}
}]{% Draw note in right margin
+ \@todonotes@drawMarginNote%
+ \@todonotes@drawLineToRightMargin%
+}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{addElementToListOfTodos}
+% Define helper function |addElementToListOfTodos|.
+% \begin{macrocode}
+\newcommand{\@todonotes@addElementToListOfTodos}{%
+ \if@todonotes@colorinlistoftodos%
+ \addcontentsline{tdo}{todo}{\protect{%
+ \colorbox{\@todonotes@currentbackgroundcolor}%
+ {\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
+ \ \@todonotes@caption}}%
+ \else%
+ \addcontentsline{tdo}{todo}{\protect{\@todonotes@caption}}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{drawInlineNote}
+% Define helper function |drawInlineNote|.
+% \begin{macrocode}
+\newcommand{\@todonotes@drawInlineNote}{%
+ \if@todonotes@dviStyle%
+ {\par\noindent\begin{tikzpicture}[remember picture]%
+ \draw node[inlinenotestyle] {};\end{tikzpicture}\par}%
+ {\noindent \@todonotes@sizecommand \@todonotes@text}%
+ {\par\noindent\begin{tikzpicture}[remember picture]%
+ \draw node[inlinenotestyle] {};\end{tikzpicture}\par}%
+ \else%
+ {\par\noindent\begin{tikzpicture}[remember picture]%
+ \draw node[inlinenotestyle] {\@todonotes@sizecommand \@todonotes@text};%
+ \end{tikzpicture}\par}%
+ \fi}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{drawMarginNote}
+% Define helper function |drawMarginNote|.
+% \begin{macrocode}
+\newcommand{\@todonotes@drawMarginNote}{%
\if@todonotes@dviStyle%
\begin{tikzpicture}[remember picture]%
\draw node[notestyle] {};%
- \end{tikzpicture}\\%
+ \end{tikzpicture}\\ %
\begin{minipage}{\@todonotes@textwidth}%
\@todonotes@sizecommand \@todonotes@text%
\end{minipage}\\%
@@ -1390,22 +1423,38 @@
\end{tikzpicture}%
\else%
\begin{tikzpicture}[remember picture]%
- \draw node[notestyle](inNote)%
+ \draw node[notestyle] (inNote)%
{\@todonotes@sizecommand \@todonotes@text};%
\end{tikzpicture}%
-\fi%
+\fi}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{drawLineToRightMargin}
+% Define helper function |drawLineToRightMargin|.
+% \begin{macrocode}
+\newcommand{\@todonotes@drawLineToRightMargin}{%
\if@todonotes@line%
- \begin{tikzpicture}[remember picture, overlay]%
+\begin{tikzpicture}[remember picture, overlay]%
\draw[connectstyle]%
([yshift=-0.2cm] inText)%
-| ([xshift=-0.2cm] inNote.west)%
-| (inNote.west);%
\end{tikzpicture}%
-\fi%
-}%
-\fi%
-\ignorespaces%
-}%
+\fi}%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{drawLineToLeftMargin}
+% Define helper function |drawLineToLeftMargin|.
+% \begin{macrocode}
+\newcommand{\@todonotes@drawLineToLeftMargin}{
+\if@todonotes@line%
+ \begin{tikzpicture}[remember picture, overlay]%
+ \draw[connectstyle]%
+ ([yshift=-0.2cm] inText)%
+ -| ([xshift=0.2cm] inNote.east)%
+ -| (inNote.east);%
+ \end{tikzpicture}%
+\fi}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\missingfigure}