[Tex/LaTex] How does one show an empty section

sectioning

I was wondering about the inverse of this question:

Hiding section titles when the section is empty

Instead of hiding empty sections in LaTeX, can one display only empty sections or somehow indicate that a section is empty in the table of contents?

Best Answer

This comes as first idea:

\documentclass{article}
\usepackage{etoolbox}
\newcommand{\emphsection}[2]{% emhasizes empty sections
    \ifstrequal{ #2}{ }{\section[empty: #1]{#1} #2}{\section{#1} #2}%
}

\begin{document}
\emphsection{Emptysection}{}
\emphsection{Section 1}{%
This section won't be emphasized
}
\emphsection{Section 2}
Neither this one.
\tableofcontents
\end{document}