24

Is it possible to set the default style of todo notes by the latex todonotes package to inline to avoid mentioning inline everytime?

I imported the package into my latex document like this:

\usepackage[colorinlistoftodos,prependcaption,textsize=tiny]{todonotes}

and used it in the document like this:

\todo[inline]{New TODO comment}
3
  • 2
    The following, \let\svtodo\todo\renewcommand\todo[1]{\svtodo[inline]{#1}}, will allow you to do it by redefining the existing macro, but will not allow for any optional arguments. Dec 24 '14 at 13:20
  • \newcommand{\todoin}[2][]{\todo[inline,#1]{#2}}. Similar to Johannes_B solution but with optional arguments. More o less similar example is shown in todonotes documentation, page 15.
    – Ignasi
    Dec 24 '14 at 13:31
  • 5
    \setuptodonotes{inline} in my preamble does it for me.
    – Hotschke
    May 1 '19 at 11:26
11

Patching it into the original code:

\documentclass{article}
\usepackage{blindtext}
\usepackage[colorinlistoftodos,prependcaption,textsize=tiny]{todonotes}
\usepackage{regexpatch}
%\tracingxpatches%for debugging
\makeatletter
\xpatchcmd{\@todo}{\setkeys{todonotes}{#1}}{\setkeys{todonotes}{inline,#1}}{}{}
\makeatother
\begin{document}
\blindtext\todo{This should be inline}
\blindtext\todo[color=blue!20!white]{Is this blue?}
\end{document}

michaTodoDefault

Advantage: You can still use any optional argument.

2
  • Thanks for this quick response. You solved my problem. This will save me a lot of typing in future.
    – micha
    Dec 24 '14 at 13:38
  • How do I use a non-inline todo once I have changed the default?
    – AnnanFay
    Nov 24 '17 at 12:46
37

You can add more keys to the preset list:

\documentclass{article}
\usepackage[colorinlistoftodos,prependcaption,textsize=tiny]{todonotes}
\usepackage{blindtext}
\presetkeys%
    {todonotes}%
    {inline,backgroundcolor=yellow}{}
\begin{document}
\blindtext\todo{This should be inline}
\blindtext\todo[color=blue!20!white]{Is this blue?}
\end{document}
1
  • 11
    To simplify this answer, add one line after the usepackage: \presetkeys{todonotes}{inline}{}. Works well for me.
    – Liam
    Oct 8 '17 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.