1

Based on the two examples here, the inline form of \todo is modified to allow truly inline todos. However, if the \todo is on a line by itself, a Bad space factor (0). error is generated (sometimes, see code below). Is there a way to have the command work in either context?

\documentclass[12pt]{article}

\usepackage[colorinlistoftodos]{todonotes}
%%%
%%% https://tex.stackexchange.com/questions/329701/todonotes-how-to-make-literally-inline-notes-without-line-breaks
%%%
\makeatletter 
\tikzstyle{inlinenotestyle} = [
    draw=\@todonotes@currentbordercolor,
    fill=\@todonotes@currentbackgroundcolor,
    line width=0.5pt,
    inner sep = 0.8 ex,
    rounded corners=4pt]

\renewcommand{\@todonotes@drawInlineNote}{%
        {\begin{tikzpicture}[remember picture,baseline=(current bounding box.base)]%
            \draw node[inlinenotestyle,font=\@todonotes@sizecommand, anchor=base,baseline]{%
              \if@todonotes@authorgiven%
                {\noindent \@todonotes@sizecommand \@todonotes@author:\,\@todonotes@text}%
              \else%
                {\noindent \@todonotes@sizecommand \@todonotes@text}%
              \fi};%
           \end{tikzpicture}}}%
\newcommand{\mytodo}[1]{\@todo[inline]{#1}}%
\makeatother

\begin{document}
This is \todo[inline]{fine}.

The following breaks if the line above is commented out.

\todo[inline]{a test}
\end{document}
1
  • You can use \leavevmode\todo[inline]{a test} (but it looks like a bug in todonotes placing of @esphack I think. (incidentally you are defining \mytodo but not using it Jan 13, 2018 at 20:56

1 Answer 1

2

You can use \leavevmode\todo[inline]{a test}

but it looks like a bug in todonotes placing of \@bsphack

Yyou are defining \mytodo (copied from the previous answer) but not using it, using \mytodo instead of \todo[inline] would also fix the problem as it avoids the use of \@bsphack.

You must log in to answer this question.

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