4

Im using todonotes package and run in to a problem with it, when in a Table. I get a Float(s) lost error. How can i use todonotes package in a tablecell?

MWE:

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage{ifthen}
    \usepackage{xkeyval}
    \usepackage{xcolor}
    \usepackage{tikz}
    \usetikzlibrary{positioning} 
    \usepackage{calc}
    \usepackage[
    german,
    textsize=tiny
    ]{todonotes}
    \usepackage{showframe}
    \usepackage{lipsum}
    \begin{document}
    \lipsum[1]
    some more text
    and \todo[fancyline]{PSP Nr.} some more 
     \lipsum[2]
    \begin{table}[htp]
      \caption{default}
      \begin{center}
        \begin{tabular}{p{4cm}p{7cm}}
          narrow text in table & some more narrow text in table\\
          narrow text in table1 & some more %\todo[fancyline]{PSP Nr.} % <-- include this
          narrow text in table1\\
        \end{tabular}
      \end{center}
      \label{default}
    \end{table}%
    \end{document}
5

The basic problem is that you try to place a float inside of a float. You could use the workaround for footnotes (which are also floats) presented in the todonotes-documentation, loading the marginnotes-package and replace \marginpar with \marginnote:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{ifthen}
\usepackage{xkeyval}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning} 
\usepackage{calc}
\usepackage[
german,
textsize=tiny
]{todonotes}
\usepackage{showframe}
\usepackage{lipsum}

%important part starts here
\usepackage{marginnote}
\renewcommand{\marginpar}{\marginnote}

\begin{document}
\lipsum[1]
some more text
and \todo[fancyline]{PSP Nr.} some more 
 \lipsum[2]
\begin{table}[htp]
  \caption{default}
  \begin{center}
    \begin{tabular}{p{4cm}p{7cm}}
      narrow text in table & some more narrow text in table\\
      narrow text in table1 & some more\todo[fancyline]{PSP Nr.} % <-- include this
      narrow text in table1\\
    \end{tabular}
  \end{center}
  \label{default}
\end{table}%
\end{document} 

enter image description here

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.