I have a long .tex document and I want to change the background color of the parts I have already checked for typos to a light green. I am looking for an easy command that can be used like
\HIGHLIGHT{
<here I want to put a part of my tex file that contains different environments like theorems, figures...>
}
But the \hl{}
command cannot contain other environments, the following example does not work:
\documentclass[10pt]{article}
\usepackage[english]{babel}
\usepackage{amssymb,amsmath,amsthm,amsfonts}
\usepackage{xcolor,soul}
\newtheorem{theorem}{Theorem}
\begin{document}
\section{Introduction}
\hl{
\begin{theorem}
A theorem.
\end{theorem}
}
\end{document}
Do you have any suggestions which command could be used here (the typesetting shall not be changed, only the color)?
Best Answer
As suggested in one of my comments to the question, I would use
tcolorbox
and its\newtcbtheorem
macros, having two basically identical environments, where one uses thecheckedstyle
and the other one theuncheckedstyle
. If a theorem is not checked yet, use\begin{uctheorem}...\end{uctheorem}
and edit it later to\begin{theorem}...\end{theorem}
or just remove thecolback={green!50!white}
statement from the definition ofuncheckedstyle
.In the very end, a
search-and-replace
of alluctheorem
occurrences bytheorem
would be the best way, in my point of view, but that is a matter of taste, of course.Another option is to use a 'real'
tcolorbox
environment which allows local specification of options, which is not possible with thetcbtheorem
environments.