Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to underline section-headings in LaTeX?

EDIT: As I see in the first answer, underline is the wrong word. I want a line under the section heading, separating the heading from the following text.

I want to separate section headings from the following text with a horizontal line. At the moment I use the following:

\newcommand{\tmpsection}[1]{}
\let\tmpsection=\section
\renewcommand{\section}[1]{\tmpsection{#1}\hrule\nobreak}

But that produces a line, that is too far away from the section-heading and to near to the following text. Has anyone a better idea?

like image 731
Mnementh Avatar asked Sep 08 '09 08:09

Mnementh


1 Answers

I've heard that the titlesec is more powerful than sectsty package, so I've just used it. You can put the horizontal line before the section header using:

\usepackage{titlesec}
\titleformat{\section}{\large\bfseries}{\thesection}{1em}{\hrule}

or you can put it after, with the help of newcommand. See section 4.4 of the titlesec manual.

like image 88
Jonathan Avatar answered Oct 04 '22 08:10

Jonathan