# Mark section as finished

I'm working on a thesis and I would like to mark some sections as finished. I don't want to add artificial text, because then I will have to delete these addings before publication. Perfect solution would be something like this:

\someCommandThatWillMakeSectionsGreenInTableOfContentsWhenMarkedAndCanBeEasilyDisabled.
...
\myMark \section{Foo}
\section{Bar}
\myMark \section{Baz}


I know it may be a little overengineering, but maybe it is easily possible. Thanks.

• Welcome to TeX.SX! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – jjdb May 3 '17 at 12:01
• Have a look at the todonotes package. It can do that and a lot more. – JPi May 3 '17 at 13:36

I'd use

\section{\YeyIveFinished{Foo}}


with

\newcommand\YeyIveFinished[1]{#1}


or

\newcommand\YeyIveFinished[1]{\protect\textcolor{green}{#1}}


in the preamble, as required.

• Same comment applies here: I would suggest to also use a switch (is that the right term?) to turn this feature on only in draft mode. So one has not to worry to turn it off. One possibility is \usepackage{ifdraft} and enclose the whole redefinition by \ifdraft{…}. – jjdb May 3 '17 at 12:18

A “sophisticated” solution:

\documentclass{article}
\usepackage{xparse,xcolor}

% remove for the final version
\let\latexsection\section
\newif\ifsectioncompleted

\RenewDocumentCommand{\section}{sO{#3}m}{%
\IfBooleanTF{#1}
{\latexsection*{#3}}% starred sections don't go in the TOC
{\let\greensection\relax % we don't want green in headers
\ifsectioncompleted
\latexsection[\greensection#2]{#3}%
\else
\latexsection[#2]{#3}%
\fi
\global\sectioncompletedfalse
}%
}

\NewDocumentCommand{\completed}{}{\global\sectioncompletedtrue}
\NewDocumentCommand{\greensection}{}{\color{green!70!red}}
% END of code to remove (remember to remove also \completed in the text)

\begin{document}

\tableofcontents

\bigskip
\hrule
\bigskip

\completed\section{Introduction}

Blah blah

\section{I need to work on this one}

Blah blah

\completed\section{This one is finished}

Blah blah

\end{document}


• I would suggest to also use a switch (is that the right term?) to turn this feature on only in draft mode. So one has not to worry to turn it off. One possibility is \usepackage{ifdraft} and enclose the whole redefinition by \ifdraft{…}. – jjdb May 3 '17 at 12:17

I suggest using modular documents.

In the case of an article class, use a new document for each section, and comment out the ones you've finished:

\documentclass{article}
\begin{document}
%\input{Section_1}
%\input{Section_2}
%\input{Section_3}
\input{Section_4}
%\input{Section_5}
\end{document}


For the book class, you can use also the \includeonly command,

\documentclass{book}
\includeonly{Chapter3}
\begin{document}
\include{Chapter1}
\include{Chapter2}
\include{Chapter3}
\end{document}


The advantage is that cross references are kept after removing chapters from there. Alternatively, you could use of the other methods mentioned in the link.

The advantage in using modular documents is that the compilation is also faster when compiling only the current section/chapter.

• I think the OP is looking for the motivational distraction of seeing the contents get greener as the end draws near, just making finished sections go while you are not working on them isn't quite the same thing. – David Carlisle May 3 '17 at 12:20
• Yeah, possibly. I've tried to give a different approach. Sometimes people ask to narrow and don't think of other possibilities. – jjdb May 3 '17 at 12:25