For a bigger writing project of article type book, I would like to color the heading and the text of certain sections, subsections, and subsubsections in different colors.
- Normal text is as usual in black (commands section, subsection, subsection)
- Text and heading of what I wrote very recently should be red (e.g. via new commands sectionNew, subsectionNew, ...)
- Text and heading of what has already been corrected several times and is approved by a native speaker I would like to display in green (e.g. sectionFinished, subsectionFinshed, etc.)
I can define the commands of the new sections like this
\newcommand\sectionNew[1]{\section{\color{red}#1}\color{red}}
\newcommand\subsectionNew[1]{\subsection{\color{red}#1}\color{red}}
...
\newcommand\sectionFinished[1]{\color{green}\section{#1}\color{green}}
...
One way to get the behavior I desire is to add { and } around the section[New|Finished] commands I defined and the following text.
{
\sectionNew{Heading1}
Lorem ipsum.
}
However, I would like to avoid this if possible, as the curly brackets IMHO make the text less readable in the LaTeX file.
Without the curly brackets, the above mentioned has the problem that all subsequent sections without a specific definition are colored red or green as well (until encountering another explicit color statement). I think maybe renewing the section command with explicitly defining black as the color could be the solution. Unfortunately, I can not figure out how to renew the section command in a generic way (taking over everything from the document type except an explicit color statement).
Is there any solution to this?
Or maybe is there a package that does this already for me (i.e. a kind of text management/versioning inside the latex document)?
UPDATE: One drawback of this is that it is not possible to use an alternative title for the page headings anymore (\section[Alt Title for Heading]{Normal Title}).
\leavevmode
:\newcommand\sectionNew[1]{\section{\color{red}#1}\color{red}\leavevmode} \newcommand\sectionFinished[1]{\color{green}\section{#1}\color{green}\leavevmode}
. But do you really want to do that?