diff options
author | Karl Berry <karl@freefriends.org> | 2009-01-14 00:15:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-01-14 00:15:21 +0000 |
commit | 46e27c02c3e31502a5f55cf2cbe3c69edc033742 (patch) | |
tree | 40b878e1eb9db4328b3ab356c3b09aa54ba89afe /Master/texmf-dist/source/latex/todonotes | |
parent | 1cf000674b16b9f15f3c5112f70c07a08e8bb5de (diff) |
todonotes (10jan09)
git-svn-id: svn://tug.org/texlive/trunk@11861 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/todonotes')
-rw-r--r-- | Master/texmf-dist/source/latex/todonotes/todonotes.dtx | 141 |
1 files changed, 121 insertions, 20 deletions
diff --git a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx index 204dcf04a7b..c0137594767 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> - [2009/01/04 .dtx Todonotes source and documentation.] + [2009/01/09 .dtx Todonotes source and documentation.] %</package> % %<*driver> \documentclass{ltxdoc} \usepackage{wrapfig} \usepackage[colorlinks, linkcolor=black]{hyperref} -\usepackage[colorinlistoftodos]{todonotes}[2009/01/04] +\usepackage[colorinlistoftodos, shadow]{todonotes}[2009/01/09] \usepackage{setspace} \EnableCrossrefs \CodelineIndex @@ -44,7 +44,7 @@ %</driver> % \fi % -% \CheckSum{333} +% \CheckSum{386} % % \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 @@ -115,6 +115,14 @@ % \changes{0.7.6}{2009/01/04}{Added a textsize option for the % package and the prepend / noprepend option for the % todo command.} +% \changes{0.8}{2009/01/09}{Added three new translations french, +% spanish and catalan thanks to Richard Dominique and +% Joan Queralt. Improved the visual appearence of the +% inserted notes (rounded corners and optional shadows) +% with code from Joan Queralt. Found an untranslated +% textstring ''Figure'' in the source. Added a figwidth +% option to the missingfigure command, patch by Paul +% Ivanov.} % % \GetFileInfo{todonotes.dtx} % @@ -205,8 +213,8 @@ % |\missingfigure|) are defined as macros with no effect, and thus % all inserted notes are removed. % -% \DescribeMacro{danish} -% \DescribeMacro{german} +% \DescribeMacro{danish, german, french} +% \DescribeMacro{spanish, catalan} % Use the danish or german translations of the text strings % ''List of todos'' and ''Missing figure''. % The default is to use none of these options, which results in @@ -252,6 +260,12 @@ % |caption=val| option for the todo command, where the given value % |val| is inserted in the inserted todonote. % +% \DescribeMacro{shadow} +% If the |shadow| option is given, the inserted todonotes will be +% displayed with a gray shadow. +% I expect that the option will trigger problems with tikz versions +% prior to 2.0. +% % \DescribeMacro{dvistyle} % When a document with todonotes is compiled with plain latex (to a % dvi-file), there is an issue with the visual @@ -379,14 +393,43 @@ % 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.}. +% \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} +% \DescribeMacro{figwidth} +% The |figwidth=length| option sets the default width of the figure +% inserted by the |\missingfigure| command. +% The default value is |\textwidth|. % % \subsection{Options for the missingfigure command} -% Currently the missingfigure command takes no optional arguments. +% +% \DescribeMacro{figwidth} +% The |figwidth=length| option sets the width of the figure inserted by the +% |\missingfigure| command. +% Length values below $6cm$ might trigger some problems with the +% visual appearance. +% Try to compare the default of the missing figure command, when the +% option is given or not. +% \begin{verbatim} +% \missingfigure[figwidth=6cm]{Testing a long text string} +% \end{verbatim} +% \missingfigure[figwidth=6cm]{Testing a long text string} +% \begin{verbatim} +% \missingfigure{Testing a long text string} +% \end{verbatim} +% \missingfigure{Testing a long text string} +% \begin{wrapfigure}{r}[2cm]{6cm} +% \missingfigure[figwidth=6cm]{Add a test image \ldots} +% \end{wrapfigure} +% Another usage of the option is when |\missingfigure| is used in +% the wrapfigure environment. +% \begin{verbatim} +% \begin{wrapfigure}{r}[2cm]{6cm} +% \missingfigure[figwidth=6cm]{Add a test image \ldots} +% \end{wrapfigure} +% \end{verbatim} % % \subsection{Options for the listoftodos command} % Currently the listoftodos command takes no optional arguments. @@ -589,7 +632,7 @@ % % Identifies the package and loads the packages dependences. % \begin{macrocode} -\ProvidesPackage{todonotes}[2009/01/04] +\ProvidesPackage{todonotes}[2009/01/09] \RequirePackage{ifthen} \RequirePackage{xkeyval} \RequirePackage{hyperref} @@ -605,6 +648,7 @@ \newcommand{\@todonotes@bordercolor}{black} \newcommand{\@todonotes@textwidth}{\marginparwidth} \newcommand{\@todonotes@textsize}{\normalsize} +\newcommand{\@todonotes@figwidth}{\textwidth} % \end{macrocode} % % \subsection{Declaration of options for the package} @@ -615,23 +659,45 @@ % the danish and german languages. % \begin{macrocode} \newcommand{\@todonotes@todolistname}{Todo list} +\newcommand{\@todonotes@MissingFigureText}{Figure} \newcommand{\@todonotes@MissingFigureUp}{Missing} \newcommand{\@todonotes@MissingFigureDown}{figure} \newcommand{\@todonotes@SetTodoListName}[1]{\renewcommand{\@todonotes@todolistname}{#1}} +\newcommand{\@todonotes@SetMissingFigureText}[1]{\renewcommand{\@todonotes@MissingFigureText}{#1}} \newcommand{\@todonotes@SetMissingFigureUp}[1]{\renewcommand{\@todonotes@MissingFigureUp}{#1}} \newcommand{\@todonotes@SetMissingFigureDown}[1]{\renewcommand{\@todonotes@MissingFigureDown}{#1}} +\newif{\if@todonotes@reverseMissingFigureTriangle} \DeclareOptionX{danish}{% - \typeout{Danish} \@todonotes@SetTodoListName{G\o{}rem\aa{}lsliste}% + \@todonotes@SetMissingFigureText{Figur}% \@todonotes@SetMissingFigureUp{Manglende}% \@todonotes@SetMissingFigureDown{figur}% } \DeclareOptionX{german}{% - \typeout{German} \@todonotes@SetTodoListName{Liste der noch zu erledigenden Punkte}% + \@todonotes@SetMissingFigureText{Abbildung}% \@todonotes@SetMissingFigureUp{Fehlende}% \@todonotes@SetMissingFigureDown{Abbildung}% } +\DeclareOptionX{french}{% + \@todonotes@SetTodoListName{Liste des points \`a traiter}% + \@todonotes@SetMissingFigureText{Figure}% + \@todonotes@SetMissingFigureUp{Figure}% + \@todonotes@SetMissingFigureDown{manquante}% + \@todonotes@reverseMissingFigureTrianglefalse +} +\DeclareOptionX{catalan}{ + \@todonotes@SetTodoListName{Llista de feines pendents}% + \@todonotes@SetMissingFigureText{Figura}% + \@todonotes@SetMissingFigureUp{Figura}% + \@todonotes@SetMissingFigureDown{pendent}% +} +\DeclareOptionX{spanish}{ + \@todonotes@SetTodoListName{Lista de tareas pendientes}% + \@todonotes@SetMissingFigureText{Figura}% + \@todonotes@SetMissingFigureUp{Figura}% + \@todonotes@SetMissingFigureDown{pendient}% +} % \end{macrocode} % Create a counter, for storing the number of inserted todos. % \begin{macrocode} @@ -705,6 +771,21 @@ \define@key{todonotes.sty}% {textsize}{\renewcommand{\@todonotes@textsize}{\csname #1\endcsname}} % \end{macrocode} +% Add option for shadows behind the inserted notes +% \begin{macrocode} +\newif{\if@todonotes@shadowenabled} +\@todonotes@shadowenabledfalse +\DeclareOptionX{shadow}{\@todonotes@shadowenabledtrue +\usetikzlibrary{shadows}} +% \end{macrocode} +% Add option for the default width of the figure inserted with +% |\missingfigure|. +% \begin{macrocode} +\define@key{todonotes.sty}% + {figwidth}{\renewcommand{\@todonotes@figwidth}{#1}} +% \end{macrocode} +% Make the text width as an option. +% \begin{macrocode} % Finally process the given options. % \begin{macrocode} \ProcessOptionsX @@ -769,6 +850,12 @@ \@todonotes@captiongiventrue}% \define@key{todonotes}{nocaption}[]{\@todonotes@captiongivenfalse}% % \end{macrocode} +% Change the current figure width. +% \begin{macrocode} +\newcommand{\@todonotes@currentfigwidth}{\@todonotes@figwidth} +\define@key{todonotes}% + {figwidth}{\renewcommand{\@todonotes@currentfigwidth}{#1}} +% \end{macrocode} % Preset values of the options % \begin{macrocode} \presetkeys% @@ -778,6 +865,7 @@ bordercolor=\@todonotes@bordercolor,% noinline,% nocaption,% + figwidth=\@todonotes@figwidth,% line, list, size=\@todonotes@textsize}{}% % \end{macrocode} % \subsection{The main code part} @@ -788,7 +876,7 @@ \if@todonotes@disabled% \newcommand{\listoftodos}{} \newcommand{\todo}[2][]{\ignorespaces} - \newcommand{\missingfigure}[1]{} + \newcommand{\missingfigure}[2]{} \else % \if@todonotes@disabled % \end{macrocode} % Define the |\listoftodos| command and define the @@ -801,12 +889,23 @@ % \end{macrocode} % Define styles used by the todo command % \begin{macrocode} -\tikzstyle{notestyle} = [ +\tikzstyle{notestyleraw} = [ draw=\@todonotes@currentbordercolor, fill=\@todonotes@currentbackgroundcolor, line width=0.5pt, text width = \@todonotes@textwidth - 1.6 ex - 1pt, - inner sep = 0.8 ex] + inner sep = 0.8 ex, + rounded corners=4pt] +% \end{macrocode} +% Add shadows and rounded corners to the inserted todonotes. +% \begin{macrocode} +\if@todonotes@shadowenabled +\tikzstyle{notestyle} = [notestyleraw, + general shadow={shadow xshift=.5ex, shadow yshift=-.5ex, + opacity=1,fill=black!50}] +\else +\tikzstyle{notestyle} = [notestyleraw] +\fi \tikzstyle{notestyleleft} = [ notestyle, left] @@ -958,14 +1057,16 @@ % \begin{macro}{\missingfigure} % Defines the |\missingfigure| macro. % \begin{macrocode} -\newcommand{\missingfigure}[1]{ -\addcontentsline{tdo}{todo}{Figure: \protect{#1}}% +\newcommand{\missingfigure}[2][]{ +\setkeys{todonotes}{#1}% +\addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: \protect{#2}}% \par \noindent \begin{tikzpicture} \draw[fill=black!40, draw = white, line width=0pt] - (-3, -2.5) rectangle +(\textwidth, 4cm); -\draw (3, 0) node[right, text width=4cm] {#1}; + (-2, -2.5) rectangle +(\@todonotes@currentfigwidth, 4cm); +\draw (2, -0.3) node[right, text + width=\@todonotes@currentfigwidth-4.5cm] {#2}; \draw[red, fill=white, rounded corners = 5pt, line width=10pt] (30:2cm) -- (150:2cm) -- (270:2cm) -- cycle; \draw (0, 0.3) node {\@todonotes@MissingFigureUp}; |