[Tex/LaTex] No newline after (sub)section

line-breakingsectioning

I want my text to appear right after the call to \subsection{Name} but I can't find how to do it. I'm using the article class.

An example of command:

\subsection{a)} Blah blah bla...

produces:

a)

Blah blah bla…

instead of what I want:

a) Blah blah bla…

Anything I could do?

Best Answer

Your specific example can be solved by using the enumerate environment (as mentioned by elcelista), but your general question can be answered by using the titlesec package. The titlesec package defines the \titleformat command which allows any sectioning command to be easily redefined. The syntax of the \titleformat command is

\titleformat{command}[shape]{format}{label}{sep}{before}[after]

To eliminate the newline after a subsection heading, put the following in the preamble for your document:

\titleformat{\subsection}[runin]{}{}{}{}[]

Here is an example document and its output:

\documentclass{article}
\usepackage{titlesec}
\titleformat{\subsection}[runin]{}{}{}{}[]

\begin{document}
\subsection*{a)}
Blah blah bla...
\end{document}

Output of titlesec example