todonotes 包通常会为整行添加下划线。我希望对此有更多的控制权。有没有简单的方法?
例如,我该如何编写一个待办事项,只在第二段中强调“第一”这个词?
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{todonotes}
\begin{document}
\todo{note 1. full line}
First paragraph. This is the first sentence of the first paragraph.
Second paragraph. This is the \todo{note 2. single word} first sentence of the second paragraph.
\end{document}
目前,第二条注释从“第一”处划线到行尾。
使用\todo[noline]{note 2. single word}
结果为:
并且单词 in 根本没有下划线。
答案1
编辑:添加了一个宏来一起进行突出显示和注释,当disable
给出选项时,两者都被禁用todonotes
。
该解决方案来自todonotes
文档的第1.8.13节,但略有改进(不占用以下空间)。
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{todonotes}
\usepackage{soul}
\makeatletter
\if@todonotes@disabled
\newcommand{\hlnote}[2]{#1}
\else
\newcommand{\hlnote}[2]{\todo{#2}\texthl{#1}}
\fi
\makeatother
\begin{document}
\todo{note 1. full line}
First paragraph. This is the first sentence of the first paragraph.
Second paragraph. This is the \hlnote{first}{note 2. single word} sentence of the second paragraph.
\end{document}