5

I need to have a line break after \section number (I use Roman numbers), like:

I
Section

... some text ...

II
Section

I've tried \renewcommand{\thesection}{\Roman{section}\\}, but it only creates errors.

Thanks for your help!

EDIT: CODE SAMPLE

I use modified template from TexWorks

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{geometry}
\geometry{a4paper}
\geometry{margin=1.5cm}

\usepackage[parfill]{parskip}


\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\lhead{}\chead{}\rhead{}
\lfoot{}\cfoot{\thepage}\rfoot{}

\usepackage{sectsty}
\allsectionsfont{\centering}

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


\title{titlee}
\date{}

\begin{document}
\maketitle

\section{section}
Lorem ipsum dolor sit

\end{document}
Werner
  • 603,163
Gomi
  • 1,325

2 Answers2

7

Here's one option using the titlesec package:

\documentclass{article}
\usepackage{titlesec}

\renewcommand\thesection{\Roman{section}}
\titleformat{\section}[display]
  {\normalfont\Large\bfseries\filcenter}{\thesection}{0pt}{}

\begin{document}

\section{A test numbered section}
Some test text.
\section*{A test unnumbered section}
Some test text.
\section{Another test numbered section}
Some test text.

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
0

EDIT: not a good idea (see comments)

A little solution:

\documentclass{article}

\begin{document}
\newcommand{\sect}[1]{\section{\newline #1}}
\renewcommand{\thesection}{\Roman{section}}

\sect{foo}

\sect{bar}

\end{document}

enter image description here

Romain Picot
  • 6,730
  • 4
  • 28
  • 58