summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/todonotes/todonotes.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/todonotes/todonotes.sty')
-rw-r--r--Master/texmf-dist/tex/latex/todonotes/todonotes.sty56
1 files changed, 41 insertions, 15 deletions
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'.