在这个 MWE 中,我制作了两个命令来突出显示文本的某些部分作为审阅者注释,同时对注释进行独特的颜色处理以指示排版的作者。
如果我想制作两个listoftodos
,每个都有一个作者的评论条目,该怎么做?
\documentclass{article}
\usepackage{hyperref,lipsum}
\usepackage[textwidth=2.5cm,colorinlistoftodos]{todonotes}
\setlength{\marginparwidth}{2.5cm}
\newcommand\stR[2]{% 1st reviewer comment
\todo[%
author=1st Reviewer,noline,caption={1st Reviewer #1 Comment},color=blue!20%
]%
{#1 Comment}{\color{blue}{\bfseries#2}}}
\newcommand\ndR[2]{% 2nd reviewer comment
\todo[%
author=2nd Reviewer,noline,caption={2nd Reviewer #1 Comment},color=red!50!white%
]%
{#1 Comment}{\color{red}{\bfseries#2}}}
\begin{document}
\listoftodos[Reviewers Comments]
\section{Section}
Text \stR{2nd}{2nd comment of the 1st reviewer} another text\vspace{\baselineskip}
\lipsum[1]\vspace{\baselineskip}
Some text \ndR{1st}{1st comment of the 2nd reviewer} continue text
\end{document}
答案1
有点黑客风格,但我认为它应该可以工作。请注意,它假设您使用 hyperref。
\documentclass{article}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage[textwidth=2.5cm]{todonotes}
\setlength{\marginparwidth}{2.5cm}
\usepackage{etoolbox}
\makeatletter
\newcommand\@todonotes@owner{default}
\define@key{todonotes}%
{owner}{\def\@todonotes@owner{#1}}
\newtoggle{ownerdefault}
\newtoggle{ownerB}
\newcommand\stR[2]{% 1st reviewer comment
\todo[%
owner=default,
author=1st Reviewer,noline,caption={1st Reviewer #1 Comment},color=blue!20%
]%
{#1 Comment}{\color{blue}{\bfseries#2}}}
\newcommand\ndR[2]{% 2nd reviewer comment
\todo[%
owner=B,
author=2nd Reviewer,noline,caption={2nd Reviewer #1 Comment},color=red!50!white%
]%
{#1 Comment}{\color{red}{\bfseries#2}}}
\renewcommand{\@todonotes@addElementToListOfTodos}{%
\if@todonotes@colorinlistoftodos%
\addtocontents{tdo}
{%
\protect\iftoggle{owner\@todonotes@owner}
{%
\protect\contentsline {todo}
{\protect\fcolorbox{\@todonotes@currentbordercolor}%
{\@todonotes@currentbackgroundcolor}%
{\protect\textcolor{\@todonotes@currentbackgroundcolor}{o}}%
\ \@todonotes@caption
}{\thepage}{\@currentHref}%
}{}%
}%
\else%
\addtocontents{tdo}
{%
\protect\iftoggle{owner\@todonotes@owner}
{%
\protect\contentsline {todo}
{\@todonotes@caption
}{\thepage}{\@currentHref}%
}{}%
}%
\fi}%
\makeatother
\begin{document}
\toggletrue{ownerdefault}
\section*{Reviewers 1 Comments}
\InputIfFileExists{\jobname.tdo}{}
\toggletrue{ownerB}
\togglefalse{ownerdefault}
\section*{Reviewers 2 Comments}
\InputIfFileExists{\jobname.tdo}{}
\togglefalse{ownerB}
\makeatletter \@starttoc{tdo}\makeatother % to trigger the creation of the list
\section{Section}
Text \stR{2nd}{2nd comment of the 1st reviewer} another text\vspace{\baselineskip}
\lipsum[1]\vspace{\baselineskip}
Some text \ndR{1st}{1st comment of the 2nd reviewer} continue text
\end{document}