summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/todonotes
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-11-23 21:42:53 +0000
committerKarl Berry <karl@freefriends.org>2018-11-23 21:42:53 +0000
commitbc258ba7464ef10d950ea5cadaf99bfa4f94f19c (patch)
tree99b69c200d8d1ed8a9d8431fae5c497773670db0 /Master/texmf-dist/tex/latex/todonotes
parent65e275a0bf822d6abaa473b7768030f4f73a833b (diff)
todonotes (23nov18)
git-svn-id: svn://tug.org/texlive/trunk@49233 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/todonotes')
-rw-r--r--Master/texmf-dist/tex/latex/todonotes/todonotes.sty150
1 files changed, 102 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/latex/todonotes/todonotes.sty b/Master/texmf-dist/tex/latex/todonotes/todonotes.sty
index 0d1ce58cd3b..7b9a76d30bb 100644
--- a/Master/texmf-dist/tex/latex/todonotes/todonotes.sty
+++ b/Master/texmf-dist/tex/latex/todonotes/todonotes.sty
@@ -22,19 +22,23 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{todonotes}
- [2015/07/09 .dtx Todonotes source and documentation.]
+ [2018/11/22 v1.1.1 Todonotes source and documentation.]
-\ProvidesPackage{todonotes}[2012/07/25]
+\ProvidesPackage{todonotes}[2018/11/22]
\RequirePackage{ifthen}
\RequirePackage{xkeyval}
\RequirePackage{xcolor}
\RequirePackage{tikz}
\usetikzlibrary{positioning}
+\usetikzlibrary{shadows}
\RequirePackage{calc}
+\newcommand\setuptodonotes[1]{\presetkeys{todonotes}{#1}{}}
\newcommand{\@todonotes@text}{}%
\newcommand{\@todonotes@backgroundcolor}{orange}
+\newcommand{\@todonotes@textcolor}{black}
\newcommand{\@todonotes@linecolor}{orange}
\newcommand{\@todonotes@bordercolor}{black}
+\newcommand{\@todonotes@tickmarkheight}{0cm}
\newcommand{\@todonotes@textwidth}{\marginparwidth}
\newcommand{\@todonotes@textsize}{\normalsize}
\newcommand{\@todonotes@figwidth}{\linewidth}
@@ -163,20 +167,24 @@ prior to loading the todonotes package.} \else\fi%
\define@key{todonotes.sty}%
{backgroundcolor}{\renewcommand{\@todonotes@backgroundcolor}{#1}}
\define@key{todonotes.sty}%
+ {textcolor}{\renewcommand{\@todonotes@textcolor}{#1}}
+\define@key{todonotes.sty}%
{linecolor}{\renewcommand{\@todonotes@linecolor}{#1}}
\define@key{todonotes.sty}%
{bordercolor}{\renewcommand{\@todonotes@bordercolor}{#1}}
+\define@key{todonotes.sty}%
+ {tickmarkheight}{\renewcommand{\@todonotes@tickmarkheight}{#1}}
\newif{\if@todonotes@prependcaptionglobal}
\@todonotes@prependcaptionglobalfalse
\DeclareOptionX{prependcaption}{\@todonotes@prependcaptionglobaltrue}
\define@key{todonotes.sty}%
{textwidth}{\renewcommand{\@todonotes@textwidth}{#1}}
\define@key{todonotes.sty}%
- {textsize}{\renewcommand{\@todonotes@textsize}{\csname #1\endcsname}}
-\newif{\if@todonotes@shadowenabled}
-\@todonotes@shadowenabledfalse
-\DeclareOptionX{shadow}{\@todonotes@shadowenabledtrue
-\usetikzlibrary{shadows}}
+ {textsize}{\renewcommand{\@todonotes@textsize}{#1}}
+\define@key{todonotes.sty}%
+ {size}{\renewcommand{\@todonotes@textsize}{#1}}
+\newcommand{\@todonotes@shadowenabledbydefault}{noshadow}
+\DeclareOptionX{shadow}{\renewcommand{\@todonotes@shadowenabledbydefault}{shadow}}
\define@key{todonotes.sty}%
{figwidth}{\renewcommand{\@todonotes@figwidth}{#1}}
\define@key{todonotes.sty}%
@@ -202,6 +210,7 @@ prior to loading the todonotes package.} \else\fi%
\newcommand{\@todonotes@currentlinecolor}{}%
\newcommand{\@todonotes@currentbackgroundcolor}{}%
+\newcommand{\@todonotes@currenttextcolor}{}%
\newcommand{\@todonotes@currentbordercolor}{}%
\define@key{todonotes}{color}{%
\renewcommand{\@todonotes@currentlinecolor}{#1}%
@@ -210,10 +219,18 @@ prior to loading the todonotes package.} \else\fi%
\renewcommand{\@todonotes@currentlinecolor}{#1}}%
\define@key{todonotes}{backgroundcolor}{%
\renewcommand{\@todonotes@currentbackgroundcolor}{#1}}%
+\define@key{todonotes}{textcolor}{%
+ \renewcommand{\@todonotes@currenttextcolor}{#1}}%
\define@key{todonotes}{bordercolor}{%
\renewcommand{\@todonotes@currentbordercolor}{#1}}%
+\newif\if@todonotes@useshadow%
+\define@key{todonotes}{shadow}[]{\@todonotes@useshadowtrue}%
+\define@key{todonotes}{noshadow}[]{\@todonotes@useshadowfalse}%
+\define@key{todonotes}{tickmarkheight}{%
+ \renewcommand{\@todonotes@tickmarkheight}{#1}}%
\newcommand{\@todonotes@sizecommand}{}%
-\define@key{todonotes}{size}{\renewcommand{\@todonotes@sizecommand}{#1}}%
+\define@key{todonotes}{size}{\renewcommand{\@todonotes@sizecommand}{#1}%
+}%
\newif\if@todonotes@localdisable%
\define@key{todonotes}{disable}[]{\@todonotes@localdisabletrue}%
\define@key{todonotes}{nodisable}[]{\@todonotes@localdisablefalse}%
@@ -264,18 +281,24 @@ prior to loading the todonotes package.} \else\fi%
{todonotes}%
{linecolor=\@todonotes@linecolor,%
backgroundcolor=\@todonotes@backgroundcolor,%
+ textcolor=\@todonotes@textcolor,%
bordercolor=\@todonotes@bordercolor,%
+ tickmarkheight=0cm,%
nofancyline,%
nodisable,%
noinline,%
nocaption,%
noauthor,%
+ \@todonotes@shadowenabledbydefault,%
figwidth=\@todonotes@figwidth,%
figheight=\@todonotes@figheight,%
figcolor=\@todonotes@figcolor,%
- line, list, size=\@todonotes@textsize,
+ line, list,%
inlinewidth=\linewidth,
inlinepar}{}%
+\@temptokena\expandafter{\@todonotes@textsize}
+\edef\next{\noexpand\presetkeys{todonotes}{size=\the\@temptokena}{}}
+\next
\if@todonotes@disabled%
\newcommand{\listoftodos}[1][]{}
\newcommand{\@todo}[2][]{}
@@ -288,26 +311,11 @@ prior to loading the todonotes package.} \else\fi%
\tikzstyle{notestyleraw} = [
draw=\@todonotes@currentbordercolor,
fill=\@todonotes@currentbackgroundcolor,
+ text=\@todonotes@currenttextcolor,
line width=0.5pt,
text width = \@todonotes@textwidth - 1.6 ex - 1pt,
inner sep = 0.8 ex,
rounded corners=4pt]
-\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]
-\tikzstyle{connectstyle} = [
- thick,
- draw=\@todonotes@currentlinecolor]
-\tikzstyle{inlinenotestyle} = [
- notestyle,
- text width=\@todonotes@inlinewidth - 1.6 ex - 1 pt]
\newcommand{\@todo}[2][]{%
\if@todonotes@prependcaptionglobal%
\@todonotes@prependcaptiontrue%
@@ -317,6 +325,22 @@ prior to loading the todonotes package.} \else\fi%
\renewcommand{\@todonotes@text}{#2}%
\renewcommand{\@todonotes@caption}{#2}%
\setkeys{todonotes}{#1}%
+\if@todonotes@useshadow%
+\tikzstyle{notestyle} = [notestyleraw,%
+ general shadow={shadow xshift=0.5ex, shadow yshift=-0.5ex,%
+ opacity=1,fill=black!50}]%
+\else%
+\tikzstyle{notestyle} = [notestyleraw]%
+\fi%
+\tikzstyle{notestyleleft} = [%
+ notestyle,%
+ left]%
+\tikzstyle{connectstyle} = [%
+ thick,%
+ draw=\@todonotes@currentlinecolor]%
+\tikzstyle{inlinenotestyle} = [%
+ notestyle,%
+ text width=\@todonotes@inlinewidth - 1.6 ex - 1 pt]%
\if@todonotes@localdisable%
\else%
\addtocounter{@todonotes@numberoftodonotes}{1}%
@@ -341,6 +365,12 @@ prior to loading the todonotes package.} \else\fi%
\fi%\if@todonotes@localdisable
}%
\newcommand{\@todonotes@drawMarginNoteWithLine}{%
+\ifvmode
+ \vspace*{-\parskip}% % backup if we are already in vertical mode
+ \vskip-\baselineskip % (and don't loose that space after a
+ % pagebreak ...
+ \noindent
+\fi
\begin{tikzpicture}[remember picture, overlay, baseline=-0.75ex]%
\node [coordinate] (inText) {};%
\end{tikzpicture}%
@@ -362,6 +392,13 @@ prior to loading the todonotes package.} \else\fi%
\else%
\addcontentsline{tdo}{todo}{\@todonotes@caption}%
\fi}%
+\newcommand{\@todonotes@useSizeCommand}{%
+\ifcsname \expandafter\string\@todonotes@sizecommand\endcsname
+\csname \expandafter\string\@todonotes@sizecommand\endcsname%
+\else
+\@todonotes@sizecommand
+\fi%
+}%
\newcommand{\@todonotes@drawInlineNote}{%
\if@todonotes@dviStyle%
{\if@todonotes@inlinepar\par\noindent\fi%
@@ -370,9 +407,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]%
@@ -382,11 +419,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}%
@@ -398,9 +435,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]%
@@ -410,15 +447,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}%
@@ -439,7 +476,8 @@ prior to loading the todonotes package.} \else\fi%
\else%
\begin{tikzpicture}[remember picture, overlay]%
\draw[connectstyle]%
-([yshift=-0.2cm] inText)%
+([yshift=-0.2cm + \@todonotes@tickmarkheight] inText)%
+-| ([yshift=-0.2cm] inText)%
-| ([xshift=-0.2cm] inNote.west)%
-| (inNote.west);%
\end{tikzpicture}%
@@ -460,7 +498,8 @@ prior to loading the todonotes package.} \else\fi%
\else%
\begin{tikzpicture}[remember picture, overlay]%
\draw[connectstyle]%
-([yshift=-0.2cm] inText)%
+([yshift=-0.2cm + \@todonotes@tickmarkheight] inText)%
+-| ([yshift=-0.2cm] inText)%
-| ([xshift=0.2cm] inNote.east)%
-| (inNote.east);%
\end{tikzpicture}%
@@ -471,30 +510,45 @@ prior to loading the todonotes package.} \else\fi%
\addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: #2}%
\par
\noindent
+\hfill
\begin{tikzpicture}
\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, font=\@todonotes@sizecommand] {#2};
+ (-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@useSizeCommand] {#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};
\draw (0, -0.3) node {\@todonotes@MissingFigureDown};
\end{tikzpicture}\hfill
+\null\par
}% Ending \missingfigure command
\fi% Ending \@todonotes@ifdisabled
\newcommand{\todototoc}
-{
+{%
\if@todonotes@disabled
\else
-\addcontentsline{toc}{\@ifundefined{chapter}{section}{chapter}}{\@todonotes@todolistname}
+\addcontentsline{toc}{\@ifundefined{chapter}{section}{chapter}}{\@todonotes@todolistname}%
\fi
}
-\newcommand{\todo}[2][]{\if@todonotes@inlinepar%
- \@bsphack\@todo[#1]{#2}\@esphack%
+\newcommand{\todo}[2][]{%
+ \if@todonotes@inlinepar
+ \ifhmode
+ \@bsphack
+ \@todonotes@vmodefalse
+ \else
+ \@savsf\@m
+ \@savsk\z@
+ \@todonotes@vmodetrue
+ \fi
+ {\@todo[#1]{#2}}%
+ \@esphack%
+ \if@todonotes@vmode \par \fi
\else%
- \@todo[#1]{#2}%
- \fi}%
+ \@todo[#1]{#2}%
+ \fi}
+\newif\if@todonotes@vmode
\endinput
%%
%% End of file `todonotes.sty'.