Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrbook: inline todonotes and parfillskip lead to overfull \hbox #38

Open
kiryph opened this issue Jan 27, 2019 · 4 comments
Open

Scrbook: inline todonotes and parfillskip lead to overfull \hbox #38

kiryph opened this issue Jan 27, 2019 · 4 comments

Comments

@kiryph
Copy link

kiryph commented Jan 27, 2019

Consider this MWE todonotes-2019.tex:

\documentclass[
  % parskip=half,  % 1em; overfull \hbox \hbox (10.45003pt)
  % parskip=half*, % .25\linewidth; Overfull \hbox (104.06389pt too wide)
  parskip=half+,   % 0.33333\linewidth; Overfull \hbox (138.90363pt too wide)
  % parskip=half-, % No overfull \hbox
  % parskip=false, % No overfull \hbox (default)
]{scrbook}
\usepackage{todonotes}

\begin{document}
\the\parfillskip
\todo[inline]{hello}
\end{document}

Run pdflatex and filter output with texfot (perl program preinstalled with TeXLive 2018)

❯ texfot pdflatex todonotes-2019.tex
/Library/TeX/texbin/texfot: invoking: pdflatex todonotes-2019.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
Overfull \hbox (138.90363pt too wide) in paragraph at lines 14--14
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
Output written on todonotes-2019.pdf (1 page, 15440 bytes).

❯ grep "Package: todonotes" *.log
Package: todonotes 2019/01/24 v1.1.2 Todonotes source and documentation.
Package: todonotes 2018/11/22

❯ grep "Document Class: scrbook" *.log
Document Class: scrbook 2018/12/30 v3.26a KOMA-Script document class (book)

IMHO the overfull \hbox is an unnecessary overfull \hbox which is probably only produced because the inline todonotes take the full linewidth and then \parfillskip is added.

Can this easily be fixed?

@Mastermindaxe
Copy link

Any updates on this? Running into the same problem. It makes it a real hassle to use the package.

@Sebastian-Maier
Copy link

This also affects me. Any updates on this?

@FrankMittelbach
Copy link

Not checked what scrbook really does, but the fact the the todonotes use \linewidth seems technically correct.

\makeatletter
\tikzstyle{inlinenotestyle} = [%
    notestyle,%
    text width=\@todonotes@inlinewidth -\parfillskip - 1.6 ex - 1 pt]%
\makeatother

The above avoids the overfull box, but this is not something I think todonotes should set in this way. My guess is that whatever happens here is confusing tikz and todonotes is just the carrier.

@HoroTW
Copy link

HoroTW commented Mar 19, 2022

Since I was bothered by another effect where the inlinewith led to an overfull \hbox, I looked at the package and found a quick solution:
You can define the inlinewidth as an option for the todo \todo[inline,inlinewidth=0.9\textwidth]{this is the todo text}.
Not wanting to repeat this every time, I searched a little further and found that I can set a default key for this property.

TLDR; you might not want to try this if your inline todonotes are creating overfull hboxes:

\presetkeys{todonotes}{inlinewidth=0.9\linewidth}{}

You could also use an xpatchcmd ... but the presetkey is imho much cleaner.

\makeatletter
\xpatchcmd{\@todo}{\setkeys{todonotes}{#1}}{\setkeys{todonotes}{inlinewidth=\linewidth-13pt,#1}}{}{}
\makeatother

Hope this helps someone ^^
~Horo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants