# Center part title in Lyx

How can I, in tex code or directly in the Lyx GUI, put the part title in the center.

Part I

Introduction and Background theory


this:

              Part I

Introduction and Background theory


MWE:

% Preview source code

%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}
\begin{center}

\part{Test abcabc}

body text

\end{center}
\end{document}


Did you check the option to create a centered environment? E.g. \begin{center}Part I ...\end{center} or the switch \centering? That would be for how to center things in TeX. Whether the LyX GUI offers that option I don't know, but I would assume so. Sent from my phone. If needed a more detailed explanation with examples could be provided.

I see now. You could use

 % Preview source code

%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage{sectsty}
\partfont{\centering}
\begin{document}
\part{Test abcabc}
body text
\end{document}

• This has no effect – Tim Jun 3 '15 at 7:28
• Would you be so kind and give us a MWE example of your code? I don't use LyX but from what I know I don't see why that shouldn't work. – idkfa Jun 3 '15 at 7:30
• Done. See updated post. – Tim Jun 3 '15 at 7:32
• @Tim I updated my answer accordingly – idkfa Jun 3 '15 at 7:49