[Tex/LaTex] todonotes package causes badboxes

badnesstodonotes

I use the todonotes package in my document and I noticed that every todonote that goes into the margin (so all without the inline option) causes two badboxes and one warning:

Overfull \hbox (134.4429pt too wide) in paragraph at lines 121--121
[][][] 

Overfull \hbox (134.4429pt too wide) in paragraph at lines 121--121
[][][] 

LaTeX Warning: Marginpar on page 1 moved.

Although it is not that important, because I am planning to remove all the todos before the final version, it is kind of annoying to have this huge list of useless warnings one has to look through to find a real warning.

My MWE:

\documentclass[a4paper,11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{geometry}
\geometry{left=1cm, right = 7cm,vmargin={2.5cm,3cm}}

\usepackage[colorinlistoftodos, textwidth=6.5cm]{todonotes}

\begin{document}
text al asdf woaeiofjasdf lkdjfa dsf oj\todo{something asdf sla
alkdsjf dasj ew}
\end{document}

I made the margin extra wide so that all the todonotes fit nicely.

How can I turn off these warnings? I tried using the tips from the bad boxes question to no avail.

Best Answer

Yes, you increased the right margin, but that's not enough, since you didn't increase the width of the marginpar area (which is the area in which marginal notes (in particular, your notes) will be effectively typeset); you can set a value for marginparwidth in the settings for geometry and then use this value as the width for the notes:

\documentclass[a4paper,11pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[showframe]{geometry}
\geometry{left=1cm, right = 7cm,vmargin={2.5cm,3cm},marginparwidth=6cm}

\usepackage[colorinlistoftodos, textwidth=\marginparwidth]{todonotes}

\begin{document}
text al asdf woaeiofjasdf lkdjfa dsf oj\todo{something asdf sla
alkdsjf dasj ew}
\end{document}

enter image description here

The showframe option for geometry was added so you can have a visual representation of the page layout.