Thursday, May 15, 2008

Updated todonotes package

The package has been updated, find the new version at

In response to a request for making an option for the text width of the todonote, I have updated the todonotes package, including defining some additional options.

The package makes the following commands available
  • \todo{}
  • \listoftodos
The options the package understands are the following:
  • disable, if given the available commands have no effect
  • dvistyle, another layout of the todonotes which properly places the todo notes text when the document is compiled with latex and not pdflatex
  • color=value, sets the background color of the notes to value. Value is a color defined using the xcolor package
  • bordercolor=value, sets the border color of the notes to value
  • textwidth=value, sets the total width of the todonote to value. Value is a length.

I hope you'll find this useful. If you notice some rough edges / bugs let me hear, I might be able to get rid of them then.


The source code of the package is given below, and below of that the code for the sample document (the image at the top) is given.

% todonotes.sty
% ====================
% Part: Identification
% ====================

% ==============================
% Part: The package loading part
% ==============================
% Loads the packages that todonotes depends on.

% ==================
% Part: Initial code
% ==================
% Here the default values are set

% ================================
% Part: The declaration of options
% ================================
% In this part the various options for
% the package are defined.

% Make it possible to disable the functionality
% of the package. If this option is given, the
% commands \todo{} and \listoftodos are defined
% as commands with no effect. (But you can still
% compile you document with these commands).

% The default style behaves bad when compiled
% with latex (some text placement problems).
% The dvistyle option, changes the visual behavior
% to avoid this text placement problem.

% Make the background color of the notes as
% an option.

% Make the color of the notes box color as
% an option.

% Make the text width as an option.

% Finally process the given options.

% ========================
% Part: The main code part
% ========================
% If the option "disable" was passed to the package
% define two empty commands.
% Define the list of todos command
{\section*{Todo list} \@starttoc{tdo}}

% Define styles used by the todo command
\tikzstyle{notestyle} = [
line width=0.5pt,
text width = \@textwidth - 1.6 ex - 1pt,
inner sep = 0.8 ex]
\tikzstyle{notestyleleft} = [notestyle]
\tikzstyle{connectstyle} = [
draw = \@backgroundcolor,

% Define the todo command
% Add to todo list
% Remember where we are
\begin{tikzpicture}[remember picture, baseline=-0.75ex]%
\node [coordinate] (inText) {};%
% Make the margin par
\marginpar {% Draw note in right margin
% Using dviStyle
\tikz[remember picture] \draw node[notestyle] {}; \\ %
\end{minipage} \\%
\tikz[remember picture] \draw node[notestyle] (inNote) {};%
\begin{tikzpicture}[remember picture, overlay]%
([yshift=-0.2cm] inText)%
-| ([xshift=-0.2cm] inNote.west)%
-| (inNote.west);%
% Using normal style (non dviStyle)
\tikz[remember picture] \draw node[notestyle] (inNote) {#1};%
\begin{tikzpicture}[remember picture, overlay]%
([yshift=-0.2cm] inText)%
-| ([xshift=-0.2cm] inNote.west)%
-| (inNote.west);%
\fi % Ending \ifdviStyle
\fi % Ending \ifdisabled

And the code for the sample document




\section{The text}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam quam
quam, sodales vel, iaculis at, varius fringilla, urna. Cras urna.
\todo{A simple ting to do.}%
Morbi lorem eros, ullam\-corper id, egestas ac, interdum eu, nunc. Nam
enim eros, sodales at, dapibus eget, semper nec, augue. Morbi orci
\todo{Something much more difficult to explain. So it takes several
lines in the todo note and in the list of to do's.}%
orci, tincidunt ac, pellentesque vel, facilisis et, dolor. Nunc nec
mauris eu felis fringilla dictum.

Donec ornare, mauris in posuere
faucibus, lacus enim luctus nibh, vitae vestibulum sapien purus id
nisl. Morbi non dolor non odio ornare faucibus. Proin in purus.
\todo{There is still something to update in this document.}%
Vivamus nulla sem, eleifend ac, lacinia suscipit, facilisis a, est.
Mauris vitae purus. Donec ullamcorper, magna vitae sodales semper,
elit diam adipiscing neque, quis mattis ante orci a orci. Mauris eu
mauris non arcu pharetra euismod. Duis non elit. Etiam faucibus,
mauris quis mollis lobortis, mauris sem feugiat dolor, sit amet
porta libero lectus non erat. Donec cursus pede in tellus. Fusce
egestas. Aenean ut nisl.

Fusce eu arcu. Aliquam ultrices, turpis in facilisis lobortis, enim
massa bibendum ante, id blandit purus sapien non eros. Aenean
sodales ante eu magna. Proin vestibulum dolor auctor erat. Maecenas
at neque. Fusce ante odio, sollicitudin eget, cursus condimentum,
egestas in, urna.

Suspendisse rutrum eros. Phasellus suscipit velit
non nunc. Donec sollicitudin erat non dui. Aenean nec turpis. Aenean
pellentesque porta ipsum. Mauris eget nulla eu nunc pellentesque
sollicitudin. Pellentesque lacus. Fusce vehicula orci quis libero.
Vivamus consequat. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Cras hendrerit elit. In
hac habitasse platea dictumst. Phasellus rhoncus massa non ipsum.


vagabon said...
This comment has been removed by the author.
Anonymous said...

thanks for the great library,
but when I try to compile the example it does not render right.

the notes are on the right spot and the right size, but the text doesnt fall in the box.

The textwidth settings are shown as orange text and the todotext is shown right of this.

i think things go wrong on this line: \begin{minipage}{\@textwidth}%

maybe this is something in my setup, i use midtex with pdflatex but i hope you can help

Henrik Skov Midtiby said...

# jos houtman
Have you tried to pass the 'dvistyle' option to the package? I introduced that option to fix the rendering when the document is compiled with latex instead of pdflatex.

> maybe this is something in my setup,
> i use midtex with pdflatex but i
> hope you can help
I haven't heard about the midtex distribution before, do you mean miktex instead?

Which editor do you use (texniccenter, texmaker, ?)

How did you compile the document (from the command line, inside your editor, ...).


Anonymous said...

I have tried the dvistyle option, that places the text more or less in the right position but the orange
boxes have become only one line.

I meant miktex and texniccenter, i compile from within the editor using the following command.

C:\Program Files\MiKTeX 2.7\miktex\bin\pdflatex.exe -interaction=nonstopmode "%pm"

if it helps i could send the result pdf that is generated from your example file.

Henrik Skov Midtiby said...

# jos houtman

Hi, i just tried to reproduce the problem and i see the same wrong behaviour as you do...

The problem is that I use the calc package, but the todonotes package does not require that (this will be fixed soon).

If you add the line
to the example it works as supposed.


Anonymous said...

Thanks, that solved the problem.

And thanks again for the great package.

erik said...

Hi, very nice package indeed.

However the notes look kind of screwed up using dvistyle

where the calc package does not make any difference.

using the same document and running pdflatex does produce the correct output.

Any hints?

Henrik Skov Midtiby said...

# Eric
> Hi, very nice package indeed.

> However the notes look kind of screwed
> up using dvistyle
When compiling a document with the latex command, the original layout of the todonotes are screwed. As a method to circumvent this screwed layout I introduced the dvistyle option. It makes a different layout (two orange bars with the todo test in between), but it is useable with both latex and pdflatex.

Is your document visual appearence (when using the dvistyle option) different when you compile it with latex and pdflatex respectively.


erik said...


indeed the result is different using latex and pdflatex while leaving dvistyle active in both cases. For pdflatex, the notes look as you described (two orange bars and the lines correctly drawn to the position in the text) while for plain latex the lines kind of point to nowhere in particular.



Henrik Skov Midtiby said...

# Eric

> indeed the result is different using
> latex and pdflatex while leaving
> dvistyle active in both cases.
Oki, I have now found a difference between a file compiled with latex and a file compiled with pdflatex.
With pdflatex the "Todo list" looks as intended, but with latex the items in the "Todo list" will not have line wraps even if the line is leaving the paper ...
I'll put that on my todo list ;-)

> ... while for plain latex the lines
> kind of point to nowhere in
> particular.
With the lines, I assume that you mean the lines that connects the insertion point of the todo (the location in the source where the \todo command is placed) and the showed note in the margin.

If the lines are disconnected from the notes in the margin, I have no clue of what went wrong.

If the end of the lines that should show where the note was inserted is floating around, the document has probably only been compiled once.

Try to compile your document two times. If the problem persists, I'll appreciate a small example tex file that triggers the problem.


Hans said...

I first had problems with multiply defined destinations:
! pdfTeX warning (ext4): destination with the same identifier
(name{equation2.2}) has been already used, duplicate ignored
or something like this in align environments.

Seems to have had something to do with the hyperref package.

Now I'm getting warnings "Marginpar in page X moved" and overfull hboxes.

Karthik said...

Hi, thanks for a great package.

I am using it with a class file specific to our university which is based on latex baseclass 'book'.

When I use the options "openany, oneside" (these options are passed to baseclass) every thing works fine.

However when I remove these options, todonotes on even numbered pages (pages on the left side) are out of margin. i.e I cannot see part of the text. When I tried to reduce the textwidth, todonotes on these pages were moving farther away to left. Also todonotes appear on the left side of the margin on these pages.

todonotes on the odd numbered pages appear fine.

Anyidea whats going on and how to fix it?

Right now its not a big issue, as I can use the above mentioned options to avoid this problem. However a fix would be great :).

thanks again.

Henrik Skov Midtiby said...

Hi Hans

For your first problem I don't know what has caused that. If you can give me a description of how I can reproduce the problem I will try to investigate it.
Your guess on a connection between the problem and the hyperref package makes sense, but I cannot test it without a test case ....

Your problem with the "Marinpar in page x moved" is probably caused by placing several todonotes on one page. If two todonotes (they are in fact marginnotes) are goin to overlap, latex will try to move the todonotes up and down on the page to avoid the overlap. To let the user know that the marginpars have been moved, the warning is issued.

Best Henrik

Henrik Skov Midtiby said...

# Karthik

> Anyidea whats going on and how to fix it?

Currently I have no idea for what thats going wrong. If you can give me enough information to reproduce the problem I will take a look on it.
The best clue I can get is a small document (include all the external files) that triggers the problem and a short description of what you observe and what you expect to observe.

Best Henrik

erik said...

Hi Henrik,

here is a bit of code which reproduces the problem I have. I did compile the document twice but the problems remains. Ah, "the problem" is indeed what you guessed, namely that the line which connect the todo box to the point in the text where the comment was placed are malformated.

I tried to check whether it is a problem with one of the headers I included, but commenting them all does not solve the problem. Also changing from report to article does not cure it.






Here is a long paragraph of text\todo{think of a more meaningfull
text} which should illustrate where the todo notes go or rather do
not go.

Henrik Skov Midtiby said...

# Erik
Thanks for the example. When I compile the example I get the result shown on
which I think is the right behaviour (agreed it is not the same as without the dvistyle option, but it could be used ...)

Is what you are seeing after compiling the example the same? If not, can you post an image of your result on imagebin and tell me a bit about your latex environment (os, latex distribution, used commands for compiling the example etc)


erik said...

Hi Henrik,

the output from the sample is located at

You can see what the problem is. What you posted would be perfectly fine for me. In this case it is a note on the right side, but the ones on the left side look pretty much the same.

I compile the example with
latex example.tex
latex example.tex
dvips example.dvi
and the output is what you see. I am using texlive 2005.dfsg.3-1 with ubuntu 7.04
Any other information that could be usefull?



pat toche said...

Hi Henrik,

This package is a great idea, thanks a lot.

I have pretty much managed to make it work, but I do get warning messages: I wonder what is the cause.

I use TexNicCenter.

I compile thus: latex->bibtex->makeindex->dvips->ps2pdf

I have the following options in my preamble (edited for concision):

... followed by your sample document

The warning message I get is:

Package xcolor Warning: Incompatible color definition on input line ...

In my document, the Warning message gets repeated over one hundred times, which is a little scary, though quite possibly harmless.

Any ideas what could be behind this ?

many thanks for your help, and again: great package!

pat toche said...

Hi Henrik,

Is there a way to combine inline and marginal notes?

I have in mind something like:

\todo{This is a short todo comment that should be shown in the margin}


\todo[inline]{This is a very long todo list that will not fit on the margin of a single page, because it is a very long todo list that will not fit on the margin of a single page, because it is a very long todo list that will not fit on the margin of a single page, because it is a very long todo list that will not fit on the margin of a single page, because it is a very long todo list that will not fit on the margin of a single page, because it isa very long todo list that will not fit on the margin of a single page, because it is}

Do you see what I mean?

I find that when I write todo notes to myself, some of them are quite lengthy: it's very nice to have them listed at the end of the document with \listoftodos, but it's impractical to have them repeated in the margin too.

many thanks!


pat toche said...

As a temporary workaround, I have done this:


I need to do some serious thinking about the game-theoretic aspects of the intrapersonal equilibrium game analyzed here. I do not really understand the differences, if any, between \cite{Strotz:1956}, \cite{Phelps:Pollak:1968}, \cite{Laibson:1994}, \cite{Kocherlakota:1996}, and others, though predictably I may not be quite ready to admit it outside a close circle of acquaintances. I follow \cite{Luttmer:Mariotti:2003}. }%

so that by making the font of the marginal note very small, I can squeeze in more text...

Henrik Skov Midtiby said...

# pat toche
Hi Patrick

Thanks for your response on the todonotes package.

I have tried to solve the problem with the incompatible color definitions by delaying the loading of the hyperref package in the todonotes package (see the attached file). It seems to work for me when the load order of the packages in the preamble is changed to the following.


Why the problem arises in the first place I don't know.

Furthermore I have added support for inline todonotes. The new version can be downloaded from

Best Henrik

erik said...


some more findings which might be usefull:

The lines to the position in the text look identical whether I use the dvistyle option (when compiling with latex), just the layout of the box changes (as expected)

Looking carefully at the output I found the following warning:

"Package pgf Warning: Your graphic driver pgfsys-dvips.def does not support marking the current position. This warning is given only once on input line 24."

which sounds as if it may have something to do with the problem.

The pfg version which is installed is 1.09, but I also tried to install a recent one and it didnt seem to help

best regards


Henrik Skov Midtiby said...

# Eric


I think that your problem is caused by an old latex distribution. This is supported by the manual for pgf version 2.00, that has the following note on the pgfsys-dvips.def driver (page 90):

For remembering of pictures (inter-picture connections) you need to use a recent version of pdftex
running in DVI-mode.

A solution could be to upgrade your latex distribution or to use the pdflatex command to compile your document (which may require some changes in the original document).


Patrick said...

Hi Henrik,

wow, this is great, thanks a lot.

In the meantime I found another work-around for the Warning message referred to above, and it consists in replacing the call to the "color" package with a call to the "xcolor" packgage:


worked even when placed before the call to the hyperref package

my document looks the same with the xcolor package, so there probably isn't a huge difference between color and xcolor

many thanks for posting the updated todo package, I'll test it right now!


Patrick said...

Hi Henrik,

I have tested the latest release on and it works very well with my system.

Thanks very much for providing this much-needed package.

I don't know how difficult it is to do (no pun intended), nor how much time and effort you intend to devote to the package, but here are some ideas for future developments:

based on the extremely useful (to me and no doubt other users) inline option of \todo[inline]{blablabla}
it would be great to be able to input other options likewise:



indicating the margin on which to print, especially useful when a lot of todos clutter the page at the early stages of writing.

and even perhaps:




\todo[list,show]{blablabla} (the default)
\todo[list,hide]{blablabla} (appears in \listodos but not in page)
\todo[list,mark]{blablabla} (appears in \listodos but not in page, instead a number signals the existence of a todo)
\todo[nolist]{blablabla} (appears on page but not in \listodos)



will not print a horizontal line


combining some of these fine options:


Even without these options, the package is great as it is, and I've been using it a lot since yesterday!!



Henrik Skov Midtiby said...

Hi Patrick

> I don't know how difficult it is to do
> (no pun intended), nor how much time
> and effort you intend to devote to the
> package, but here are some ideas for
> future developments:
First of all thanks for your feedback on the package, it is good to hear how other try to use the package.

My goal for this package is to make it easy to mark stuff that you know has to be worked on later. In addition I want the package to be as simple as possible (both in usage and implementation).

Your ideas can be divided in two groups (1) change of appearance and (2) functional stuff. Hints of the functional ideas is listed below:

\todo[list,show]{blablabla} \todo[list,hide]{blablabla}

When time permits I might try to implement some of this functional stuff. I doubt that I will use time to implement the change of appearance stuff, as I think it is unnecessary.


Patrick said...

Hi Henrik,

The concern for appearance was mainly for the following reasons:

1. character size: to be able to squeeze in more stuff if necessary.

2. color: this appeared useful, as some colors don't print well over an orange background; in my case, I use a brown color for citations, so it becomes invisible on an orange background.

I understand your concern for keeping the package simple though. Thanks for your help.


Henrik Skov Midtiby said...

Hi Patrick

Wouldn't it be better to have the appearance stuff given as options to the whole package when it is loaded?
For instance you can change the color of the background (default is orange) to an arbitrary color like this.
which changes the orange color to a light green. That might solve your problem with the brown cite color.

The color of the text could be changed in a similar way (currently it isn't implemented), but the color of citations and hyperlinks will still be determined by the hyperref package. (correct me if im wrong and it could be done, but i don't know how to do it now)

To alter the fontsize of todonotes is a good idea and I'll probably implement it as an option to the package but not on a per note basis.


Patrick said...

Hi Henrik,

my requirements are probably too specific; I have several kinds of notes in my documents:

for research papers:

- notes to myself of things to do ("find a simple illustration of this difficult concept")
- notes to co-author ("Peter, I leave it to you to update the table with the latest regression results") ("Paul, I leave it to you to check the proof of Proposition 1")
- notes to early readers of the draft ("do you find it useful to omit the proof or would you like to see the proof in the main body of the text?")

and for my lecture notes:
- notes to students ("You will be tested on this!")

I find it convenient to have different colors for notes to myself, notes to Peter, and notes to Paul.

For the notes to students, it's convenient to play around with fonts and colors, to vary degrees of emphasis.

I usually define my own box styles along the lines of:
and that's currently the most convenient way to deal with multi-colored notes. I usually stick them in the body of the text. I came to your todonotes package because I was looking at a way to move the notes to the margins, in order to have a better idea of the layout of the article, such as the number of pages, the size of a paragraph, etc. which is difficult to see when a paragraph has 4 or 5 inline notes to myself; so pushing these notes to the margin was great. The inline notes I usually keep for comments like "add a paragraph on this" or "this paragraph is to be reworded: blabla"

Perhaps you did not expect that your package would draw interest from such a wide array of people with such specific needs; it goes to show that your package fills a real need!

At any rate, thanks for your help and for sharing your code,


Henrik Skov Midtiby said...

Hi Patrick

Here is a new version with some of your ideas implemented. Currently there is no documentation of the new options, but try to take a look on the example where most of the new options are used.




Image of the compiled example:

Patrick said...

Hi Henrik,

Your updated todonotes package compiles wonderfully on my system (latex->bibtex->makeindex->dvips->ps2pdf) and produces a beautiful document. It is easy to use and serves my purpose perfectly.

I am sure that the LaTeX community will love this package: it should be advertised more widely at once!

I strongly recommend this package, it's simple, flexible, and very useful.

Many thanks Henrik for listening to our feedback and for putting together such great functionalities in such a short time.


pat toche said...

If you need to place a \todo in-between paragraphs, this works on my system:


erik said...

Hi Henrik,

my problem could indeed be solved by updating to a more recent texlive version, sorry for the unnecessary "bug" hunting.

I totally agree with Patrick, a great package which gets even more usefull with all the recent changes. Thanks a lot especially for being both responsive and patient.

One thing I realized is that the todonotes cannot be used in captions, probably because it uses in itself a picture environment.

Do you see any way to implement such a feature?

(Usecases are things like
\caption{The caption for this picture\todo{Find correct reference where the picture comes from}
\todo{Complete Caption}
\todo{Replace Picture}
} )



Florent B said...

Hi everybody,

I tried different packages of "todo"s before giving up and using a custom command using margin par.
But I came across todonotes this morning and really like the feeling of it. In particular the fact that I don't need to insert any "*" or such in the text to know where the todonote points to.

One regret is that it doesn't go well with xdvi but this is a more general annoying thing which goes with pgf/tikz if I understand.

As a few posters, I have a need of changing the colors (I have "todo" and "note", and each co-author can have it's color). So I hack a little the code. It seems to me that some people here can have a use of this.

I put it there since the diff dump but not that small:

Then one can use:

\todo[blue!20]{just a simple note}



and \note{my note}


Henrik Skov Midtiby said...

Hi Florent B

> As a few posters, I have a need of
> changing the colors (I have "todo"
> and "note", and each co-author can
> have it's color). So I hack a little
> the code. It seems to me that some
> people here can have a use of this.
I have just uploaded a newer version of the todonotes package (, which supports options for each todo command (like \todo[color=blue!40]{something to remember}, but you can changes much more that just the color ...)

In addition I think it is a very nice way to insert different looking notes by defining new commands for the different authors.


Granny Wax said...

works a treat---however, does not like being used in footnotes... (``float(s) lost'').

You may want to warn about the use in other floats (Not tested: marginpar, or inside a minipage environment, a \parbox or \footnote.)

Habi said...

thanks for the wonderful package, i've started to use it extensively with a new paper i'm preparing!

Ashish Jain said...

Thanks. It seems that it might prove to be really helpful while writing articles.

RHS said...

If you want to use todonotes inside a footnote, adding the following command to you LaTeX file seems to work:


You'll also need \usepackage{marginnote}

michael said...

Just started using it for my thesis and it is really great.

But I'm having problems with this document class:
For some reason the list of todos is not complete.

Therefore I just use \documentclass[draft]{article}
which does the job.

Henrik Skov Midtiby said...

# Michael

> But I'm having problems with this document class:
> \documentclass[preprint,prb,aps,floatfix,draft]{revtex4-1}
> For some reason the list of todos is not complete.
This is not what I would expect.
How is the list of todos not complete.
Is a single entry missing, half of the entries missing or ?

Can you provide a minimal working example that demonstrates

Best regards,

RennerC said...

Using it for my thesis with TeXlipse and works (still:) well! Great job, thx a lot!

RennerC said...


Maybe he ran into the "problem" that the toc lists need a second compile to show the actual content.

Benjamin Auffarth said...

Hi, this seems very useful. I've been searching for a bit for different options with todonotes. I am now using it together with the marginnote package, however I would like to have it in single spacing... AHHHH

Myra Shirey said...

good work..!!!
Cracked Software Download | serial number idm 6.25