How can I prevent a paragraph break before a section heading? To prevent it after, I know that I can use runin like


However, how can I prevent before? I want something like:

1. First section heading Text... (no line break here) 2. Second Section Heading Text...

EDIT. I am trying in the following way for \subsection. I created a new command like:

   {\normalfont\bf\thesubsection \hspace{0.3em} #1\hspace{0.3em}}

How can I call the formatting of \subsection and apply to the custom command \subsectionnlb?

  • 1
    If I understood, you want something like 1. First section heading Text... and then comes a section heading without a line break 2. Second Section Heading Text... If so, titlesec package can't do it, because the very \section command internals (namely, as far as I know, \@startsection) definition starts with a \par...
    – henrique
    Jul 2, 2011 at 2:22
  • @henrique You are correct. I revised my question. What about a \subsection without break?
    – Chang
    Jul 5, 2011 at 20:57
  • What you are looking for seems to be more close to a list (more specifically `trivlist``) than to real sectioning : And the accepted answer reinforce this feeling...
    – Jhor
    Jul 27, 2018 at 18:51

1 Answer 1


If you don't need to use \section specifically, you can try the following workaround:

\newcounter{sect}%          Creates a counter to be used in the new section command
\newcommand\Section[1]{%    Defines a new section command:
 \addtocounter{sect}{1}%    Increases counter
 \addcontentsline{toc}{section}{\arabic{sect}.~#1}% Add to table of contents
  {\sectfont% This command is intended to use with scrartcl class; 
%    if not using it you can use any formatting command you wish
  \arabic{sect}.~#1.}}%    Prints "<section number>. <section title>"
\Section{A first section}
\Section{A second section}

EDIT: BTW, this workaround doesn't use (it's actually incompatible with) titlesec package, but I assumed (based on your last comment) that you didn't actually required it.

  • Thanks for the answer. Yes, I don't need titlesec, so I deleted it from the title. I was wondering if there is something similar to \sectfont in the article package.
    – Chang
    Jul 6, 2011 at 16:03
  • There isn't --- the definition of \section in article.cls is \newcommand\section{\@startsection {section}{1}{\z@}{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@plus.2ex}{\normalfont\Large\bfseries}}. If you'll use this workaround you can create one with \newcommand{\sectfont}{\bfseries} for example. I don't recommend changing the font size, as the sectioning command will come within the text.
    – henrique
    Jul 6, 2011 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .