如何添加待办事项?

如何添加待办事项?

有没有简单的方法可以向 LaTeX 文档添加待办事项注释?

我希望在生成的 pdf 中以红色显示这些注释,并使用简单的语法来编写它们。

答案1

有一个todonotes软件包使得添加注释变得非常简单。它们默认出现在页边空白处。

一个更简单的版本,如果您只想在文本主体中使用红色文本作为注释,只需定义一个\myworries使其参数变为红色的命令。

\documentclass{article}
\usepackage{xcolor}
\newcommand\myworries[1]{\textcolor{red}{#1}}
\begin{document}
Here is some text.
\myworries{But I'm worried about the text}
\end{document}

然后,如果您想隐藏评论,只需\renewcommand\myworries[1]{}在 下方添加一行\newcommand。这将隐藏您的所有注释。

第三个选项是使用 LaTeX 自己的\marginpar命令在页边空白处放置一个段落。这个选项不太好,但对于自己做些小笔记来说已经足够了。

Alan Munn 在评论中让我知道了另一个包todo这似乎比 更简单,todonotes但功能更强大\marginpar。不过我没有用过,所以我不太确定。

答案2

上述包todonotes可以定制以显示各种类型的注释。还可以创建所有注释的摘要,例如在文档末尾。以下是示例:

\documentclass{article}
\usepackage{lipsum}                     % Dummytext
\usepackage{xargs}                      % Use more than one optional parameter in a new commands
\usepackage[pdftex,dvipsnames]{xcolor}  % Coloured text etc.
% 
\usepackage[colorinlistoftodos,prependcaption,textsize=tiny]{todonotes}
\newcommandx{\unsure}[2][1=]{\todo[linecolor=red,backgroundcolor=red!25,bordercolor=red,#1]{#2}}
\newcommandx{\change}[2][1=]{\todo[linecolor=blue,backgroundcolor=blue!25,bordercolor=blue,#1]{#2}}
\newcommandx{\info}[2][1=]{\todo[linecolor=OliveGreen,backgroundcolor=OliveGreen!25,bordercolor=OliveGreen,#1]{#2}}
\newcommandx{\improvement}[2][1=]{\todo[linecolor=Plum,backgroundcolor=Plum!25,bordercolor=Plum,#1]{#2}}
\newcommandx{\thiswillnotshow}[2][1=]{\todo[disable,#1]{#2}}
%
\begin{document}
\pagestyle{empty}
\todo[inline]{The original todo note withouth changed colours.\newline Here's another line.}
\lipsum[11]\unsure{Is this correct?}\unsure{I'm unsure about also!}
\lipsum[11]\change{Change this!}
\lipsum[11]\info{This can help me in chapter seven!}
\lipsum[11]\improvement{This really needs to be improved!\newline\newline What was I thinking?!}
\lipsum[11]
\thiswillnotshow{This is hidden since option `disable' is chosen!}
\improvement[inline]{The following section needs to be rewritten!}
\lipsum[11]
\newpage
\listoftodos[Notes]
\end{document}

这将输出以下带有注释的文本:

带注释的文本

以下是摘要页面:

摘要

请注意\thiswillnotshow,使用标题中的选项可以禁用注释disable。这可用于全局关闭每种类型的注释。Todonotes 也可以用于表格和图形的标题中,但前提是inline这些注释中必须使用该选项。

答案3

查看包装cooltooltips。当光标位于“此文本”上时,会弹出蓝色窗口。

在此处输入图片描述

本示例的源代码:

\documentclass{article}

\usepackage{cooltooltips}
\usepackage{graphicx}
\usepackage{color}
\usepackage{hyperref}

\def\cool{\texttt{cool}}
\begin{document}

The \cool\ package enables a document to contain hyperlinks that pop
up a brief tooltip when the mouse moves over them and also open a
small window containing additional text.  \cool\ works only with
pdf\LaTeX\@.  Furthermore, the tooltips that \cool\ produces are much
less cool when viewed under older versions of Acrobat~($<7.0$) or the
current version of xpdf~(3.00) because they don't pop up the extra,
small window.  
\cooltooltip[0 0 1]{Example}{This is an example of a cool tooltip.  
Pretty cool, eh?}{http://www.ctan.org/}{Visit CTAN on the Web}{This text\strut} 
%
is an example of a cool tooltip (assuming
you're viewing this document with a sufficiently capable \textsc{pdf}
reader).  Move your mouse pointer over it and watch what happens.
Then, click on the link.  If your \textsc{pdf} reader is properly
configured it should launch a Web browser and send it to the
\textsc{ctan} home page.

\end{document}

答案4

为了避免提交带有待办事项注释的论文的风险,我抛出了一个警告,这样在编译时每个待办事项都会显示为警告。命令是

\newcommand{\todo}[1]{\textcolor{red}{TODO: #1}\PackageWarning{TODO:}{#1!}}

相关内容