# How to have Run-in Section in a separate command?

In the question asked here, How to have the same solution but in a different command without affecting the \section command? I mean I would like to create another command e.g. \runinsection that would make the text continue beside the section header while maintaining the \section command with its normal behavior.

• Although this is your second question, nobody has welcomed you here yet... So, Welcome to TeX.SX! – karlkoeller Dec 7 '14 at 19:54
• I'm not sure to understand what can be the use for this. – egreg Dec 7 '14 at 22:21
• In my case it was a one line section that caused me to go into a new page having also only one line, it's a 3 page document, the document did not look nice – Mystic Odin Dec 10 '14 at 0:34

You can simply define a new command \runinsection

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


and use it as in the following MWE:

\documentclass{article}

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

\usepackage{lipsum} %just for the example

\begin{document}

\section{This is a normal section}

\lipsum[1]

\runinsection{This is a run-in section}

\lipsum[1]

\end{document}


Output

• @MysticOdin You're welcome. – karlkoeller Dec 7 '14 at 19:59