## Thursday, May 15, 2008

### Updated todonotes package

The package has been updated, find the new version at http://midtiby.blogspot.com/2008/07/todonotes-version-2008-07-28.html.

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.

Best
Henrik

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.


And the code for the sample document

\documentclass{article}\usepackage[colorlinks]{hyperref}\usepackage{todonotes}\begin{document}\listoftodos\section{The text}Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam quamquam, 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. Namenim eros, sodales at, dapibus eget, semper nec, augue. Morbi orci\todo{Something much more difficult to explain. So it takes severallines in the todo note and in the list of to do's.}%orci, tincidunt ac, pellentesque vel, facilisis et, dolor. Nunc necmauris eu felis fringilla dictum. Donec ornare, mauris in posuerefaucibus, lacus enim luctus nibh, vitae vestibulum sapien purus idnisl. 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 eumauris non arcu pharetra euismod. Duis non elit. Etiam faucibus,mauris quis mollis lobortis, mauris sem feugiat dolor, sit ametporta libero lectus non erat. Donec cursus pede in tellus. Fusceegestas. Aenean ut nisl.Fusce eu arcu. Aliquam ultrices, turpis in facilisis lobortis, enimmassa bibendum ante, id blandit purus sapien non eros. Aeneansodales ante eu magna. Proin vestibulum dolor auctor erat. Maecenasat neque. Fusce ante odio, sollicitudin eget, cursus condimentum,egestas in, urna. Suspendisse rutrum eros. Phasellus suscipit velitnon nunc. Donec sollicitudin erat non dui. Aenean nec turpis. Aeneanpellentesque porta ipsum. Mauris eget nulla eu nunc pellentesquesollicitudin. Pellentesque lacus. Fusce vehicula orci quis libero.Vivamus consequat. Cum sociis natoque penatibus et magnis disparturient montes, nascetur ridiculus mus. Cras hendrerit elit. Inhac habitasse platea dictumst. Phasellus rhoncus massa non ipsum.\end{document}

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, ...).

Best
Henrik

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
\usepackage{calc}
to the example it works as supposed.

Best
Henrik

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

(\usepackage{calc}
\usepackage[dvistyle]{todonotes})
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.
Thanks!

> 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.

Best
Henrik

erik said...

Hi,

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.

cheers

Erik

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.

Best
Henrik

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.

....

cheers

Erik

\documentclass[a4paper,twoside,11pt]{report}
\usepackage[latin1]{inputenc}
\usepackage{slashbox}
\usepackage{slashed}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{capt-of}
\usepackage{amsmath,amstext,amssymb}
\usepackage{rotating}
\usepackage{lscape}
\usepackage{fancyhdr}
\usepackage[german,english]{babel}
\usepackage{subfig}
\usepackage{amsmath}
\usepackage{xspace}
\usepackage{calc}
\usepackage[dvistyle]{todonotes}

\begin{document}

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.
\end{document}

Henrik Skov Midtiby said...

# Erik
Thanks for the example. When I compile the example I get the result shown on http://imagebin.org/22122
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)

Best
Henrik

erik said...

Hi Henrik,

the output from the sample is located at
http://imagebin.org/22124

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?

regards

Erik

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):

\documentclass{article}
\usepackage[dvipsnames]{color}
\definecolor{webbrown}{rgb}{.6,0,0}
\usepackage[
]{hyperref}
\usepackage{todonotes}
\begin{document}
... 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}

while:

\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!

patrick

pat toche said...

As a temporary workaround, I have done this:

preamble:
\usepackage{relsize}

text:
\todo{%
\relsize{-5}{%
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}. }%
}%
\vspace{-10pt}

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.

\usepackage[dvipsnames]{color}
\usepackage{todonotes}
\definecolor{webbrown}{rgb}{.6,0,0}
\usepackage[
]{hyperref}

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 http://pastebin.com/f3ed5e6e6

Best Henrik

erik said...

Henrik,

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

Erik

Henrik Skov Midtiby said...

# Eric

Hi

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).

Best
Henrik

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:

\usepackage{xcolor}

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.

Patrick said...

Hi Henrik,

I have tested the latest release on http://pastebin.com/f3ed5e6e6 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:

1.

\todo[right]{blablabla}
\todo[left]{blablabla}

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[top]{blablabla}
\todo[bottom]{blablabla}

2.

\todo[scriptsize]{blablabla}
\todo[tiny]{blablabla}
\todo[huge]{blablabla}
\todo[orange]{blablabla}
\todo[white]{blablabla}

3.

\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)

4.

\todo[noline]{blablabla}

will not print a horizontal line

5.

combining some of these fine options:

\todo[list,mark,left,red,small]{blablabla}

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

thanks,

Patrick.

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}
\todo[list,mark]{blablabla}
\todo[nolist]{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.

Best
Henrik

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.

Patrick.

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.
\usepackage[color=green!50]{todonotes}
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.

Best
Henrik

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:
\definecolor{mygreen}{cmyk}{0.5,0,0.8,0}
\newcommand*\mygreenbox[1]{%
\fcolorbox{black}{mygreen}{\hspace{1em}#1\hspace{1em}}}
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,

Patrick.

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.

Best
Henrik

todonotes.sty:
http://pastebin.com/f2b47566f

exampledoc.tex:
http://pastebin.com/f3c17b34c

Image of the compiled example:
http://imagebin.org/22558

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.

Patrick.

pat toche said...

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

\text{}\todo[inline]{blabla}

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}
} )

regards

Erik

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:

http://perso.ens-lyon.fr/florent.bouchez/todonotes-cols.sty

Then one can use:

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

or

\newcommand{\note}[1]{%
\todo[blue!20]{#1}%
}

and \note{my note}

Florent

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 (http://midtiby.blogspot.com/2008/07/todonotes-version-2008-07-28.html), 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.

Best
Henrik

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:

\renewcommand{\marginpar}{\marginnote}

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:
\documentclass[preprint,prb,aps,floatfix,draft]{revtex4-1}
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,
Henrik

RennerC said...

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

RennerC said...

@Henrik/Michael:

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