# Robust way to mark draft text?

When writing documents, I like to 'mark up' draft/partial text (e.g., short summaries 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 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 \color 'switch' to do this (with an alternate \textcolor based command for short inline bits of text), with commands like this:

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


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.)

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 text was the obvious choice for me.

EDIT: Since my current \color method does work very nicely as a 'start/end' switch across arbitrary LaTeX constructs (except for the special cases mentioned above), I would only change to something that continues to give me that, but is more robust (especially since this is used to 'highlight' text that I need to adjust/rewrite, and is thus only used when working towards a 'proper' first draft; i.e., convenience of use outweighs absolute correctness since this won't normally be in any public-facing versions of the document).

There's a chance that my outstanding question will get an answer that 'fixes' my explicit \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.

• This question might be useful. I use something like that myself:  \usepackage{xcolor} \newenvironment{rewrite}[1]{% \begin{adjustbox}{minipage=\linewidth,bgcolor=#1,vspace=\smallskipamount} \color{white} }{% \end{adjustbox} }  I pass in the background color as argument to be able to easily have multiple levels of being close to something that could end up being the final version. Nov 8, 2013 at 21:50

Here I use the stackengine package to develop the macros \markabove and \markbelow that uses text lapping to achieve an edit, without affecting the layout of the original document, if you are careful with your % signs. It works in footnotes, too, as shown.

EDITED to allow a TODO like functionality, when your comments are too long to stick directly into the text.

\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]{%
\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}}{%
\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}


• This is nice but all I actually want is just 'highlighting' of portions of the actual text, not todonotes-style 'comments'; i.e., I'm not adding notes to the text (I can use margin notes or todonotes whatever for that), just highlighting portions of it. Nov 5, 2013 at 11:41
• @monsieurRigsby Do you mean more like this? tex.stackexchange.com/questions/125162/… Nov 5, 2013 at 13:39
• @steven-b-segletes Thanks for the link, but that seems to be a ConTeXt solution and I suspect that it wouldn't work for text spanning sections, figures, etc. (might be wrong). Nov 6, 2013 at 11:14
• @monsieurRigsby Actually, the solution that I provided at that page is not Context, but LaTeX...however, you are right that it would not span across a section boundary, even though it can span across paragraph boundaries Nov 6, 2013 at 11:23
• @steven-b-segletes Oops, sorry. Yes, it's a nice little tool but I don't want to have to worry about what units of LaTeX I can/can't put it around. My basic color method (using its \color switch) does give me this, just with a few unfortunate special cases where it messes up. Given the temporary nature of such 'to rewrite' text, I would only change to something that worked in any situation with simple start/end commands (and an inline alternative) as per my command redefs. Many thanks for the detail though which I'm sure may be valid for others. Nov 7, 2013 at 10:27

If the text is destined to be adjusted/rewritten, preserving exact page breaks would not make much sense. Then why not a very simple approach like

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

\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}


• I agree that this is a nice simple solution thinking outside the box a bit (+1). Although I could obviously change or tone down the page / marked section headings, this is not ideal for me where some paragraphs will only have some text marked (which would leave you with mixed styles: whole to-do paras with these bars/text, partial ones with, say, coloured or (more consistently) underlined text. I'll see what else comes in; in general, I'd prefer something which doesn't add text/symbols (just adjusts the color, font, etc. of 'real' text). Nov 7, 2013 at 15:43