标记草稿文本的可靠方法是什么?

标记草稿文本的可靠方法是什么?

在撰写文档时,我喜欢“标记”草稿/部分文本(例如,某一部分内容的简短摘要),这样我就能清楚地看到需要调整的内容。我知道有 todonotes 包之类的东西(请参阅这个问题,例如),但我想要一些可以跨越文档任意部分的东西(例如,多个段落甚至包含任何文本的部分)。

我一直在使用颜色包的 \color“开关”来执行此操作(使用替代的基于 \textcolor 的命令来处理短的内联文本),命令如下:

\usepackage[usenames,dvips]{color}
\newcommand{\todo}[1]{\textcolor{Purple}{#1}}    
\newcommand{\startToDo}{\color{Purple}}
\newcommand{\stopToDo}{\color{Black}}

然而,这在各种情况下都会出现问题(例如脚注、URL、表格),其中一些问题取决于所使用的其他特定包。(参见这个问题这个

有人知道我可以使用什么强大的替代方案吗?我宁愿不使用边线(用于指示更改),以便清楚地知道包含哪些文本、图形等。不同颜色的文本对我来说是显而易见的选择。

编辑:由于我目前的 \color 方法可以很好地用作任意 LaTeX 构造的“开始/结束”开关(除了对于上面提到的特殊情况),我只会将其更改为能够继续提供此功能但更为强大的功能(特别是因为它用于“突出显示”我需要调整/重写的文本,因此仅在努力获得“正确”的初稿时使用;即,使用的便利性胜过绝对正确性,因为这通常不会出现在任何面向公众的文档版本中)。

我的悬而未决的问题将得到一个“修复”我明确的 \color 用法的答案(虽然我想象会使用大量非常神秘的低级 TeX),但显然预先存在的包或简单的 LaTeX 可以实现相同或相似的效果会更好。

答案1

在这里,我使用stackengine软件包开发宏\markabove,并\markbelow使用文本重叠来实现编辑,而不会影响原始文档的布局,前提是您对符号的处理非常谨慎%。它也适用于脚注,如图所示。

当您的评论太长而无法直接粘贴到文本中时,已编辑以允许类似 TODO 的功能。

\documentclass{article}
\textheight=6in
\usepackage{xcolor}
\usepackage{stackengine}
\setstackgap{L}{.5\baselineskip}
\newcommand\markabove[2]{{\sffamily\color{red}\hsmash{$\uparrow$}%
  \smash{\toplap{#1}{\scriptsize\bfseries#2}}}}
\newcommand\markbelow[2]{{\sffamily\color{red}\hsmash{$\downarrow$}%
  \smash{\bottomlap{#1}{\scriptsize\bfseries#2}}}}
\usepackage{ifthen}
\newcounter{todoindex}
\setcounter{todoindex}{0}
\newcommand\TODO[1]{%
  \addtocounter{todoindex}{1}%
  \expandafter\def\csname todo\roman{todoindex}\endcsname{#1}%
  \markabove{c}{\Alph{todoindex}}%
}
\newcounter{index}
\newcommand\showTODOs{%
  \vspace{5ex}%
  \rule{10ex}{.5ex}\textcolor{red}{TO-DO LIST}\rule{10ex}{.5ex}\\%
  \setcounter{index}{0}%
  \whiledo{\value{index} < \value{todoindex}}{%
    \addtocounter{index}{1}%
    \markabove{c}{\Alph{index}}  \csname todo\roman{index}\endcsname\\%
  }%
}
\begin{document}
When writing documents\footnote{Note, 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}{Do you mean like this?}%
draft/partial text (e.g., short summaries
\TODO{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 see what needs to be adjusted. I know that things like the todonotes package exist (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{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{\todo}[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), 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.

\showTODOs

\end{document}

在此处输入图片描述

答案2

如果文本注定要被调整/重写,保留精确的分页符就没什么意义了。那么为什么不采用一种非常简单的方法,比如

\documentclass{article}
\newcommand{\StartToDo}{\par
   \moveleft 1cm \vbox{\hrule width \dimexpr\linewidth+2cm\relax }
   \centerline{THE STUFF NEXT WILL HAVE TO BE REVISED}
   \markboth{THIS PAGE CONTAINS STUFF TO BE REVISED}
            {THIS PAGE CONTAINS STUFF TO BE REVISED}}
\newcommand{\StopToDo}{\par
    \centerline{---end of to be revised text---} 
    \moveleft 1cm \vbox{\hrule width \dimexpr\linewidth+2cm\relax }
    \markboth {THIS PAGE CONTAINS STUFF TO BE REVISED}
              {THIS PAGE CONTAINS STUFF TO BE REVISED}
 \medskip}

\pagestyle{myheadings}

\begin{document}

Starting from the problem of synchronizing clocks for train travels, 
we got a few ideas.

\StartToDo
senseless jumble
\StopToDo

And this finally gives $E=mc^2$.

\end{document}

有待修订

相关内容