# Numbered paragraphs with optional titles

I am trying to define numbered paragraphs \mypar which can admit an optional <title>. I did the following:

\newcounter{paranum}[section]
\renewcommand{\theparanum}{\thesection.\arabic{paranum}}
\newcommand{\mypar}[1][]{\bigskip%
\noindent%
% Above defines a custom paragraph numbering scheme.


This more of less did the job. The only deficiency is that when I have a title for the paragraph, the spacing following the title (and before the content) is just the usual amount of spacing between words in normal text. However, given that this is the title of the paragraph, I would like there to be some extra spacing following it to separate it from the following normal text. I tried adding the \quad:

\newcounter{paranum}[section]
\renewcommand{\theparanum}{\thesection.\arabic{paranum}}
\newcommand{\mypar}[1][]{\bigskip%
\noindent%
% Above defines a custom paragraph numbering scheme.


This works fine when the title is present; however, it also puts unnecessary extra space even when there isn't a title for the paragraph.

How may I define the command to make sure that there is only one \quad (instead of two) between the paragraph number and the normal-text content when there isn't a title; but also when there is a title, one \quad between the paragraph number and the title, and another \quad between the title and the normal-text content? Any help appreciated!

Just add conditional to your definition. \@empty is an empty string in LaTeX; since it has @, surround it by \makeatletter/\makeatoher:
\makeatletter