Introduction done (first draft).
[mymsc.git] / todonotes.sty
blob0425ea9aeb5260829426856c0e7f1bc848833971
1 %%
2 %% This is file `todonotes.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% todonotes.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 2008 by Henrik Skov Midtiby <henrikmidtiby@gmail.com>
12 %%
13 %% This file may be distributed and/or modified under the conditions of
14 %% the LaTeX Project Public License, either version 1.2 of this license
15 %% or (at your option) any later version. The latest version of this
16 %% license is in:
17 %%
18 %% http://www.latex-project.org/lppl.txt
19 %%
20 %% and version 1.2 or later is part of all distributions of LaTeX version
21 %% 1999/12/01 or later.
22 %%
23 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
24 \ProvidesPackage{todonotes}
25 [2010/09/26 .dtx Todonotes source and documentation.]
27 \ProvidesPackage{todonotes}[2010/09/26]
28 \RequirePackage{ifthen}
29 \RequirePackage{xkeyval}
30 \RequirePackage{xcolor}
31 \RequirePackage{tikz}
32 \RequirePackage{calc}
33 \newcommand{\@todonotes@text}{}%
34 \newcommand{\@todonotes@backgroundcolor}{orange}
35 \newcommand{\@todonotes@linecolor}{orange}
36 \newcommand{\@todonotes@bordercolor}{black}
37 \newcommand{\@todonotes@textwidth}{\marginparwidth}
38 \newcommand{\@todonotes@textsize}{\normalsize}
39 \newcommand{\@todonotes@figwidth}{\columnwidth}
40 \AtBeginDocument{
41 \ifx\undefined\phantomsection
42 \newcommand{\phantomsection}{}
43 \fi
46 \newcommand{\@todonotes@todolistname}{Todo list}
47 \newcommand{\@todonotes@MissingFigureText}{Figure}
48 \newcommand{\@todonotes@MissingFigureUp}{Missing}
49 \newcommand{\@todonotes@MissingFigureDown}{figure}
50 \newcommand{\@todonotes@SetTodoListName}[1]
51 {\renewcommand{\@todonotes@todolistname}{#1}}
52 \newcommand{\@todonotes@SetMissingFigureText}[1]
53 {\renewcommand{\@todonotes@MissingFigureText}{#1}}
54 \newcommand{\@todonotes@SetMissingFigureUp}[1]
55 {\renewcommand{\@todonotes@MissingFigureUp}{#1}}
56 \newcommand{\@todonotes@SetMissingFigureDown}[1]
57 {\renewcommand{\@todonotes@MissingFigureDown}{#1}}
58 \newif{\if@todonotes@reverseMissingFigureTriangle}
59 \DeclareOptionX{catalan}{
60 \@todonotes@SetTodoListName{Llista de feines pendents}%
61 \@todonotes@SetMissingFigureText{Figura}%
62 \@todonotes@SetMissingFigureUp{Figura}%
63 \@todonotes@SetMissingFigureDown{pendent}%
65 \DeclareOptionX{danish}{%
66 \@todonotes@SetTodoListName{G\o{}rem\aa{}lsliste}%
67 \@todonotes@SetMissingFigureText{Figur}%
68 \@todonotes@SetMissingFigureUp{Manglende}%
69 \@todonotes@SetMissingFigureDown{figur}%
71 \DeclareOptionX{dutch}{%
72 \@todonotes@SetTodoListName{Lijst van onafgewerkte taken}%
73 \@todonotes@SetMissingFigureText{Figuur}%
74 \@todonotes@SetMissingFigureUp{Ontbrekende}%
75 \@todonotes@SetMissingFigureDown{figuur}%
77 \DeclareOptionX{english}{%
78 \@todonotes@SetTodoListName{Todo list}%
79 \@todonotes@SetMissingFigureText{Figure}%
80 \@todonotes@SetMissingFigureUp{Missing}%
81 \@todonotes@SetMissingFigureDown{figure}%
83 \DeclareOptionX{french}{%
84 \@todonotes@SetTodoListName{Liste des points \`a traiter}%
85 \@todonotes@SetMissingFigureText{Figure}%
86 \@todonotes@SetMissingFigureUp{Figure}%
87 \@todonotes@SetMissingFigureDown{manquante}%
88 \@todonotes@reverseMissingFigureTrianglefalse
90 \DeclareOptionX{german}{%
91 \@todonotes@SetTodoListName{Liste der noch zu erledigenden Punkte}%
92 \@todonotes@SetMissingFigureText{Abbildung}%
93 \@todonotes@SetMissingFigureUp{Fehlende}%
94 \@todonotes@SetMissingFigureDown{Abbildung}%
96 \DeclareOptionX{italian}{
97 \@todonotes@SetTodoListName{Elenco delle cose da fare}%
98 \@todonotes@SetMissingFigureText{Figura}%
99 \@todonotes@SetMissingFigureUp{Figura}%
100 \@todonotes@SetMissingFigureDown{mancante}%
102 \DeclareOptionX{ngerman}{%
103 \@todonotes@SetTodoListName{Liste der noch zu erledigenden Punkte}%
104 \@todonotes@SetMissingFigureText{Abbildung}%
105 \@todonotes@SetMissingFigureUp{Fehlende}%
106 \@todonotes@SetMissingFigureDown{Abbildung}%
108 \DeclareOptionX{portuguese}{
109 \@todonotes@SetTodoListName{Lista de tarefas pendentes}%
110 \@todonotes@SetMissingFigureText{Figura}%
111 \@todonotes@SetMissingFigureUp{Figura}%
112 \@todonotes@SetMissingFigureDown{pendente}%
114 \DeclareOptionX{spanish}{
115 \@todonotes@SetTodoListName{Lista de tareas pendientes}%
116 \@todonotes@SetMissingFigureText{Figura}%
117 \@todonotes@SetMissingFigureUp{Figura}%
118 \@todonotes@SetMissingFigureDown{pendient}%
120 \newcounter{@todonotes@numberoftodonotes}
121 \newif{\if@todonotes@obeyDraft}
122 \DeclareOptionX{obeyDraft}{\@todonotes@obeyDrafttrue}
123 \newif{\if@todonotes@isDraft}
124 \DeclareOptionX{draft}{\@todonotes@isDrafttrue}
125 \newif{\if@todonotes@disabled}
126 \DeclareOptionX{disable}{\@todonotes@disabledtrue}
127 \newif{\if@todonotes@colorinlistoftodos}
128 \DeclareOptionX{colorinlistoftodos}{\@todonotes@colorinlistoftodostrue}
129 \newif{\if@todonotes@dviStyle}
130 \DeclareOptionX{dvistyle}{\@todonotes@dviStyletrue}
131 \define@key{todonotes.sty}%
132 {color}{
133 \renewcommand{\@todonotes@backgroundcolor}{#1}
134 \renewcommand{\@todonotes@linecolor}{#1}}
135 \define@key{todonotes.sty}%
136 {backgroundcolor}{\renewcommand{\@todonotes@backgroundcolor}{#1}}
137 \define@key{todonotes.sty}%
138 {linecolor}{\renewcommand{\@todonotes@linecolor}{#1}}
139 \define@key{todonotes.sty}%
140 {bordercolor}{\renewcommand{\@todonotes@bordercolor}{#1}}
141 \newif{\if@todonotes@prependcaptionglobal}
142 \@todonotes@prependcaptionglobalfalse
143 \DeclareOptionX{prependcaption}{\@todonotes@prependcaptionglobaltrue}
144 \define@key{todonotes.sty}%
145 {textwidth}{\renewcommand{\@todonotes@textwidth}{#1}}
146 \define@key{todonotes.sty}%
147 {textsize}{\renewcommand{\@todonotes@textsize}{\csname #1\endcsname}}
148 \newif{\if@todonotes@shadowenabled}
149 \@todonotes@shadowenabledfalse
150 \DeclareOptionX{shadow}{\@todonotes@shadowenabledtrue
151 \usetikzlibrary{shadows}}
152 \define@key{todonotes.sty}%
153 {figwidth}{\renewcommand{\@todonotes@figwidth}{#1}}
154 \ProcessOptionsX*
155 \if@todonotes@disabled
156 \else
157 \if@todonotes@obeyDraft
158 \@todonotes@disabledtrue
159 \if@todonotes@isDraft
160 \@todonotes@disabledfalse
165 \newcommand{\@todonotes@currentlinecolor}{}%
166 \newcommand{\@todonotes@currentbackgroundcolor}{}%
167 \newcommand{\@todonotes@currentbordercolor}{}%
168 \define@key{todonotes}{color}{%
169 \renewcommand{\@todonotes@currentlinecolor}{#1}%
170 \renewcommand{\@todonotes@currentbackgroundcolor}{#1}}%
171 \define@key{todonotes}{linecolor}{%
172 \renewcommand{\@todonotes@currentlinecolor}{#1}}%
173 \define@key{todonotes}{backgroundcolor}{%
174 \renewcommand{\@todonotes@currentbackgroundcolor}{#1}}%
175 \define@key{todonotes}{bordercolor}{%
176 \renewcommand{\@todonotes@currentbordercolor}{#1}}%
177 \newcommand{\@todonotes@sizecommand}{}%
178 \define@key{todonotes}{size}{\renewcommand{\@todonotes@sizecommand}{#1}}%
179 \newif\if@todonotes@localdisable%
180 \define@key{todonotes}{disable}[]{\@todonotes@localdisabletrue}%
181 \define@key{todonotes}{nodisable}[]{\@todonotes@localdisablefalse}%
182 \newif\if@todonotes@appendtolistoftodos%
183 \define@key{todonotes}{list}[]{\@todonotes@appendtolistoftodostrue}%
184 \define@key{todonotes}{nolist}[]{\@todonotes@appendtolistoftodosfalse}%
185 \newif\if@todonotes@inlinenote%
186 \define@key{todonotes}{inline}[]{\@todonotes@inlinenotetrue}%
187 \define@key{todonotes}{noinline}[]{\@todonotes@inlinenotefalse}%
188 \newif\if@todonotes@prependcaption%
189 \define@key{todonotes}{prepend}[]{\@todonotes@prependcaptiontrue}%
190 \define@key{todonotes}{noprepend}[]{\@todonotes@prependcaptionfalse}%
191 \newif\if@todonotes@line%
192 \define@key{todonotes}{line}[]{\@todonotes@linetrue}%
193 \define@key{todonotes}{noline}[]{\@todonotes@linefalse}%
194 \newcommand{\@todonotes@caption}{}%
195 \newif\if@todonotes@captiongiven%
196 \define@key{todonotes}{caption}%
197 {\renewcommand{\@todonotes@caption}{#1}%
198 \@todonotes@captiongiventrue}%
199 \define@key{todonotes}{nocaption}[]{\@todonotes@captiongivenfalse}%
200 \newcommand{\@todonotes@currentfigwidth}{\@todonotes@figwidth}
201 \define@key{todonotes}%
202 {figwidth}{\renewcommand{\@todonotes@currentfigwidth}{#1}}
203 \presetkeys%
204 {todonotes}%
205 {linecolor=\@todonotes@linecolor,%
206 backgroundcolor=\@todonotes@backgroundcolor,%
207 bordercolor=\@todonotes@bordercolor,%
208 nodisable,%
209 noinline,%
210 nocaption,%
211 figwidth=\@todonotes@figwidth,%
212 line, list, size=\@todonotes@textsize}{}%
213 \if@todonotes@disabled%
214 \newcommand{\listoftodos}[1][]{}
215 \newcommand{\@todo}[2][]{\ignorespaces}
216 \newcommand{\missingfigure}[2][]{}
217 \else % \if@todonotes@disabled
218 \newcommand{\listoftodos}[1][\@todonotes@todolistname]
219 {\ifdefined\chapter\chapter*{#1}\else\section*{#1}\fi \@starttoc{tdo}}
220 \newcommand{\l@todo}
221 {\@dottedtocline{1}{0em}{2.3em}}
222 \tikzstyle{notestyleraw} = [
223 draw=\@todonotes@currentbordercolor,
224 fill=\@todonotes@currentbackgroundcolor,
225 line width=0.5pt,
226 text width = \@todonotes@textwidth - 1.6 ex - 1pt,
227 inner sep = 0.8 ex,
228 rounded corners=4pt]
229 \if@todonotes@shadowenabled
230 \tikzstyle{notestyle} = [notestyleraw,
231 general shadow={shadow xshift=.5ex, shadow yshift=-.5ex,
232 opacity=1,fill=black!50}]
233 \else
234 \tikzstyle{notestyle} = [notestyleraw]
236 \tikzstyle{notestyleleft} = [
237 notestyle,
238 left]
239 \tikzstyle{connectstyle} = [
240 thick,
241 draw=\@todonotes@currentlinecolor]
242 \tikzstyle{inlinenotestyle} = [
243 notestyle,
244 text width=\linewidth - 1.6 ex - 1 pt]
245 \newcommand{\@todo}[2][]{%
246 \if@todonotes@prependcaptionglobal%
247 \@todonotes@prependcaptiontrue%
248 \else%
249 \@todonotes@prependcaptionfalse%
250 \fi%
251 \renewcommand{\@todonotes@text}{#2}%
252 \renewcommand{\@todonotes@caption}{#2}%
253 \setkeys{todonotes}{#1}%
254 \if@todonotes@localdisable%
255 \else%
256 \addtocounter{@todonotes@numberoftodonotes}{1}%
257 \if@todonotes@appendtolistoftodos%
258 \phantomsection%
259 \if@todonotes@captiongiven%
260 \else%
261 \renewcommand{\@todonotes@caption}{#2}%
262 \fi%
263 \@todonotes@addElementToListOfTodos
264 \fi%
265 \if@todonotes@captiongiven%
266 \if@todonotes@prependcaption%
267 \renewcommand{\@todonotes@text}{\@todonotes@caption: #2}%
268 \fi%
269 \fi%
270 \if@todonotes@inlinenote%
271 \@todonotes@drawInlineNote
272 \else%
273 \@todonotes@drawMarginNoteWithLine
274 \fi %\if@todonotes@inlinenote
275 \fi %\if@todonotes@localdisable
276 \ignorespaces%
278 \newcommand{\@todonotes@drawMarginNoteWithLine}{%
279 \begin{tikzpicture}[remember picture, baseline=-0.75ex]%
280 \node [coordinate] (inText) {};%
281 \end{tikzpicture}%
282 \marginpar[{% Draw note in left margin
283 \@todonotes@drawMarginNote%
284 \@todonotes@drawLineToLeftMargin%
285 }]{% Draw note in right margin
286 \@todonotes@drawMarginNote%
287 \@todonotes@drawLineToRightMargin%
290 \newcommand{\@todonotes@addElementToListOfTodos}{%
291 \if@todonotes@colorinlistoftodos%
292 \addcontentsline{tdo}{todo}{\protect{%
293 \colorbox{\@todonotes@currentbackgroundcolor}%
294 {\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
295 \ \@todonotes@caption}}%
296 \else%
297 \addcontentsline{tdo}{todo}{\protect{\@todonotes@caption}}%
298 \fi}%
299 \newcommand{\@todonotes@drawInlineNote}{%
300 \if@todonotes@dviStyle%
301 {\par\noindent\begin{tikzpicture}[remember picture]%
302 \draw node[inlinenotestyle] {};\end{tikzpicture}\par}%
303 {\noindent \@todonotes@sizecommand \@todonotes@text}%
304 {\par\noindent\begin{tikzpicture}[remember picture]%
305 \draw node[inlinenotestyle] {};\end{tikzpicture}\par}%
306 \else%
307 {\par\noindent\begin{tikzpicture}[remember picture]%
308 \draw node[inlinenotestyle] {\@todonotes@sizecommand \@todonotes@text};%
309 \end{tikzpicture}\par}%
310 \fi}%
311 \newcommand{\@todonotes@drawMarginNote}{%
312 \if@todonotes@dviStyle%
313 \begin{tikzpicture}[remember picture]%
314 \draw node[notestyle] {};%
315 \end{tikzpicture}\\ %
316 \begin{minipage}{\@todonotes@textwidth}%
317 \@todonotes@sizecommand \@todonotes@text%
318 \end{minipage}\\%
319 \begin{tikzpicture}[remember picture]%
320 \draw node[notestyle] (inNote) {};%
321 \end{tikzpicture}%
322 \else%
323 \begin{tikzpicture}[remember picture]%
324 \draw node[notestyle] (inNote)%
325 {\@todonotes@sizecommand \@todonotes@text};%
326 \end{tikzpicture}%
327 \fi}%
328 \newcommand{\@todonotes@drawLineToRightMargin}{%
329 \if@todonotes@line%
330 \begin{tikzpicture}[remember picture, overlay]%
331 \draw[connectstyle]%
332 ([yshift=-0.2cm] inText)%
333 -| ([xshift=-0.2cm] inNote.west)%
334 -| (inNote.west);%
335 \end{tikzpicture}%
336 \fi}%
337 \newcommand{\@todonotes@drawLineToLeftMargin}{
338 \if@todonotes@line%
339 \begin{tikzpicture}[remember picture, overlay]%
340 \draw[connectstyle]%
341 ([yshift=-0.2cm] inText)%
342 -| ([xshift=0.2cm] inNote.east)%
343 -| (inNote.east);%
344 \end{tikzpicture}%
345 \fi}
346 \newcommand{\missingfigure}[2][]{
347 \setkeys{todonotes}{#1}%
348 \addcontentsline{tdo}{todo}{\@todonotes@MissingFigureText: \protect{#2}}%
349 \par
350 \noindent
351 \begin{tikzpicture}
352 \draw[fill=black!40, draw = white, line width=0pt]
353 (-2, -2.5) rectangle +(\@todonotes@currentfigwidth, 4cm);
354 \draw (2, -0.3) node[right, text
355 width=\@todonotes@currentfigwidth-4.5cm] {#2};
356 \draw[red, fill=white, rounded corners = 5pt, line width=10pt]
357 (30:2cm) -- (150:2cm) -- (270:2cm) -- cycle;
358 \draw (0, 0.3) node {\@todonotes@MissingFigureUp};
359 \draw (0, -0.3) node {\@todonotes@MissingFigureDown};
360 \end{tikzpicture}
361 }% Ending \missingfigure command
362 \fi % Ending \@todonotes@ifdisabled
363 \newcommand{\todototoc}
365 \if@todonotes@disabled
366 \else
367 \addcontentsline{toc}{\@ifundefined{chapter}{section}{chapter}}{\@todonotes@todolistname}
370 \newcommand{\todo}[2][]{\@todo[#1]{#2}}
371 \endinput
373 %% End of file `todonotes.sty'.