# Starting text right after section or subsection title

Is it possible to start your text right after the section or subsection title (without starting a new line)? Thank you. I hope the question is clear enough and does not need a MWE.

-
It is always best to provide a MWE as it maximises the chance that (a) you supply enough information and that (b) the person answering tests their answer. In this case the answer probably depends on which class you are using, but you haven't said. –  David Carlisle Feb 21 '13 at 0:36

In the default classes the run-in style is used for \paragraph and \subparagraph to change \section to use the same find it's defintion, in article it is

\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}


and you need to invert the sign of the 3/4th arguments as that is used as a switch to specify run-in style so

\renewcommand\section{\@startsection {section}{1}{\z@}%
{3.5ex \@plus 1ex \@minus .2ex}%
{-1em}%
{\normalfont\Large\bfseries}}


Also changed the 4th arg to specify 1em space after (rather than below) the heading, as for \paragraph

-

David has already provided the package-free solution; here's another option, using the titlesec package (simply selecting the runin predefined format):

\documentclass{article}
\usepackage{titlesec}

\titleformat{\section}[runin]
{\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}[runin]
{\normalfont\large\bfseries}{\thesubsection}{1em}{}

\begin{document}

\section{Test Section}
Test
\subsection{Test Subsection}
Test

\end{document}


-