32

I'm creating a presentation using beamer and I would like to denote bits that need to be done later using the todonotes package. But there appears to be some conflict between the two packages. I get errors of the form

! LaTeX Error: Float(s) lost.

I'm guessing this is because the slides don't have a margin in which to place the todo bubbles. What's the best way to get around this? I'm looking for something easier than manually adding the inline option to every use of \todo.

2
  • 3
    Beamer doesn't support floats, which don't make sense in a presentation. Marginpars are floats, so as long you can't stop todonotes to use them you wont come far. Feb 28, 2011 at 18:46
  • 1
    @Martin: ok, thanks, so I guess the question boils down to finding the best way to automatically add the inline option to every instance of \todo.
    – David Z
    Feb 28, 2011 at 19:07

3 Answers 3

39

You can change the presets of the package so that it creates inline todonotes by default. In order to do this, just add the line \presetkeys{todonotes}{inline}{} after you have loaded todonotes (you may also need to add xkeyval to make the \presetkeys macro available):

\documentclass{beamer}

\usepackage{xkeyval}
\usepackage{todonotes}
\presetkeys{todonotes}{inline}{}

\begin{document}
\begin{frame}
    \todo{Notes are inline by default now.}
\end{frame}
\end{document} 
2
  • 1
    This causes weird errors while the other solution is fine. Can't be bothered to find out the exact problem, just wanted to add this as a caveat for future googlers.
    – fifaltra
    Jan 29, 2014 at 23:55
  • 1
    For recent versions of todonotes, just \usepackage{todonotes} \setuptodonotes{inline} works (at least for me). Oct 19, 2022 at 12:39
8

Now I feel silly, because almost immediately after posting the question I had an idea:

\usepackage{todonotes}
\let\todox\todo
\renewcommand\todo[1]{\todox[inline]{#1}}

This redefines \todo as \todo[inline], at the expense of not allowing any other options to be given to \todo, which works fine for me. Though I still welcome more flexible solutions if they are out there.

3
  • 2
    This should allow additional options (as long \todo accepts empty options, i.e. a trailing ,): \renewcommand\todo[2][]{\todox[inline,#1]{#2}} Feb 28, 2011 at 19:15
  • You can define your command to be \renewcommand\todo[2][]{\todox[inline,#1]{#2}}. That way, you can pass more options.
    – fabikw
    Feb 28, 2011 at 20:08
  • I'm trying to do something similar @fabikw. The only difference is that I want to create an optional name. The code I tried was: \let\todox\todo \renewcommand\todo[2][]{ \todox[inline,color={red!100!green!33},size=\footnotesize]{\textbf{Comment [#1]:}~#2}% } In the argument 1, it shall be possible to write an optional name. But this will not build. I had to cancel it, because it was getting nowhere. Any ideas?
    – aloevgaard
    Feb 3, 2015 at 16:52
3

Another option to inline todonotes by default, based of diabonas' answer, but this one doesn't require additional packages:

\documentclass{beamer}

\usepackage{todonotes}
\setuptodonotes{inline}
% can add other options here, e.g. \setuptodonotes{inline, color=red}

\begin{document}
\begin{frame}
    \todo{Notes are inline by default now.}
\end{frame}
\end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .