3

When using the todonotes package, it doesn't seem to place margin notes intelligently when they're referring to a piece of text just before a page break. If I have some text like

When using the todonotes package, it doesn't seem to place margin notes
 intelligently\todo{when they're referring to a piece of text 
just before a page break.} If I have some text like

And the \todo environment text is long, the package will insist on putting the marginale box at or below the line with intelligently, even if this means that it gets cut off by the page border.

This is a major recurring problem every time I want to use this package, and I always end up just using \todo[inline]{ envs instead to deal with it. Is there a better way?

1 Answer 1

3

Notes are always placed at the level of the line containing the note, so I would just use inline notes except for very small notes.

Other option could be use shorter notes, or smaller fonts, or bigger right-bottom margins and \marginparwidth to make wider notes, and when all of this is not enough, it seems that you can also displace the note without problems (except compiling twice to point correctly to text) with just two \vspaces as showed in the example, That is a manual adjustment but it is easy, and it can be simplified with a macro (I left as exercise).

As todonotes is tikz-based, probably there are also some undocumented way to do that via command options, or make todonotes more clever, but I have not time nor experience to get into that minefield.

mwe

\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage[tickmarkheight=.5em,textwidth=\marginparwidth,textsize=small]{todonotes}
\begin{document}
\lipsum[1]\todo[prepend,caption={Normal note}]{\lipsum[1][1]}
\color{olive} % to highlight the place where 
              % the \todo command should point.
\lipsum[2]
\lipsum[3]
\lipsum[4]
% \todo{\lipsum[2][1-5]} ooops!
 {\vspace{-18em}\marginparwidth1.5in \todo[size=footnotesize]{\lipsum[2][1-5]} \vspace{18em}} % ok!
\color{blue}\lipsum[5][1-5]\todo{foo}\color{green}\lipsum[5][1-5]
\end{document}
2
  • 1
    Looks like the {-vspace, todo, vspace} trick does it. It seems to me that this should be done automatically by the package so everything gets onto the page (assuming the margin is tall enough) the way Word does, but it's good to know conclusively that there isn't such an automatic option; thanks.
    – tsbertalan
    Commented Dec 24, 2022 at 19:20
  • 1
    \newcommand{\raisedTodo}[3]{{\vspace{-#1}\todo[#3]{#2}\vspace{#1}}} % \raisedTodo{18em}{Here's a handy macro version.}{linecolor=blue,backgroundcolor=cyan}
    – tsbertalan
    Commented Dec 24, 2022 at 19:34

You must log in to answer this question.

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