# empty subsubparagraph doesn't show up

Here is a MWE:

\documentclass[12pt,letterpaper]{article}

\makeatletter
\newcounter{subsubparagraph}[subparagraph]
\renewcommand\thesubsubparagraph{%
\thesubparagraph.\@arabic\c@subsubparagraph}
\newcommand\subsubparagraph{%
\@startsection{subsubparagraph}    % counter
{6}                              % level
{\parindent}                     % indent
{3.25ex \@plus 1ex \@minus .2ex} % beforeskip
{-1em}                           % afterskip
{\normalfont\normalsize\bfseries}}
\newcommand\l@subsubparagraph{\@dottedtocline{6}{10em}{5em}}
\newcommand{\subsubparagraphmark}[1]{}
\makeatother

\begin{document}

\begin{subsubparagraph}{Here is subsubparagraph A}
\leavevmode
\end{subsubparagraph}

\begin{subsubparagraph}{Here is subsubparagraph B}
\end{subsubparagraph}

\subsubparagraph{Here is subsubparagraph C}

\end{document}


Only subsubparagraphs A and C actually render...I'm interested to learn why subsubparagraph B does not.

• Welcome! Why define \subsubparagraph for this? Why not use \subparagraph for the same question?
– cfr
Dec 1 '16 at 3:22
• Good point, @cfr ! In fact, even an empty \paragraph environment shows the same behavior. \begin{paragraph}{Here is paragraph X} \end{paragraph} \begin{paragraph}{Here is paragraph Y} \leavevmode \end{paragraph}  Dec 1 '16 at 3:41

An inline heading is saved in a temporary macro and added to the first text in the section, to control page breaking and indentation.

If you use the environment form that information is lost at the end of the group.

The environment form of section headings isn't really supported but if you do want to use it, and have the possibility of it being empty, you need to define the end code of the environment to flush any pending headings:

\documentclass[12pt,letterpaper]{article}

\makeatletter
\newcounter{subsubparagraph}[subparagraph]
\renewcommand\thesubsubparagraph{%
\thesubparagraph.\@arabic\c@subsubparagraph}
\newcommand\subsubparagraph{%
\@startsection{subsubparagraph}    % counter
{6}                              % level
{\parindent}                     % indent
{3.25ex \@plus 1ex \@minus .2ex} % beforeskip
{-1em}                           % afterskip
{\normalfont\normalsize\bfseries}}
\newcommand\l@subsubparagraph{\@dottedtocline{6}{10em}{5em}}
\newcommand{\subsubparagraphmark}[1]{}
\def\endsubsubparagraph{\par
\if@noskipsec
\ifx\@svsechd\@undefined\else\leavevmode\fi
\fi}

\makeatother

\begin{document}

\begin{subsubparagraph}{Here is subsubparagraph A}
\leavevmode
\end{subsubparagraph}

\begin{subsubparagraph}{Here is subsubparagraph B}

\end{subsubparagraph}

\subsubparagraph{Here is subsubparagraph C}

\end{document}

• Just curious, would it be better to flush the heading at the start of the subsubparagraph rather than at the end? Dec 3 '16 at 0:53
• @BenjaminTyner no, that wouldn't work Dec 3 '16 at 9:39