diff options
author | Karl Berry <karl@freefriends.org> | 2008-10-26 15:40:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-10-26 15:40:26 +0000 |
commit | d8e34c095c3416f709b61aeec497806cf99813e6 (patch) | |
tree | 79ac082e69bd1ffe36aa4ca7b9a3518ef7b00971 /Master/texmf-dist/source | |
parent | 244133e201557e3a62cb74c3b87db589300c124f (diff) |
todonotes update (23oct08)
git-svn-id: svn://tug.org/texlive/trunk@11060 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/todonotes/todonotes.dtx | 156 |
1 files changed, 133 insertions, 23 deletions
diff --git a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx index ff88f086ef7..91ef64b5513 100644 --- a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx +++ b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx @@ -22,13 +22,14 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{todonotes} %<*package> - [2008/09/15 .dtx Todonotes source and documentation.] + [2008/10/24 .dtx Todonotes source and documentation.] %</package> % %<*driver> \documentclass{ltxdoc} +\usepackage{wrapfig} \usepackage[colorlinks, linkcolor=black]{hyperref} -\usepackage[colorinlistoftodos]{todonotes}[2008/09/15] +\usepackage[colorinlistoftodos]{todonotes}[2008/10/24] \EnableCrossrefs \CodelineIndex \RecordChanges @@ -42,7 +43,7 @@ %</driver> % \fi % -% \CheckSum{222} +% \CheckSum{0} % % \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 @@ -86,6 +87,11 @@ % \changes{0.5}{2008/08/05}{Created a dtx file containing both source % code and documentation of the package} % \changes{0.5.1}{2008/09/15}{Updated the documentation} +% \changes{0.5.2}{2008/10/20}{Fixed a bug that prevented the usage +% of the option french for babel. Bug report by Thomas +% Braun.} +% \changes{0.6}{2008/10/24}{Added the caption option to the todo +% command.} % % \GetFileInfo{todonotes.dtx} % @@ -106,6 +112,7 @@ % % \tableofcontents % +% \newpage % \section{Introduction} % % The |todonotes| package makes three commands available to the @@ -235,17 +242,43 @@ % |\todo[noline]{A note with no line ...}| % \vspace{1.0cm} % +% % \DescribeMacro{inline / noinline} % It is possible to place a todonote inside the text instead of % placing it in the margin, this could be desireable if the text in % the note has a considerable length. % |\todo[inline]{A todonote placed in the text}| % \todo[inline]{A todonote placed in the text} + +% \begin{wrapfigure}[1]{r}[20mm]{40mm} +% \begin{tikzpicture} +% \draw[red] (0, 0) circle(0.45); +% \draw[green] (1, 0) circle(0.45); +% \draw[blue] (2, 0) circle(0.45); +% \end{tikzpicture} +% \caption{A text explaining the image. +% \todo[inline]{Fill those circles \ldots}} +% \end{wrapfigure} +% Another usage for the inline option is when you want to add a +% todonote to a figure caption. +% +% \begin{verbatim} +% \begin{wrapfigure}{r}[20mm]{40mm} +% \begin{tikzpicture} +% \draw[red] (0, 0) circle(0.45); +% \draw[green] (1, 0) circle(0.45); +% \draw[blue] (2, 0) circle(0.45); +% \end{tikzpicture} +% \caption{A text explaining the image. +% \todo[inline]{Fill those circles \ldots}} +% \end{wrapfigure} +% \end{verbatim} % % \DescribeMacro{size} % |size=val| changes the size of the text inside the todonote. -% The commands used to create the notes below are -% |\todo[size=\Large]{A note with a large fontsize.}| and +% The commands used to create the notes below are \\ \noindent +% |\todo[size=\Large]{A note with a large fontsize.}| +% and \\ \noindent % |\todo[inline, size=\tiny]{Note with very small fontsize.}|. % \todo[size=\Large]{A note with a large fontsize.} % \todo[inline, size=\footnotesize]{Note with very small fontsize.} @@ -254,6 +287,18 @@ % When the option |nolist| is given, the todo item will not appear in % the list of todos. % +% \DescribeMacro{caption} +% The |caption| option enables the user to specify a short +% description of the todonote that are inserted in the list of +% todos instead of the full todonote text. +% \todo[caption={Short note}]{A very long and tedious note that +% cannot be on one line in the list of todos.}. +% \begin{verbatim} +% \todo[caption={Short note}]{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. % @@ -283,7 +328,48 @@ % package, otherwise you will get an ''Option clash'' error when % latex works on the document. % +% \subsubsection{Wrapping of long lines in list of todos} +% When a document is compiled with latex (and not pdflatex) long +% items in the list of todos are not wrapped into several lines, and +% do instead continue to the right out of the page. +% +% \subsection{Usage methods} +% +% In this section I have collected some different methods to use the +% |todonotes| package. +% +% +% \subsubsection{Define new commands with fixed options} +% +% Often there is a need for marking different classes of things to +% do (add reference, rewrite, \ldots). +% One way to do this, is to define some new commands as shown below +% (idea from Florent B.). +% \begin{verbatim} +% \newcommand{\addref}{\todo[color=red!40]{Add reference.}} +% \newcommand{\rewrite}[1]{\todo[color=green!40]{#1}} +% \end{verbatim} +% To distinguish between the different types of todos, the +% |todonotes| package can be loaded with the |colorinlistoftodos| +% option, which adds small colored squares to the list of todos. +% \begin{verbatim} +% \usepackage[colorinlistoftodos]{todonotes} +% \end{verbatim} +% % +% +% \subsubsection{Combination with the fixme package} +% +% Thomas Arildsen has mailed me this use case. Check the +% documentation for the |fixme| package, as the code below relies +% directly on it (the |\FDUser| command is augumented when +% |\begin{document}| is reached). +% \begin{verbatim} +% \usepackage[user,nomargin]{fixme} +% \usepackage{todonotes} +% \newcommand{\FXUser}[2]{\todo[inline,size=\small]{{\bfseries #1:} #2}} +% \end{verbatim} +% % \iffalse % \StopEventually{\PrintChanges\PrintIndex} % \fi @@ -293,7 +379,7 @@ % % Identifies the package and loads the packages dependences. % \begin{macrocode} -\ProvidesPackage{todonotes}[2008/09/15] +\ProvidesPackage{todonotes}[2008/10/24] \RequirePackage{ifthen} \RequirePackage{xkeyval} \RequirePackage{hyperref} @@ -391,6 +477,15 @@ \define@key{todonotes}{line}[]{\@todonotes@linetrue}% \define@key{todonotes}{noline}[]{\@todonotes@linefalse}% % \end{macrocode} +% Should the text in the list of todos be different from the text +% in the todonote? +% \begin{macrocode} +\newcommand{\@todonotes@caption}{}% +\newif\if@todonotes@captiongiven% +\define@key{todonotes}{caption}% + {\renewcommand{\@todonotes@caption}{#1}% + \@todonotes@captiongiventrue}% +% \end{macrocode} % Preset values of the options % \begin{macrocode} \presetkeys @@ -425,13 +520,14 @@ text width = \@todonotes@textwidth - 1.6 ex - 1pt, inner sep = 0.8 ex] \tikzstyle{notestyleleft} = [notestyle, left] \tikzstyle{connectstyle} = [thick] -\tikzstyle{inlinenotestyle} = [notestyle, text width=\textwidth - 1.6 ex - 1 pt] +\tikzstyle{inlinenotestyle} = [notestyle, text width=\linewidth - 1.6 ex - 1 pt] % \end{macrocode} % % \begin{macro}{\todo} % Define the todo command % \begin{macrocode} \newcommand{\todo}[2][]{% +\renewcommand{\@todonotes@caption}{#2}% \setkeys{todonotes}{#1}% % \end{macrocode} % Add the item to the list of todos. When the option @@ -440,12 +536,16 @@ % \begin{macrocode} \if@todonotes@appendtolistoftodos% \phantomsection% + \if@todonotes@captiongiven% + \else% + \renewcommand{\@todonotes@caption}{#2} + \fi% \if@todonotes@colorinlistoftodos% \addcontentsline{tdo}{todo}{\protect{% \colorbox{\@todonotes@fillcolor}{\textcolor{\@todonotes@fillcolor}{\tiny i}} % - #2}}% + \@todonotes@caption}}% \else% - \addcontentsline{tdo}{todo}{\protect{#2}}% + \addcontentsline{tdo}{todo}{\protect{\@todonotes@caption}}% \fi% \fi% % \end{macrocode} @@ -454,14 +554,14 @@ % \begin{macrocode} \if@todonotes@inlinenote% \if@todonotes@dviStyle% - {\par\noindent\tikz[remember picture] \draw node[inlinenotestyle, % - fill=\@todonotes@fillcolor] {};\par}% + {\par\noindent\begin{tikzpicture}[remember picture] \draw node[inlinenotestyle, % + fill=\@todonotes@fillcolor] {};\end{tikzpicture}\par}% {\noindent \@todonotes@sizecommand #2}% - {\par\noindent\tikz[remember picture] \draw node[inlinenotestyle, % - fill=\@todonotes@fillcolor] {};\par}% + {\par\noindent\begin{tikzpicture}[remember picture] \draw node[inlinenotestyle, % + fill=\@todonotes@fillcolor] {};\end{tikzpicture}\par}% \else% - {\par\noindent\tikz[remember picture] \draw node[inlinenotestyle, % - fill=\@todonotes@fillcolor] {\@todonotes@sizecommand #2};\par}% + {\par\noindent\begin{tikzpicture}[remember picture] \draw node[inlinenotestyle, % + fill=\@todonotes@fillcolor] {\@todonotes@sizecommand #2};\end{tikzpicture}\par}% \fi% \else% % \end{macrocode} @@ -475,11 +575,15 @@ \end{tikzpicture}% \marginpar[{% Draw note in left margin \if@todonotes@dviStyle% - \tikz[remember picture] \draw node[notestyle, fill=\@todonotes@fillcolor] {}; \\ % + \begin{tikzpicture}[remember picture] % + \draw node[notestyle, fill=\@todonotes@fillcolor] {}; % + \end{tikzpicture}\\ % \begin{minipage}{\@todonotes@textwidth}% \@todonotes@sizecommand #2% \end{minipage} \\% - \tikz[remember picture] \draw node[notestyle, fill=\@todonotes@fillcolor] (inNote) {};% + \begin{tikzpicture}[remember picture] % + \draw node[notestyle, fill=\@todonotes@fillcolor] (inNote) {};% + \end{tikzpicture}% \if@todonotes@line% \begin{tikzpicture}[remember picture, overlay]% \draw[connectstyle, draw=\@todonotes@fillcolor]% @@ -489,8 +593,10 @@ \end{tikzpicture}% \fi% \else% - \tikz[remember picture] \draw node[notestyle, fill=\@todonotes@fillcolor] -(inNote) {\@todonotes@sizecommand #2};% + \begin{tikzpicture}[remember picture] % + \draw node[notestyle, fill=\@todonotes@fillcolor] (inNote) % + {\@todonotes@sizecommand #2}; % + \end{tikzpicture}% \if@todonotes@line% \begin{tikzpicture}[remember picture, overlay]% \draw[connectstyle, draw=\@todonotes@fillcolor]% @@ -508,11 +614,15 @@ % \begin{macrocode} }]{% Draw note in right margin \if@todonotes@dviStyle% - \tikz[remember picture] \draw node[notestyle, fill=\@todonotes@fillcolor] {}; \\ % + \begin{tikzpicture}[remember picture] % + \draw node[notestyle, fill=\@todonotes@fillcolor] {}; % + \end{tikzpicture} \\ % \begin{minipage}{\@todonotes@textwidth}% \@todonotes@sizecommand #2% \end{minipage} \\% - \tikz[remember picture] \draw node[notestyle, fill=\@todonotes@fillcolor] (inNote) {};% + \begin{tikzpicture}[remember picture] % + \draw node[notestyle, fill=\@todonotes@fillcolor] (inNote) {};% + \end{tikzpicture} % \if@todonotes@line% \begin{tikzpicture}[remember picture, overlay]% \draw[connectstyle, draw=\@todonotes@fillcolor]% @@ -522,8 +632,8 @@ \end{tikzpicture}% \fi% \else% - \tikz[remember picture] \draw node[notestyle, fill=\@todonotes@fillcolor] -(inNote) {\@todonotes@sizecommand #2};% + \begin{tikzpicture}[remember picture] \draw node[notestyle, fill=\@todonotes@fillcolor] +(inNote) {\@todonotes@sizecommand #2}; \end{tikzpicture}% \if@todonotes@line% \begin{tikzpicture}[remember picture, overlay]% \draw[connectstyle, draw=\@todonotes@fillcolor]% |