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?

1 Answer 1


How about something like this?

  • 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. Jan 4, 2011 at 21:16
  • @A. R.: Okay, I changed it.
    – TH.
    Jan 4, 2011 at 22:31
  • 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. Jan 5, 2011 at 0:15
  • How do you make the line to go as far as needed according to the text automatically? Is it possible? Nov 1, 2013 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .