I want to have subsections appear like "Article 1: Foo" when I enter \subsection{Foo}
, but like "Article 1" (without the colon) when I enter \subsection{}
(without a title). Is there a way to do this?
Here's a MWE of what I have now:
\documentclass{article}
\usepackage{titlesec}
\newcounter{artikel}
\setcounter{artikel}{1}
\renewcommand{\thesubsection}{\arabic{artikel}}
\titleformat{\subsection}{\large\bfseries}{}{0pt}{Article \thesubsection: \refstepcounter{artikel}}
\begin{document}
\subsection{Foo}
\subsection{}
\end{document}
Which produces
Article 1: Foo
Article 2:
But I want it to produce:
Article 1: Foo
Article 2
article
class. I added a MWE for clarity.titlesec
is the easier option here