diff --git a/todonotes.dtx b/todonotes.dtx index 31d5cbe..cbe0e75 100644 --- a/todonotes.dtx +++ b/todonotes.dtx @@ -357,7 +357,7 @@ % These options sets the default colors for the todo command. % There are four colors that can be specified. The border color % (default |bordercolor=black|) around the inserted text, the color -% behind the inserted text (default |backgroundcolor=orange|), the +% behind the inserted text (default |backgroundcolor=orange|), the % color of the inserted text (default |textcolor=black|) and % the color of the line connecting the inserted textbox with the % current location in the text (default |linecolor=orange|). @@ -1427,12 +1427,10 @@ prior to loading the todonotes package.} \else\fi% \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. +% Make the text size as an option. % \begin{macrocode} \define@key{todonotes.sty}% - {textsize}{\renewcommand{\@todonotes@textsize}{\csname #1\endcsname}} + {textsize}{\renewcommand{\@todonotes@textsize}{#1}} % \end{macrocode} % Add option for shadows behind the inserted notes % \begin{macrocode} @@ -1509,7 +1507,8 @@ prior to loading the todonotes package.} \else\fi% % Set a relative font size % \begin{macrocode} \newcommand{\@todonotes@sizecommand}{}% -\define@key{todonotes}{size}{\renewcommand{\@todonotes@sizecommand}{#1}}% +\define@key{todonotes}{size}{\renewcommand{\@todonotes@sizecommand}{#1}% +}% % \end{macrocode} % Should the todo item be disabled? % \begin{macrocode} @@ -1774,6 +1773,18 @@ prior to loading the todonotes package.} \else\fi% % \end{macrocode} % \end{macro} % \begin{macro}{drawInlineNote} +% Define helper function |useSizeCommand|. +% \begin{macrocode} +\newcommand{\@todonotes@useSizeCommand}{% +\ifcsname \expandafter\string\@todonotes@sizecommand\endcsname +\csname \expandafter\string\@todonotes@sizecommand\endcsname% +\else +\@todonotes@sizecommand +\fi% +}% +% \end{macrocode} +% \end{macro} +% \begin{macro}{drawInlineNote} % Define helper function |drawInlineNote|. % \begin{macrocode} \newcommand{\@todonotes@drawInlineNote}{% @@ -1784,9 +1795,9 @@ prior to loading the todonotes package.} \else\fi% \end{tikzpicture}% \if@todonotes@inlinepar\par\fi}% \if@todonotes@authorgiven% - {\noindent \@todonotes@sizecommand \@todonotes@author:\,\@todonotes@text}% + {\noindent \@todonotes@useSizeCommand \@todonotes@author:\,\@todonotes@text}% \else% - {\noindent \@todonotes@sizecommand \@todonotes@text}% + {\noindent \@todonotes@useSizeCommand \@todonotes@text}% \fi {\if@todonotes@inlinepar\par\noindent\fi% \begin{tikzpicture}[remember picture]% @@ -1796,11 +1807,11 @@ prior to loading the todonotes package.} \else\fi% \else% {\if@todonotes@inlinepar\par\noindent\fi% \begin{tikzpicture}[remember picture]% - \draw node[inlinenotestyle,font=\@todonotes@sizecommand]{% + \draw node[inlinenotestyle,font=\@todonotes@useSizeCommand]{% \if@todonotes@authorgiven% - {\noindent \@todonotes@sizecommand \@todonotes@author:\,\@todonotes@text}% + {\noindent \@todonotes@author:\,\@todonotes@text}% \else% - {\noindent \@todonotes@sizecommand \@todonotes@text}% + {\noindent \@todonotes@text}% \fi};% \end{tikzpicture}% \if@todonotes@inlinepar\par\fi}% @@ -1817,9 +1828,9 @@ prior to loading the todonotes package.} \else\fi% \end{tikzpicture}\\% \begin{minipage}{\@todonotes@textwidth}% \if@todonotes@authorgiven% - \@todonotes@sizecommand \@todonotes@author \@todonotes@text% + \@todonotes@useSizeCommand \@todonotes@author \@todonotes@text% \else% - \@todonotes@sizecommand \@todonotes@text% + \@todonotes@useSizeCommand \@todonotes@text% \fi% \end{minipage}\\% \begin{tikzpicture}[remember picture]% @@ -1829,15 +1840,15 @@ prior to loading the todonotes package.} \else\fi% \let\originalHbadness\hbadness% \hbadness 100000% \begin{tikzpicture}[remember picture,baseline=(X.base)]% - \node(X){\vphantom{\@todonotes@sizecommand X}};% + \node(X){\vphantom{\@todonotes@useSizeCommand X}};% \if@todonotes@authorgiven% - \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% - {\@todonotes@sizecommand\@todonotes@author};% + \draw node[notestyle,font=\@todonotes@useSizeCommand,anchor=north] (inNote) at (X.north)% + {\@todonotes@author};% \node(Y)[below=of X]{};% - \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.south)% + \draw node[notestyle,font=\@todonotes@useSizeCommand,anchor=north] (inNote) at (X.south)% {\@todonotes@text};% \else% - \draw node[notestyle,font=\@todonotes@sizecommand,anchor=north] (inNote) at (X.north)% + \draw node[notestyle,font=\@todonotes@useSizeCommand,anchor=north] (inNote) at (X.north)% {\@todonotes@text};% \fi% \end{tikzpicture}% @@ -1913,7 +1924,7 @@ prior to loading the todonotes package.} \else\fi% (-2, -0.5*\@todonotes@currentfigheight-0.5cm) rectangle +(\@todonotes@currentfigwidth, \@todonotes@currentfigheight); \draw (2, -0.5) node[right, text - width=\@todonotes@currentfigwidth-4.5cm, font=\@todonotes@sizecommand] {#2}; + width=\@todonotes@currentfigwidth-4.5cm, font=\@todonotes@useSizeCommand] {#2}; \draw[red, fill=white, rounded corners = 1pt, line width=10pt] (30:2cm) -- (150:2cm) -- (270:2cm) -- cycle; \draw (0, 0.3) node {\@todonotes@MissingFigureUp};