[Tex/LaTex] Formatting a \paragraph to look like a \section

formattingsectioningsections-paragraphstitlesec

I'm writing a document that contains a rather deep tree of nested lists, and was wondering if how I would go about reformatting the \paragraph macro to format the text contained within it as a \section, specifically by separating the title from the body and placing it above the body. I've encountered the titlesec package but I'm confused as to how to use it since it seems to be used very little so there are very few examples to follow.


Update 1: I'm using the article document class.

Best Answer

Pages 26-27 of the titlesec documentation show "how [the] sectioning commands of the standard classes could be defined" using titlesec commands. Take the definition of \paragraph and change the optional "format" argument of \titleformat from runin to hang (or drop it entirely).

\documentclass{article}

\usepackage{titlesec}
\titleformat{\paragraph}[hang]{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1em}

\begin{document}

\paragraph{A paragraph}

Some text.

\end{document}

EDIT: To make a \paragraph look exactly like a \section in the article class, use

\titleformat{\paragraph}{\normalfont\Large\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}