Recently I have received some ideas for improvements (thanks a lot!!!) of my todonotes package for latex. This has lead to a new version of the todonotes package with an improved handling of options (now for both the package and the individual todo command.)
The todonotes package lets you insert small notes in your latex document by the \todo{} command.
Options to the package:
- disable Make it possible to disable the functionality of the package. If this option is given, the
- colorinlistoftodos Show small boxes in the list of todos with the color of the inserted todonotes.
- dvistyle 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.
- color Sets the default background color of the todonotes
- bordercolor Sets the border color of the todonotes
- textwidth Sets the width of the todonotes
commands \todo{} and \listoftodos are defined as commands with no effect. (But you can still
compile you document with these commands).
Options to the todo command:
- color Sets the background color of the todonote
- size Changes the relative size of the todonote
- list / nolist (default: list) Toggles whether the todo item is shown in the list of todos
- inline / noinline (default: noinline) Toggles inline view of the todonote
- line / noline (default: line) Toggles a line that connects the insertion point of the todonote with the note in the margin
Known issues:
- Rendering differences between pdflatex and latex for items in the list of todos (latex do not break long lines, pdflatex does)
Source code and examples
todonotes.sty : http://pastebin.com/f749c073f (updated file) http://pastebin.com/f6a477b17 (original posted file)
exampledocument.tex : http://pastebin.com/f56db437a
47 comments:
Great package! Thanks!
However, if I activate the option disable I get the following error (pdflatex):
ERROR: Undefined control sequence.
--- TeX said ---
l.181 \ifinlinenote
I guess the \ifinline definition should be before the \ifdisabled branching.
Cheers,
# M.
Thanks for your feedback. I had forgotten to test the package throughly before it was uploaded initially. The bug has now been fixed and the blog post has been updated
Best
Henrik
Hi Henrik,
Just tested your updated version, and found no problem on my system.
I posted a slightly changed version of the sample document here
http://pastebin.com/m5c6d56d5
All the best,
Patrick.
How do I change the line spacing in a note?
Hi Jan
Currently it is not possible to alter the line spacing inside a todonote.
Best
Henrik
Not even with a nasty \baselinestretch hack? I don't know much about tikz so please forgive for this dumb question.
# Jan Michael
I have tried a few different things for altering the used linespacing but with no success.
Best
Henrik
#Jan Michal & Henrik Skov Midtiby, on altering the used linespacing
I might have found a solution to changing the line spacing when using normal style (non dviStyle).
If lines 210-211 and 239-240 of the package:
\tikz[remember picture] \draw node[notestyle, fill=\fillcolor]
(inNote) {\sizecommand #2};%
are replaced by:
\tikz[remember picture] \draw node[notestyle, fill=\fillcolor]
(inNote) {\parbox{\@textwidth - 1.6 ex - 1pt}{\sizecommand #2}};%
then following command used in the text:
\todo[size=\scriptsize\linespread{0.8}\selectfont]{A note written with scriptsize font and reduced linespacing}
will giva a note written in scrptsize and with reduced line spacing.
I have not paid much attention to testing this modification yet, so it may cause some side effects. Though it works for me so far.
Cordially,
Marek
Nice package! Thanks a lot.
There's one thing on my wishlist: having the todo boxes on the side bar alternate from left to right following even/odd pages.
The colorinlistoftodos option does not work properly for me, look at the log and erroneuos file here:
http://pastebin.com/m2ff984a6
Henrik -
Wow, this is a great package. I have recommended it to my colleagues...
However - is there any way to force the notes to be in the left margin? I am writing a dissertation with a custom document style (intended to be one-sided printing), and the left margin is larger than the right. I would love to move those notes to the left, and not have to force everything to inline.
Thanks in advance!
Kevin
# Ilham
It should be the default behaviour if you uses the documentclass book. If you use another bookclass you might be able to find a workaround by calling \reversemarginpar on every new page.
# mw
I will look on your problem. I suppose that you have used the example file that I supplied with the package.
May I ask on which system you have generated the error.
# oregonspecialk
You can try to insert the following command after the begin document
\reversemarginpar
Hej Henrik,
Pakken virker upåklageligt nu - ingen anelse om, hvad der gik galt den dag, vi talte sammen, men en genstart af computeren samt først en oversættelse af dokumentet helt uden pakke og noter, og så efterfølgende oversættelse med pakken, fik løst problemet.
Især inline-featuren er meget, meget praktisk, men i det hele taget er det en dejligt brugbar pakke. Et enkelt spørgsmål: Kan det lade sig gøre at ændre skriftstørrelse for samtlige noter? (Jeg har en tendens til at skrive laaaange kommentarer :) )
# Ane
Du kan ændre default tekst størrelsen i linie 136 i todonotes.sty
Prøv at ændre \normalsize til den størrelse kommando du gerne vil skifte til, f.eks. \tiny eller \footnotesize
\presetkeys
{todonotes}
{color=\@backgroundcolor, noinline,
line, list, size=\normalsize}{}%
Hi!
Yes, I am using these two files:
http://pastebin.com/f56db437a
http://pastebin.com/f749c073f
I am running a debian etch here. The pastebinned logfile shows specific versions of the stylefiles etc.
$ pdflatex --version
pdfeTeX using libpoppler 3.141592-1.21a-2.2 (Web2C 7.5.4)
kpathsea version 3.5.4
Copyright (C) 1997-2004 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea is copyright (C) 1997-2004 Free Software Foundation, Inc.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfeTeX using libpoppler copyright and
the GNU General Public License.
For more information about these matters, see the files
named COPYING and the pdfeTeX using libpoppler source.
Primary author of pdfeTeX using libpoppler: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Kpathsea written by Karl Berry and others.
More info on the versions:
ii latex-xcolor 2.09-1 Easy driver-independent TeX class for color
ii tetex-base 3.0.dfsg.3-5etch1 Basic TeX input files of teTeX
ii tetex-bin 3.0-30 The teTeX programs
ii tetex-extra 3.0.dfsg.3-5etch1 Additional TeX input files of teTeX
Thx for looking at it.
Great package, I just needed something fancy like that instead of simple colors in my latex ;)
I just added a little line of code:
\newcommand{\globaltodo}[1]{\addcontentsline{tdo}{todo}{Global: \protect{#1}}}
so that I can add a list of extra todos to my preamble without having a specific point in my document (e.g. check the index, fix all the captions, etc.)
# mw
I have seen on your submitted files and can see that our latex installations are producing some very different temporary files (especially the .tdo file).
My .tdo file is here http://pastebin.com/f49a69a83 and my .aux file is here http://pastebin.com/f2aae9576
great package, thank you!
is there an easy way to get it working for two-column layout?
Thilo
For two-column layout replace \textwidth with \columnwidth. See http://pastebin.com/f47fcb6be and http://pastebin.com/f319924d2. And i changed \marginpar to 0.6in and \marginparsep to 0.05in to get nice results for latex8 style.
The package is great! Thanks a lot!
Just one thing:
Long todo items (say > 20 words) mess up the todo list created by \listoftodos - lines are not wraped around and vanish.
Is there a workaround, other than disabling the todo item such that it is not added into the todo list?
# Holger
When using (oldstyle) latex i can reproduce the behavior that you describe, but when compiling the same document with pdflatex it works just as expected.
You as for a workaround. Currently I have no idea, but I'll think about it and may be able to make a fix.
Best
Henrik
Henrik, thanks a lot for your feedback.
pdflatex does it right!
I thought about a solution, and perhaps it is a feature for the package, when someone wants to write a long todo with a brief description:
\newcommand{\todowithcaption}[2]{\addcontentsline{tdo}{todo}
{\protect{#1}} \todo[nolist]{\underline{\textbf{#1}}:\\#2}}
Holger
# Holger
I like your idea, but might change the implementation a bit. I dont like to make a lot of new commands, but prefer to add options to existing commands ...
Would a syntax like below be usable?
\todo[caption={A short description}]{The long a very detailed description \ldots}
Henrik
# Henrik
Yes, this would be fine! Please, tell me when you have the patch finished...
Thanks a lot,
Holger
# Holger
You can download the updated todonotes package from ctan.
Best
Henrik
http://www.ctan.org/tex-archive/help/Catalogue/entries/todonotes.html
#Henrik
Thanks a lot for the update. The new command syntax is great!
Just one comment. When I am using the caption command I always write the text of the caption again in the todo text. It would be much more comfortable if the caption is automatically repeated e.g. as the headline of the todo.
Best regards,
Holger
hey!
thanks for the great package. sometimes i get non-resolvable errors with in combination with the "hyperref"-package using htlatex (my boss wants a .doc :( ). any idea on how to resolve this? (email me for details, i'd love to help!)
# Habi
> sometimes i get non-resolvable errors
> with in combination with the
> "hyperref"-package using htlatex
Can you post a small example that (at least sometimes) triggers the problem?
Currently I have no idea of how to resolve your problem, but an example might help.
Henrik
hey henrik.
my (not so) minimal example can be found here: http://pastebin.com/d5d3fce85
like this it works with htlatex (the images don't appear, but that's not the point)
if you uncomment lines 8 and 9, and comment 12-16 htlatex chokes somewhere on the caption. that's as far as I've been able to nail it down.
does that help?
> I have tried a few different
> things for altering the used
> linespacing but with no success.
Did you try to ask on the PGF/TikZ mailinglist whether they could help you with this problem? I really like your package and would appreciate to see this solved. I have to use onehalfspacing in my document and it's quite ugly having margin notes with reduced font size and same big line spacing as in the main text. :-(
# lespocky@web.de
Hi I haven't talked with the pgf news group, but found the "setspace" package that can do the job.
Add the following two commands to your preamble
\usepackage{setspace}
\newcommand{\smalltodo}[2][]{\todo[#1, caption={#2}]{\begin{spacing}{0.5}#2\end{spacing}}}
And you will be able to insert todos with an altered linespacing with the command (change the constant 0.5 in the second command above to what ever you need)
\smalltodo[size=\tiny]
{Morbi dui. Morbi convallis mi sed sem.
Nulla convallis lacus vitae risus. Phasellus adipiscing. Nullam
tortor. Sed laoreet aliquam ante.
}
Problem solved?
Best
Henrik
I already use setspace for the rest of the document. I was on the right way, I had tried \begin{singlespacing} and \end{singlespacing} and this didn't work. Your hint to use \begin{spacing}{0.8} did the trick. Thanks for the hint. :-)
I can't seem to get this to work...
I get the error:
Package tikz Error: I do not know what to do with the option ``remember picture''.
If I ignore the error tikz gives similar error but with other options.
Ever seen this before?
Mr. Tree wrote
> I get the error:
> Package tikz Error: I do not know
> what to do with the option
> ``remember picture''.
> If I ignore the error tikz gives
> similar error but with other options.
> Ever seen this before?
Yes, it might indicate that your version of latex is outdated. (you shouldn't have the problem if you use pdflatex ...)
Section "9.2.2 Producing PDF Output" in the tikz manual [1], states
that the driver "pgfsys-dvipdfm.def" used by latex (not pdflatex)
requires a recent version to be able to use the remember picture
option.
Best
Henrik
[1] http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf
I'm using pdflatex so it shouldn't be an issue.
I wonder if it's due to an out of date version of the pgf package.
I have 1.01-1 via fink (on OS X), I've tried installing 2.00 but, because it's not on in the fink repository, it's proving a pain to install manually...
Yes, looks like it was outdated.
Installed 2.00 correctly and no longer get that error.
I have a new error now :)
On the 2nd compile:
) (./todonotesexample.tdo
! Missing { inserted.
<to be read again>
\kern
l.1 ...box \z@ }}Plain todonotes.}}{1}{section*.2}
# Mr Tree
... compile problem ...
Hi
To investigate the problem I need to know which version of the todonotes package you use and the document you are compiling (I suppose it is the example document).
Can you compile the document with the \listoftodos command disabled? It seems like it is that command that triggers the error.
Best
Henrik
Henrik,
I'm using the latest version from ctan. I'm trying to compile the example.
Initial compile works just fine and if I comment out \listoftodos the notes display correctly.
Quick addition; removing 'colorinlistoftodos' from the options allows it to compile correctly.
Is it possible to add priority to todos in order to print the list of todos sorted by priority?
#ps
I'm not aware of how to add priorities to the individual todonotes. In principle it should be possible to let latex sort the todonotes according to any given key (such as priority, page number, ...); but I'm not able to implement it myself.
One alternative could be to mark the high priority todonotes with a special color, but it is not exactly what you are looking for.
Best
Henrik
I've also decided to mark priorities with colors. It works good, but not if one has too many todo notes.
I haven't tried to do any serious programming in LaTeX, so I don't know how it could be implemented too.
Anyway, thanks for this great package!
Beautiful! Thanks a bunch dude! :)
This is a great package!
Does anyone know how to implement a todo / todonote from within the enumerate environment, such that it does not add an extra space?
What I have so far is:
\begin{enumerate}
\item bla
\todo[noline]{$\star$}
\item bla bla
\end{enumerate}
thanks.
# Susan
I have just compiled your code sample, but cannot locate where the extra space is inserted?
Is the problem apparent in the output from the following small tex document?
Best regards,
Henrik
\documentclass{article}
\usepackage{todonotes}
\begin{document}
\begin{enumerate}
\item bla
\todo[noline]{$\star$}
asdf a
\item bla bla
\end{enumerate}
\begin{enumerate}
\item bla
\todo{$\star$}
asdf a
\item bla bla
\end{enumerate}
\begin{enumerate}
\item bla
asdf a
\item bla bla
\end{enumerate}
\end{document}
Post a Comment