mdframed
和之间是否存在不兼容性todonotes
?例如,试试这个:
\documentclass{article}
\usepackage{mdframed}
\usepackage{todonotes}
\begin{document}
\begin{mdframed}
x\todo{y}
\end{mdframed}
\end{document}
有什么技巧可以避免这种情况吗?
答案1
todonotes
使用\marginpar
浮动对象并且mdframed
不允许浮动;您可以使用以下inline
选项:
\documentclass{article}
\usepackage{mdframed}
\usepackage{todonotes}
\begin{document}
\begin{mdframed}
x\todo[inline]{y}
\end{mdframed}
\end{document}
\marginnote
另一个选择是从包中使用marginnote
,而不是\marginpar
在内部\@todonotes@drawMarginNoteWithLine
命令中使用:
\documentclass{article}
\usepackage{mdframed}
\usepackage{todonotes}
\usepackage{marginnote}
\makeatletter
\renewcommand{\@todonotes@drawMarginNoteWithLine}{%
\begin{tikzpicture}[remember picture, overlay, baseline=-0.75ex]%
\node [coordinate] (inText) {};%
\end{tikzpicture}%
\marginnote[{% Draw note in left margin
\@todonotes@drawMarginNote%
\@todonotes@drawLineToLeftMargin%
}]{% Draw note in right margin
\@todonotes@drawMarginNote%
\@todonotes@drawLineToRightMargin%
}%
}%
\makeatother
\begin{document}
\begin{mdframed}
x\todo{y}
\end{mdframed}
\end{document}