# Add small line in \section title

I'm trying to duplicate an old document that has a small centered line above each \section. I have not been able to duplicate this when I set the formatting for the \section. (I'm using the titlesec package, among others.) This is an example of what I've tried:

\titleformat{\section}{\normalfont\Large\filcenter}{\rule{.5in}{.02in} \\ \thesection}{0em}{}


Is there a way to do this without putting the {\rule{.5in}{.02in} before each \section?

-

\titleformat\section{\normalfont\Large\centerline{\hss\rule{.5in}{.02in}\hss}}{\thesection}{1em}{}

That's pretty close, but the hrule is left justified, rather than centered. (I'll edit the question to make it clearer, my bad.) It's ignoring the \filcenter, and even trying \titleformat{\section}{\normalfont\Large\filcenter{\begin{center}\hrule width.5in\end{center}}}{\thesection}{0em}{} didn't shift it right. –  A. R. Diederich Jan 4 '11 at 21:16
Genius! That did the trick. I modified it slightly as \titleformat{\section}{\normalfont\Large\centerline{\hss\rule{.5in}{.02in}\hss}‌​\filcenter}{\thesection}{1em}{} to center the rest of the text, and put \section in the command brackets. I've been pounding away through the titlesec docs trying to figure it out with the package, but that documentation is quite arcane. –  A. R. Diederich Jan 5 '11 at 0:15