diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/todonotes/todonotes.dtx | 101 |
1 files changed, 82 insertions, 19 deletions
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 @@ %</driver> % \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 |