Text Formatting'\centering' command does not center Section Heading

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
isharp2
Posts: 23
Joined: Fri Feb 11, 2011 2:06 am

'\centering' command does not center Section Heading

Post by isharp2 »

Hi,
I wanted to make a class that would center my sections in all uppercase (among other things). My class contains:

Code: Select all

\titleformat{\section}{\normalfont\Large\centering\bfseries}{\thesection}{1em}{\uppercase\centering}
However, this does not center the section title. It still appears left-justified. Any ideas?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

paul
Posts: 49
Joined: Thu Apr 08, 2010 5:56 am

'\centering' command does not center Section Heading

Post by paul »

isharp2 wrote:Hi,
I wanted to make a class that would center my sections in all uppercase (among other things). My class contains:

Code: Select all

\titleformat{\section}{\normalfont\Large\centering\bfseries}{\thesection}{1em}{\uppercase\centering}
However, this does not center the section title. It still appears left-justified. Any ideas?
Replace \centering with \filcenter. Also, replace \uppercase\centering with \MakeUppercase (you don't need to say \filcenter again, but if you did, put it before \MakeUppercase).

\uppercase is unlikely to do what you want; use \MakeUppercase instead.
Post Reply