# Customize section in lyx

I am writing in lyx and inserted a new section. i wonder how could i align the section header to the center rather than to the left. I put

\usepackage{titlesec}

\titleformat{\section}{\centering}

in the preamble but it does not work. Any comments would be appeciated. Thank you.

## 1 Answer

It is \titleformat*{\section}{\centering} (with the *!!)

Or, also \titleformat{...}[...]{....}{...}{...}{...}[...] where each {...} is a mandatory argument. It cannot work only with two arguments, need at least five., e.g.: some like ...

\titleformat{\section}{\centering}{\thetitle.\quad}{1em}{1em}


See the manual (run texdoc titlesec, page 4) for detailed explanations about the argument-s of both command versions.

• Thank you for the suggestion. It works. I also try to get the section header to be bold. I read the document for titlesec. I am not sure if I find any solution from there. Do you have any suggestions? Many Thanks May 9 at 19:44
• @Sdeng You can add some \large\bfseries after \centering in the format arguments.
– Fran
May 9 at 21:17