another specific section format

Is there a way to implement the following style in LaTeX?

"Sections should be numbered using upper-case roman numerals (I, II, III, etc.). Section titles should appear on the first line of text, italicized, as part of the first paragraph in each section."

It's not stated in the quote, but the section numbers are to appear centred on their own line, as section headings (using a medium weight, normal sized font).

I couldn't see a way to implement both a separate heading and a run-in element by playing around with titlesec. Many thanks in advance!

You can typeset the section number in a box as wide as the line, so it will appear centered above the section text. The style to use is runin.

\documentclass{article}

\usepackage{titlesec}
\titleformat{\section}[runin]
{\normalsize}
{\makebox[\columnwidth]{\thesection}}
{0pt}
{\textit}

\renewcommand{\thesection}{\Roman{section}}

\usepackage{lipsum}

\begin{document}

\section{This is the first section}

\lipsum[3]

\section{This is the second section}

\lipsum[3]

\end{document}


If you want to add punctuation (only when necessary), you can exploit the \@addpunct macro defined by amsthm.

\documentclass{article}
\usepackage{titlesec}
\usepackage{amsthm}

% A helper command
\makeatletter
\newcommand{\sectiontitleformat}[1]{%
\makeatother

\titleformat{\section}[runin]
{\normalsize}
{\makebox[\columnwidth]{\thesection}}
{0pt}
{\sectiontitleformat}

\renewcommand{\thesection}{\Roman{section}}

\usepackage{lipsum}

\begin{document}

\section{This is the first section}

\lipsum[3]

\section{Is this the second section?}

\lipsum[3]

\end{document}


How to increase the spacing between the number and the text?

Add an invisible rule, using the optional argument to give it some depth.

\titleformat{\section}[runin]
{\normalsize}
{\makebox[\columnwidth]{\rule[-\baselineskip]{0pt}{0pt}\thesection}}
{0pt}
{\sectiontitleformat}


• Many thanks @egreg! How does one create an appropriate amount of vertical white space between the number title and the following paragraph? – Oliver Jul 23 '13 at 12:09
• In answer to my own comment, the following achieves the type of spacing I was looking for, but I suspect there are more elegant solutions:\usepackage{titlesec} \titleformat{\section}[runin] {\normalsize} { \begin{minipage}{\columnwidth} \thesection \fillast \vspace{\baselineskip} \end{minipage} } {0ex} {\textit} – Oliver Jul 23 '13 at 12:47
• @Oliver I've added an easier way for adding some vertical distance. – egreg Jul 23 '13 at 13:03