[comp.text.tex] centering section headings

hussien@circe.arc.nasa.gov (Bassam Hussien) (05/10/91)

The \section command in LaTeX places the heading flush left, and we would
like to center it.  The use of \begin{center} and \end{center} would mess
up the spacing of the \subsection headings that follow.

If anyone out there who knows some convenient ways of centering the
heading, please send us an e-mail with the solution.  Thanks!!!


hussien@circe.arc.nasa.gov

geyer@galton.uchicago.edu (05/10/91)

In article <1991May9.200239.238@riacs.edu> grendel@circe.arc.nasa.gov writes:

>The \section command in LaTeX places the heading flush left, and we would
>like to center it.  The use of \begin{center} and \end{center} would mess
>up the spacing of the \subsection headings that follow.
>
>If anyone out there who knows some convenient ways of centering the
>heading, please send us an e-mail with the solution.  Thanks!!!

You have to make your own style file redefining \section.  Say you are using
article style in 12 point.  Look up the definition of \section in
art12.sty

  \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
   -.2ex}{2.3ex plus .2ex}{\Large\bf}}

Never mind most of it, insert \centering before \Large and you're in
business.

  \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
   -.2ex}{2.3ex plus .2ex}{\centering\Large\bf}}

Put this in a file foo.sty, then

  \documentstyle[12pt,foo]{article}

Will give you a document with centered headings.  I think you need a
different definition for each type size and document style.

Charles Geyer
Department of Statistics
University of Chicago
geyer@galton.uchicago.edu