summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/todonotes
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-01-09 02:57:08 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-01-09 02:57:08 +0000
commit37d81e458956611eb44687d8b29eb0e0deedffce (patch)
treeb7c4964de463ceccc2036607585324efbb24175e /Master/texmf-dist/source/latex/todonotes
parenteefaf7d9ab23eaa954a72a0bdd05edbec2bd0e53 (diff)
todonotes 2009/01/04
git-svn-id: svn://tug.org/texlive/trunk@11833 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/todonotes')
-rw-r--r--Master/texmf-dist/source/latex/todonotes/todonotes.dtx108
1 files changed, 87 insertions, 21 deletions
diff --git a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx
index 06887612247..204dcf04a7b 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>
- [2008/12/30 .dtx Todonotes source and documentation.]
+ [2009/01/04 .dtx Todonotes source and documentation.]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{wrapfig}
\usepackage[colorlinks, linkcolor=black]{hyperref}
-\usepackage[prependcaption, colorinlistoftodos]{todonotes}[2008/12/30]
+\usepackage[colorinlistoftodos]{todonotes}[2009/01/04]
\usepackage{setspace}
\EnableCrossrefs
\CodelineIndex
@@ -44,7 +44,7 @@
%</driver>
% \fi
%
-% \CheckSum{0}
+% \CheckSum{333}
%
% \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
@@ -108,10 +108,23 @@
% german) and the disable options, were all flawed by
% naming inconsistencies that made then break the
% package. This have been fixed.}
+% \changes{0.7.4}{2008/12/30}{Fixed a bug related to the caption
+% option for the todo command. Introduced a counter of
+% the number of inserted todos.}
+% \changes{0.7.5}{2009/01/02}{Fixed a typo in a macroname.}
+% \changes{0.7.6}{2009/01/04}{Added a textsize option for the
+% package and the prepend / noprepend option for the
+% todo command.}
%
% \GetFileInfo{todonotes.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
+%
+% \iffalse
+% A macro for marking things todo before the next relase
+% (typically update of documentation).
+% \fi
+% \newcommand{\donow}[1]{\todo[color=blue]{#1}}
%
%
% \title{The \textsf{todonotes} package\thanks{This document
@@ -227,6 +240,13 @@
% |length|. The width of inline todonotes will allways be the same
% as the current line width.
%
+% \DescribeMacro{textsize}
+% |textsize=value| sets the default text size of the inserted
+% todonotes to the given value.
+% Value is the ''name'' of the used fontsize, eg. if the desired
+% fontsize is |\tiny| use |textsize=tiny|. The default value is
+% |textsize=normalsize|.
+%
% \DescribeMacro{prependcaption}
% The |prependcaption| option triggers a special behaviour of the
% |caption=val| option for the todo command, where the given value
@@ -344,8 +364,26 @@
% cannot be on one line in the list of todos.}.
% \end{verbatim}
% The effect of this option is altered with the package option
-% |prependcaption|.
-%
+% |prependcaption| or the |prepend| / |noprepend| option for the
+% todo command.
+%
+% \DescribeMacro{prepend / noprepend}
+% The options |prepend| and |noprepend| can be used for setting
+% whether a given caption should be prepended to the todonote or
+% not.
+% Globally this can be set using the |prependcaption| option for the
+% package.~\todo[prepend, caption={Short note with prepend}]{A very
+% long and tedious note that cannot be on one line in the list of
+% todos.} Below is the effect of the option shown using the code:
+% \todo[noprepend, caption={Short note with noprepend}]{A very long
+% and tedious note that cannot be on one line in the list of
+% todos.}
+% \begin{verbatim}
+% \todo[prepend, caption={Short note with prepend}]{A very long and tedious note that
+% cannot be on one line in the list of todos.}.
+% \todo[noprepend, caption={Short note with noprepend}]{A very long and tedious note that
+% cannot be on one line in the list of todos.}.
+% \end{verbatim}
%
% \subsection{Options for the missingfigure command}
% Currently the missingfigure command takes no optional arguments.
@@ -551,7 +589,7 @@
%
% Identifies the package and loads the packages dependences.
% \begin{macrocode}
-\ProvidesPackage{todonotes}[2008/12/30]
+\ProvidesPackage{todonotes}[2009/01/04]
\RequirePackage{ifthen}
\RequirePackage{xkeyval}
\RequirePackage{hyperref}
@@ -566,6 +604,7 @@
\newcommand{\@todonotes@linecolor}{orange}
\newcommand{\@todonotes@bordercolor}{black}
\newcommand{\@todonotes@textwidth}{\marginparwidth}
+\newcommand{\@todonotes@textsize}{\normalsize}
% \end{macrocode}
%
% \subsection{Declaration of options for the package}
@@ -594,6 +633,10 @@
\@todonotes@SetMissingFigureDown{Abbildung}%
}
% \end{macrocode}
+% Create a counter, for storing the number of inserted todos.
+% \begin{macrocode}
+\newcounter{@todonotes@numberoftodonotes}
+% \end{macrocode}
%
% Make it possible to disable the functionality
% of the package. If this option is given, the
@@ -623,7 +666,7 @@
\define@key{todonotes.sty}%
{color}{
\renewcommand{\@todonotes@backgroundcolor}{#1}
- \renewcommand{\@todonotes@linegroundcolor}{#1}}
+ \renewcommand{\@todonotes@linecolor}{#1}}
% \end{macrocode}
% Make the background color of the notes as
% an option.
@@ -646,15 +689,22 @@
% Set whether short captions given as arguments to the todo command
% should be included in the inserted todonote.
% \begin{macrocode}
-\newif{\if@todonotes@prependcaption}
-\@todonotes@prependcaptionfalse
-\DeclareOptionX{prependcaption}{\@todonotes@prependcaptiontrue}
+\newif{\if@todonotes@prependcaptionglobal}
+\@todonotes@prependcaptionglobalfalse
+\DeclareOptionX{prependcaption}{\@todonotes@prependcaptionglobaltrue}
% \end{macrocode}
% Make the text width as an option.
% \begin{macrocode}
\define@key{todonotes.sty}%
{textwidth}{\renewcommand{\@todonotes@textwidth}{#1}}
% \end{macrocode}
+% Make the text size as an option. It requires some magic with the
+% |\csname| and |\endcsname| macros, as commands cannot be taken as
+% options for a package.
+% \begin{macrocode}
+\define@key{todonotes.sty}%
+ {textsize}{\renewcommand{\@todonotes@textsize}{\csname #1\endcsname}}
+% \end{macrocode}
% Finally process the given options.
% \begin{macrocode}
\ProcessOptionsX
@@ -697,6 +747,11 @@
\define@key{todonotes}{inline}[]{\@todonotes@inlinenotetrue}%
\define@key{todonotes}{noinline}[]{\@todonotes@inlinenotefalse}%
% \end{macrocode}
+% \begin{macrocode}
+\newif\if@todonotes@prependcaption%
+\define@key{todonotes}{prepend}[]{\@todonotes@prependcaptiontrue}%
+\define@key{todonotes}{noprepend}[]{\@todonotes@prependcaptionfalse}%
+% \end{macrocode}
% Should the note in the margin be connected to the insertion point
% in the text?
% \begin{macrocode}
@@ -712,6 +767,7 @@
\define@key{todonotes}{caption}%
{\renewcommand{\@todonotes@caption}{#1}%
\@todonotes@captiongiventrue}%
+\define@key{todonotes}{nocaption}[]{\@todonotes@captiongivenfalse}%
% \end{macrocode}
% Preset values of the options
% \begin{macrocode}
@@ -721,10 +777,9 @@
backgroundcolor=\@todonotes@backgroundcolor,%
bordercolor=\@todonotes@bordercolor,%
noinline,%
- line, list, size=\normalsize}{}%
+ nocaption,%
+ line, list, size=\@todonotes@textsize}{}%
% \end{macrocode}
-
-
% \subsection{The main code part}
% Here is the actual macros defined.
% If the option "disable" was passed to the package
@@ -767,6 +822,17 @@
% Define the todo command
% \begin{macrocode}
\newcommand{\todo}[2][]{%
+% \end{macrocode}
+% Use the global value for determining the default prepend behavior.
+% \begin{macrocode}
+\if@todonotes@prependcaptionglobal%
+ \@todonotes@prependcaptiontrue%
+\else%
+ \@todonotes@prependcaptionfalse%
+\fi%
+% \end{macrocode}
+% Store the original text for later usage.
+% \begin{macrocode}
\renewcommand{\@todonotes@text}{#2}%
\renewcommand{\@todonotes@caption}{#2}%
\setkeys{todonotes}{#1}%
@@ -775,6 +841,7 @@
% |colorinlistoftodos| is given to the package a small colored
% square is added in front of the text.
% \begin{macrocode}
+\addtocounter{@todonotes@numberoftodonotes}{1}%
\if@todonotes@appendtolistoftodos%
\phantomsection%
\if@todonotes@captiongiven%
@@ -784,7 +851,7 @@
\if@todonotes@colorinlistoftodos%
\addcontentsline{tdo}{todo}{\protect{%
\colorbox{\@todonotes@currentbackgroundcolor}%
- {\textcolor{\@todonotes@currentbackgroundcolor}{o}} %
+ {\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
\@todonotes@caption}}%
\else%
\addcontentsline{tdo}{todo}{\protect{\@todonotes@caption}}%
@@ -793,11 +860,11 @@
% \end{macrocode}
% Prepend the short caption given if it is requested
% \begin{macrocode}
-\if@todonotes@captiongiven
- \if@todonotes@prependcaption
- \renewcommand{\@todonotes@text}{\@todonotes@caption: #2}
- \fi
-\fi
+\if@todonotes@captiongiven%
+ \if@todonotes@prependcaption%
+ \renewcommand{\@todonotes@text}{\@todonotes@caption: #2}%
+ \fi%
+\fi%
% \end{macrocode}
% Place the todonote as indicated by the options (inline or in a
% marginpar), below is the code for the inline placement.
@@ -811,8 +878,7 @@
\draw node[inlinenotestyle] {};\end{tikzpicture}\par}%
\else%
{\par\noindent\begin{tikzpicture}[remember picture]%
- \draw node[inlinenotestyle] {\@todonotes@sizecommand
-\@todonotes@text};%
+ \draw node[inlinenotestyle] {\@todonotes@sizecommand \@todonotes@text};%
\end{tikzpicture}\par}%
\fi%
\else%