From c7d31b070a339ddceab2e077f6c416497cd76e43 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 10 Jul 2018 21:07:55 +0000 Subject: todonotes (10jul18) git-svn-id: svn://tug.org/texlive/trunk@48181 c570f23f-e606-0410-a88d-b1316a301751 --- .../examples/alterAppearenceOfListOfTodos.pdf | Bin 62871 -> 62871 bytes .../doc/latex/todonotes/examples/externalize.pdf | Bin 27659 -> 27659 bytes .../todonotes/examples/saveColorByUsingLayers.pdf | Bin 25180 -> 25180 bytes .../texmf-dist/doc/latex/todonotes/todonotes.pdf | Bin 312712 -> 314720 bytes .../source/latex/todonotes/todonotes.dtx | 101 +++++++++++++++++---- .../texmf-dist/tex/latex/todonotes/todonotes.sty | 56 +++++++++--- 6 files changed, 123 insertions(+), 34 deletions(-) diff --git a/Master/texmf-dist/doc/latex/todonotes/examples/alterAppearenceOfListOfTodos.pdf b/Master/texmf-dist/doc/latex/todonotes/examples/alterAppearenceOfListOfTodos.pdf index eae352bbad0..e6979bd5dd3 100644 Binary files a/Master/texmf-dist/doc/latex/todonotes/examples/alterAppearenceOfListOfTodos.pdf and b/Master/texmf-dist/doc/latex/todonotes/examples/alterAppearenceOfListOfTodos.pdf differ diff --git a/Master/texmf-dist/doc/latex/todonotes/examples/externalize.pdf b/Master/texmf-dist/doc/latex/todonotes/examples/externalize.pdf index fb119b67178..ee316125487 100644 Binary files a/Master/texmf-dist/doc/latex/todonotes/examples/externalize.pdf and b/Master/texmf-dist/doc/latex/todonotes/examples/externalize.pdf differ diff --git a/Master/texmf-dist/doc/latex/todonotes/examples/saveColorByUsingLayers.pdf b/Master/texmf-dist/doc/latex/todonotes/examples/saveColorByUsingLayers.pdf index af1d9bc39f8..839429b6468 100644 Binary files a/Master/texmf-dist/doc/latex/todonotes/examples/saveColorByUsingLayers.pdf and b/Master/texmf-dist/doc/latex/todonotes/examples/saveColorByUsingLayers.pdf differ diff --git a/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf b/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf index 87f92946f47..810c0fd61de 100644 Binary files a/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf and b/Master/texmf-dist/doc/latex/todonotes/todonotes.pdf differ diff --git a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx index 9cdb9290998..85ae5c5b103 100644 --- a/Master/texmf-dist/source/latex/todonotes/todonotes.dtx +++ b/Master/texmf-dist/source/latex/todonotes/todonotes.dtx @@ -47,7 +47,7 @@ % % \fi % -% \CheckSum{596} +% \CheckSum{636} % % \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 @@ -184,7 +184,16 @@ % Removed some underfull box warnings, solution by Ernst Blecha.} % \changes{1.0.4}{2015/07/09}{Restructured documentation and placed some examples in the % doc/examples subdirectory.} -% \changes{1.0.5}{2016/11/02}{Example of how to change the space eating behaviour added by Anselm Wagner. Reduced the width of missingfigure to avoid bad box warnings.} +% \changes{1.0.5}{2016/11/02}{Example of how to change the space eating behaviour +% added by Anselm Wagner. +% Reduced the width of missingfigure to avoid bad box warnings.} +% \changes{1.0.6}{2018/07/09}{Changed how whitespaces are handled around inserted +% todos to better mimick macros like index (Suggestion by Frank Mittelbach). +% Fix missing character warnings using patch by Niels Anders Danielsson. +% Use the specified textsize for missingfigure, patch by Johannes Twittmann. +% Added new options for inline todonotes based on code from Daniel Krenn. +% Added warning message when marginparwidth is less than 2cm, as +% suggested by ErikBoesen.} % \GetFileInfo{todonotes.dtx} % % \DoNotIndex{\newcommand,\newenvironment} @@ -424,8 +433,8 @@ % \newcommand{\insertref}[1]{\todo[color=green!40]{#1}} % \newcommand{\explainindetail}[1]{\todo[color=red!40]{#1}} % \end{verbatim} -% An example that uses all of the color options is given below -% \todo[linecolor=green!70!white, backgroundcolor=blue!20!white, +% An example that uses all of the color options is given +% below\todo[linecolor=green!70!white, backgroundcolor=blue!20!white, % bordercolor=red]{Anything but default colors}. % \begin{verbatim} % \todo[linecolor=green!70!white, backgroundcolor=blue!20!white, @@ -539,6 +548,27 @@ % \todo[author=Xavier, inline]{Testing author option.} % \end{verbatim} % +% +% \DescribeMacro{inlinewidth} +% The |inlinewidth| option makes it possible to alter the width +% of inline todos. +% \todo[inline, inlinewidth=5cm]{Testing the option inlinewidth.} +% \begin{verbatim} +% \todo[inline, inlinewidth=5cm]{Testing the option inlinewidth.} +% \end{verbatim} +% +% +% \DescribeMacro{inlinepar / noinlinepar} +% The options |inlinepar| and |noinlinepar| (default) determine whether the inserted inline +% todonote is sorrounded with \texttt{par} macros that enforce new lines +% prior to and after inserted inline todonotes. +% \todo[inline, inlinewidth=5cm, noinlinepar]{Testing the option inlinepar.} +% This is a line after the inserted todonote. +% \begin{verbatim} +% \todo[inline, inlinewidth=5cm, noinlinepar]{Testing the option inlinepar.} +% \end{verbatim} +% +% % \subsection{Options for the missingfigure command} % % \DescribeMacro{figwidth} @@ -587,6 +617,7 @@ % \end{verbatim} % \missingfigure[figcolor=white]{Testing figcolor} % +% % \subsection{Options for the listoftodos command} % The |\listoftodos| command takes one optional argument, that % defines the name of the inserted list of todos. @@ -1186,6 +1217,13 @@ \ifx\undefined\phantomsection \newcommand{\phantomsection}{} \fi +\ifdim \marginparwidth < 2cm +\todo[inline]{Warning. The length $\backslash$marginparwidth is +less than 2cm and will most likely cause issues with the +appearance of inserted todonotes. +The issue can be solved by adding a line like +$\backslash$setlength\{$\backslash$marginparwidth\}\{2cm\} +prior to loading the todonotes package.} \else\fi% } % \end{macrocode} % @@ -1508,6 +1546,19 @@ \define@key{todonotes}% {figcolor}{\renewcommand{\@todonotes@currentfigcolor}{#1}} % \end{macrocode} +% Change the width of an inline note. +% \begin{macrocode} +\newcommand{\@todonotes@inlinewidth}{\linewidth}% +\define@key{todonotes}% + {inlinewidth}{\renewcommand{\@todonotes@inlinewidth}{#1}} +% \end{macrocode} +% Change if inline note is written to a separate line or not. +% \begin{macrocode} +\newif\if@todonotes@inlinepar +\@todonotes@inlinepartrue +\define@key{todonotes}{inlinepar}[]{\@todonotes@inlinepartrue}% +\define@key{todonotes}{noinlinepar}[]{\@todonotes@inlineparfalse}% +% \end{macrocode} % Preset values of the options % \begin{macrocode} \presetkeys% @@ -1523,7 +1574,9 @@ figwidth=\@todonotes@figwidth,% figheight=\@todonotes@figheight,% figcolor=\@todonotes@figcolor,% - line, list, size=\@todonotes@textsize}{}% + line, list, size=\@todonotes@textsize, + inlinewidth=\linewidth, + inlinepar}{}% % \end{macrocode} % \subsection{The main code part} % Here is the actual macros defined. @@ -1571,7 +1624,7 @@ draw=\@todonotes@currentlinecolor] \tikzstyle{inlinenotestyle} = [ notestyle, - text width=\linewidth - 1.6 ex - 1 pt] + text width=\@todonotes@inlinewidth - 1.6 ex - 1 pt] % \end{macrocode} % % \begin{macro}{\@todo} @@ -1683,24 +1736,32 @@ % \begin{macrocode} \newcommand{\@todonotes@drawInlineNote}{% \if@todonotes@dviStyle% - {\par\noindent\begin{tikzpicture}[remember picture]% - \draw node[inlinenotestyle] {};\end{tikzpicture}\par}% + {\if@todonotes@inlinepar\par\noindent\fi% + \begin{tikzpicture}[remember picture]% + \draw node[inlinenotestyle] {}; + \end{tikzpicture}% + \if@todonotes@inlinepar\par\fi}% \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}% + {\if@todonotes@inlinepar\par\noindent\fi% + \begin{tikzpicture}[remember picture]% + \draw node[inlinenotestyle] {}; + \end{tikzpicture}% + \if@todonotes@inlinepar\par\fi}% \else% - {\par\noindent\begin{tikzpicture}[remember picture]% + {\if@todonotes@inlinepar\par\noindent\fi% + \begin{tikzpicture}[remember picture]% \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}% + \end{tikzpicture}% + \if@todonotes@inlinepar\par\fi}% \fi}% % \end{macrocode} % \end{macro} @@ -1726,9 +1787,7 @@ \let\originalHbadness\hbadness% \hbadness 100000% \begin{tikzpicture}[remember picture,baseline=(X.base)]% - \node(X){\vphantom{X}};% - \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% - {\@todonotes@text};% + \node(X){\vphantom{\@todonotes@sizecommand X}};% \if@todonotes@authorgiven% \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% {\@todonotes@sizecommand\@todonotes@author};% @@ -1757,7 +1816,7 @@ \foreach \s in {line,head}{% \draw[both,\s]% (inNote.north west).. controls +(0:0) and +(90:1.5)..([yshift=1ex] inText);% - };% + }% }% \else% \begin{tikzpicture}[remember picture, overlay]% @@ -1783,7 +1842,7 @@ \foreach \s in {line,head}{% \draw[both,\s]% (inNote.north east).. controls +(0:0) and +(90:1.5)..([yshift=1ex] inText);% - };% + }% }% \else% \begin{tikzpicture}[remember picture, overlay]% @@ -1808,7 +1867,7 @@ \draw[fill=\@todonotes@currentfigcolor, draw = black!40, line width=2pt] (-2, -2.5) rectangle +(\@todonotes@currentfigwidth, \@todonotes@currentfigheight); \draw (2, -0.3) node[right, text - width=\@todonotes@currentfigwidth-4.5cm] {#2}; + width=\@todonotes@currentfigwidth-4.5cm, font=\@todonotes@sizecommand] {#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}; @@ -1836,7 +1895,11 @@ % \begin{macro}{\todo} % Define the |\todo| command as a redirection to |\@todo|. % \begin{macrocode} -\newcommand{\todo}[2][]{\@bsphack\@todo[#1]{#2}\@esphack\ignorespaces}% +\newcommand{\todo}[2][]{\if@todonotes@inlinepar% + \@bsphack\@todo[#1]{#2}\@esphack% + \else% + \@todo[#1]{#2}% + \fi}% % \end{macrocode} % \end{macro} % \appendix diff --git a/Master/texmf-dist/tex/latex/todonotes/todonotes.sty b/Master/texmf-dist/tex/latex/todonotes/todonotes.sty index 5bae62f479b..126b7992044 100644 --- a/Master/texmf-dist/tex/latex/todonotes/todonotes.sty +++ b/Master/texmf-dist/tex/latex/todonotes/todonotes.sty @@ -44,6 +44,13 @@ \ifx\undefined\phantomsection \newcommand{\phantomsection}{} \fi +\ifdim \marginparwidth < 2cm +\todo[inline]{Warning. The length $\backslash$marginparwidth is +less than 2cm and will most likely cause issues with the +appearance of inserted todonotes. +The issue can be solved by adding a line like +$\backslash$setlength\{$\backslash$marginparwidth\}\{2cm\} +prior to loading the todonotes package.} \else\fi% } \newcommand{\@todonotes@todolistname}{Todo list} @@ -246,6 +253,13 @@ \newcommand{\@todonotes@currentfigcolor}{\@todonotes@figcolor} \define@key{todonotes}% {figcolor}{\renewcommand{\@todonotes@currentfigcolor}{#1}} +\newcommand{\@todonotes@inlinewidth}{\linewidth}% +\define@key{todonotes}% + {inlinewidth}{\renewcommand{\@todonotes@inlinewidth}{#1}} +\newif\if@todonotes@inlinepar +\@todonotes@inlinepartrue +\define@key{todonotes}{inlinepar}[]{\@todonotes@inlinepartrue}% +\define@key{todonotes}{noinlinepar}[]{\@todonotes@inlineparfalse}% \presetkeys% {todonotes}% {linecolor=\@todonotes@linecolor,% @@ -259,7 +273,9 @@ figwidth=\@todonotes@figwidth,% figheight=\@todonotes@figheight,% figcolor=\@todonotes@figcolor,% - line, list, size=\@todonotes@textsize}{}% + line, list, size=\@todonotes@textsize, + inlinewidth=\linewidth, + inlinepar}{}% \if@todonotes@disabled% \newcommand{\listoftodos}[1][]{} \newcommand{\@todo}[2][]{} @@ -291,7 +307,7 @@ draw=\@todonotes@currentlinecolor] \tikzstyle{inlinenotestyle} = [ notestyle, - text width=\linewidth - 1.6 ex - 1 pt] + text width=\@todonotes@inlinewidth - 1.6 ex - 1 pt] \newcommand{\@todo}[2][]{% \if@todonotes@prependcaptionglobal% \@todonotes@prependcaptiontrue% @@ -348,24 +364,32 @@ \fi}% \newcommand{\@todonotes@drawInlineNote}{% \if@todonotes@dviStyle% - {\par\noindent\begin{tikzpicture}[remember picture]% - \draw node[inlinenotestyle] {};\end{tikzpicture}\par}% + {\if@todonotes@inlinepar\par\noindent\fi% + \begin{tikzpicture}[remember picture]% + \draw node[inlinenotestyle] {}; + \end{tikzpicture}% + \if@todonotes@inlinepar\par\fi}% \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}% + {\if@todonotes@inlinepar\par\noindent\fi% + \begin{tikzpicture}[remember picture]% + \draw node[inlinenotestyle] {}; + \end{tikzpicture}% + \if@todonotes@inlinepar\par\fi}% \else% - {\par\noindent\begin{tikzpicture}[remember picture]% + {\if@todonotes@inlinepar\par\noindent\fi% + \begin{tikzpicture}[remember picture]% \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}% + \end{tikzpicture}% + \if@todonotes@inlinepar\par\fi}% \fi}% \newcommand{\@todonotes@drawMarginNote}{% \if@todonotes@dviStyle% @@ -386,9 +410,7 @@ \let\originalHbadness\hbadness% \hbadness 100000% \begin{tikzpicture}[remember picture,baseline=(X.base)]% - \node(X){\vphantom{X}};% - \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% - {\@todonotes@text};% + \node(X){\vphantom{\@todonotes@sizecommand X}};% \if@todonotes@authorgiven% \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% {\@todonotes@sizecommand\@todonotes@author};% @@ -412,7 +434,7 @@ \foreach \s in {line,head}{% \draw[both,\s]% (inNote.north west).. controls +(0:0) and +(90:1.5)..([yshift=1ex] inText);% -};% +}% }% \else% \begin{tikzpicture}[remember picture, overlay]% @@ -433,7 +455,7 @@ \foreach \s in {line,head}{% \draw[both,\s]% (inNote.north east).. controls +(0:0) and +(90:1.5)..([yshift=1ex] inText);% -};% +}% }% \else% \begin{tikzpicture}[remember picture, overlay]% @@ -453,7 +475,7 @@ \draw[fill=\@todonotes@currentfigcolor, draw = black!40, line width=2pt] (-2, -2.5) rectangle +(\@todonotes@currentfigwidth, \@todonotes@currentfigheight); \draw (2, -0.3) node[right, text - width=\@todonotes@currentfigwidth-4.5cm] {#2}; + width=\@todonotes@currentfigwidth-4.5cm, font=\@todonotes@sizecommand] {#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}; @@ -468,7 +490,11 @@ \addcontentsline{toc}{\@ifundefined{chapter}{section}{chapter}}{\@todonotes@todolistname} \fi } -\newcommand{\todo}[2][]{\@bsphack\@todo[#1]{#2}\@esphack\ignorespaces}% +\newcommand{\todo}[2][]{\if@todonotes@inlinepar% + \@bsphack\@todo[#1]{#2}\@esphack% + \else% + \@todo[#1]{#2}% + \fi}% \endinput %% %% End of file `todonotes.sty'. -- cgit v1.2.3