If you use the amsart
class, then it puts a period after the subsection title, but not if there is no title. For example, if I write
\subsection{Title}
Blah1
\subsection{}
Blah2
Then amsart
produces
0.1. Title. Blah1
0.2. Blah2
I tried to achieve this in the article class using titlesec package, but so far I can make the period always appear or never appear. So, with the same coding as above, I get either
0.1. Title. Blah1
0.2. . Blah2
(notice the extra period after 0.2.) or
0.1. Title Blah1
0.2. Blah2
Does anyone know how to have the period appear after the subsection title only when there is actually a title?
Best Answer
In the following example I used the ifmtarg package to define a user command, with the help of
\@ifmtarg
, for testing for an empty macro argument (zero or more spaces will be handled); theexplicit
option for titlesec was used to have control over the title using#1
; the test for emptyness is performed inside\titleformat
: