[Tex/LaTex] Center part title in Lyx

formattinglyx

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

e.g. instead of this:

Part I

Introduction and Background theory

this:

              Part I

   Introduction and Background theory

MWE:

% Preview source code

%% LyX 2.1.3 created this file.  For more info, see http://www.lyx.org/.
%% 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}

Best Answer

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

%% LyX 2.1.3 created this file.  For more info, see http://www.lyx.org/.
%% 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}