1

I often add specific nonsense blurbs such as QQQ to mark regions that need to be checked/edited by other people. Is there a way to automatically give these a different colour so they stand out more in the pdf?

  • 3
    in luatex yes, in other system just use sed -e "s/QQQ/\\textcolor{red}{QQQ}/g" on the file but it's easier if you use \QQQ rather than QQQ then all you need to do is define that command. – David Carlisle Jun 27 '17 at 10:06
3

This is only kind of an answer, as I don’t think an automatic solution is a good idea ;-)

I usually use a (coloured) block/rule for these things. Alternatively one can use a macro with \colorbox (\OTHERBLOCK in the following MWE) or the todonotes package which would be the most sophisticated solutionI’d say.

enter image description here

\documentclass{article}

\usepackage{xcolor}

\usepackage{todonotes}

\newcommand{\BLOCK}[1][3em]{%
   \textcolor{red}{\rule[-0.6ex]{#1}{2.4ex}}%
}

\newcommand{\OTHERBLOCK}[1]{%
   \colorbox{red}{\textcolor{white}{\textbf{#1}}}%
}

\begin{document}
   This is some final text.

   The date of \BLOCK\ is missing here.

   Here some longer parts \BLOCK[7em] are missing.

   The date of \OTHERBLOCK{Insert date} is missing here.

   Another option ist the \texttt{todonotes} package\todo{Try \texttt{todonotes}}
\end{document}

Using a macro and not an automatic colouring hast the advantage that when finalising your project you can just remove the definition of \BLOCK and TeX’ll report an error if it is still in use somewhere.

However an automation can be done with LuaTeX I guess.

  • You bring up a good point about the added value to be able to throw the runtime errors when finalizing a published version. One thing I'm missing from this method is the ability to add stuff like extra text in red explaining what needs to be added. Of course, you can do it in the regular text next to it, but I'd rather the attention only be drawn to red parts. – Phantom Jun 27 '17 at 14:06
  • If that makes any solution unwieldy (thus defeating the purpose of an easy macro), I guess I can make do with a structure like [\BLOCK\ Insert reference] etc – Phantom Jun 27 '17 at 14:12
  • @Phantom: Please see my edit: I added a macro taking an argument to add some notes. But maybe the todonotes package is what you’re looking for ;-) – Tobi Jun 27 '17 at 14:49
  • Thanks, I suppose the todonotes is mostly what I was looking for. I do like the inline style of your \OTHERBLOCK as well though, so I'm gonna save and use those blocks as well. Thanks for helping me out; accepted as answer! – Phantom Jun 27 '17 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.