我使用该todonotes
软件包来跟踪需要由不同人员完成的工作。目前,我使用前缀和颜色来跟踪谁负责什么。但是,我更希望为所有参与人员提供单独的列表。我还没有找到todonotes
可用于实现此目的的软件包选项 - 使用此软件包或其他软件包是否可行?
编辑:我只需要选出待办事项的一位“所有者”。可以将这些事项写入单独的文件,然后对其进行处理以生成单独的输出文档。有办法解决此类问题吗?
梅威瑟:
\documentclass{article}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{lipsum}
\newcommand{\alicetodo}[1]{\todo[color=green!40]{Alice: #1}}
\newcommand{\bobtodo}[1]{\todo[color=blue!40]{Bob: #1}}
\begin{document}
\lipsum[1]
\alicetodo{Foo}
\lipsum[2]
\bobtodo{Bar}
\lipsum[3]
\alicetodo{Baz}
\lipsum[4]
\bobtodo{Boo}
\listoftodos
\end{document}
答案1
为了解决这个问题,我回答了标记草稿文本的可靠方法是什么?并将其推广到多个 TODO 列表。要实现此功能,用户必须提前声明 TODO 项的收件人,如下所示:
\addTODOpointer{Steven}{blue}
\addTODOpointer{Peter}{red}
\addTODOpointer{Paul}{cyan!80}
颜色将用于识别该人的项目。然后,在文档的过程中,用户可以发出类似
\TODO{Steven}{blah blah...}%
这将在文本中的该位置以适当的颜色进行简写,以“A”表示第一项,“B”表示下一项,依此类推。在文档结束时,可以逐个收件人回顾 TODO 列表内容,例如使用
\clearpage
\showTODOs{Steven}
\showTODOs{Peter}
\showTODOs{Paul}
结果显示在下面的 MWE 中。TODO 使用宏\markabove
和\markbelow
,它们可以在 TODO 设置之外单独使用。这两个宏将颜色作为可选参数,将水平对齐作为第一个强制参数,将符号本身作为第二个参数。
\documentclass{article}
\textheight=4.5in
\usepackage{xcolor}
\usepackage{stackengine}
\setstackgap{L}{.5\baselineskip}
\newcommand\markabove[3][orange]{{\sffamily\color{#1}\hsmash{$\uparrow$}%
\smash{\toplap{#2}{\scriptsize\bfseries#3}}}}
\newcommand\markbelow[3][orange]{{\sffamily\color{#1}\hsmash{$\downarrow$}%
\smash{\bottomlap{#2}{\scriptsize\bfseries#3}}}}
\usepackage{ifthen}
\newcounter{TODOpointers}
\newcommand\addTODOpointer[2]{%
\stepcounter{TODOpointers}%
\newcounter{todoindex\romannumeral\theTODOpointers}%
\setcounter{todoindex\romannumeral\theTODOpointers}{0}%
\expandafter\gdef\csname TODOname\romannumeral\theTODOpointers\endcsname{%
#1}%
\expandafter\gdef\csname TODOcolor\romannumeral\theTODOpointers\endcsname{%
#2}%
\edef\tmp{\theTODOpointers}%
\expandafter\edef\csname #1TODO\endcsname{\tmp}%
}
\newcommand\TODO[2]{%
\edef\thenameindex{\csname #1TODO\endcsname}%
\stepcounter{todoindex\romannumeral\thenameindex}%
\def\thetmp{\csname thetodoindex\romannumeral\thenameindex\endcsname}%
\expandafter\gdef%
\csname todo.\thenameindex.\romannumeral\thetmp\endcsname{#2}%
\markabove[\csname TODOcolor\romannumeral\thenameindex\endcsname]%
{c}{\Alph{todoindex\romannumeral\thenameindex}}%
}
\newcounter{index}
\newcommand\showTODOs[1]{%
\edef\thenameindex{\csname #1TODO\endcsname}%
\def\thetmp{\csname thetodoindex\romannumeral\thenameindex\endcsname}%
\vspace{5ex}\noindent%
\rule{10ex}{.5ex}\textcolor{%
\csname TODOcolor\romannumeral\thenameindex\endcsname}%
{\csname TODOname\romannumeral\thenameindex\endcsname's %
TO-DO LIST}\rule{10ex}{.5ex}\par\noindent%
\setcounter{index}{0}%
\whiledo{\value{index} < \value{todoindex\romannumeral\thenameindex}}{%
\addtocounter{index}{1}%
\markabove[\csname TODOcolor\romannumeral\thenameindex\endcsname]{c}%
{\Alph{index}} %
\csname todo.\thenameindex.\romannumeral\theindex\endcsname\\%
}\par%
}
\addTODOpointer{Steven}{blue}
\addTODOpointer{Peter}{red}
\addTODOpointer{Paul}{cyan!80}
\begin{document}
When writing documents\footnote{Note,
\TODO{Peter}{This note is intended for you}%
this is a copy of the OP's
\markbelow{c}{That is the name for the questioner}%
text}, I like to 'mark up'
\markabove{c}{Does anybody know what he means by this?}%
draft/partial text (e.g., short summaries
\TODO{Steven}{I am using the TODO macro for longer notes that
do not fit into a single line, or are otherwise inconvenient
to make short}%
of what will go in a section) so that I can clearly
\TODO{Paul}{is it really the case that you can clearly see it?}%
see what needs to be
adjusted. I know that things like the todonotes package exist
\TODO{Paul}{I would like to learn more about this package.
Please fill me in}%
(see this question, for example), but I want something
\markbelow{r}{, anything actually,}%
that can span arbitrary parts of the document (e.g., multiple
paragraphs or even sections with whatever text is in there).
I have been using the color package's \verb|\color| 'switch'
\TODO{Steven}{I presume you actually meant that you are using
the \textsf{xcolor} package, since it improves upon the
functionality of the former package.}%
to do this (with an alternate \verb|\textcolor| based
command for short inline bits of text), with commands like this:
\begin{verbatim}
\usepackage[usenames,dvips]{color}
\newcommand{\TODOo}[1]{\textcolor{Purple}{#1}}
\newcommand{\startToDo}{\color{Purple}}
\newcommand{\stopToDo}{\color{Black}}
\end{verbatim}
However, this has problems in various situations (such as
footnotes, URLs, tables),
\TODO{Peter}{Exactly what kind of problems is he referring
to here? I'd like a write up in the morning.}%
some dependent on the particular
other packages used. (See this question and this one.)%
\markabove{r}{I'm sorry, but the links didn't show}%
Does anyone have any ideas on a robust alternative I could
use? I would prefer not to use marginal lines (as used to
indicate changes) so that it is clear exactly which bits of
text, figures, etc. are included. Differently-coloured
\markbelow{l}{and lapped, I think}%
text was the obvious choice for me.
There's a chance that my outstanding question will get an
answer that 'fixes' my explicit \verb|\color| usage (though
I imagine with lots of very arcane low-level TeX) but
obviously a pre-existing package or simple LaTeX that
achieves the same or similar effect would be better.
\TODO{Peter}{I'm sorry, but I made an unauthorized draft
on your funds today.}~
\TODO{Paul}{You paycheck is ready for pick-up}%
\clearpage
\showTODOs{Steven}
\showTODOs{Peter}
\showTODOs{Paul}
\end{document}