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}
4
  • what class do you use? please show us a minimal example of your code. – touhami Oct 14 '15 at 19:39
  • I use \documentclass{article} – Gomi Oct 14 '15 at 19:39
  • may be \renewcommand{\thesection}{\Roman{section}} – touhami Oct 14 '15 at 19:41
  • oh sorry I didn't understand the question – touhami Oct 14 '15 at 19:47
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

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

3
  • 1
    This also "wrecks" the ToC. – Werner Oct 14 '15 at 19:48
  • 1
    And invalidates the optional argument for \section. – Gonzalo Medina Oct 14 '15 at 19:49
  • @Werner @GonzaloMedina : You're right didn't thought about it :/ – Romain Picot Oct 14 '15 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.