# How does one show an empty section?

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?

• Welcome to TeX.SX! Perhaps Show untitled appendices in PDF index might help Sep 16, 2013 at 15:27
• Thanks! Ms./Mr. Crowley solved this problem, but I'll look at this. Thanks again! Sep 16, 2013 at 15:42

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}

• This works, thank you! (Just to clarify for others reading this: Argument #1 = section title, Argument #2 = section text.) Sep 16, 2013 at 15:37
• @AnthonyPulido This works, but there are some costs to making the section text an argument, notably that verbatim won't work any more, it's also slower although that is less important these days. Sep 16, 2013 at 16:18
• @DavidCarlisle Yes, I think you're right. I spoke too soon. I tried it on a small bit of text at first, which worked. I then tried it on what I wanted to use it on, text with subsections and long paragraphs. I'm now receiving an error: TeX capacity exceeded, sorry [input stack size=5000]. Sep 16, 2013 at 16:38
• @Crowley Would you have any new ideas? Sep 16, 2013 at 16:39
• @AnthonyPulido you can always omit the {} around a tex parameter, so if you omit the {} in this case the the argument is the first letter or command of the section, although in most cases that will work OK. Sep 17, 2013 at 18:59

Perhaps this would work

\section*{}

This will create a new blank section with the same spacing as a normal section.

New contributor
user277741 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• I needed to be able to tell which sections were blank from looking at the table of contents, and so this is not quite what I was looking for, but thank you! Aug 5 at 18:38