How to modify section headings in APA6 document class?

I am using the apa6 document class for a thesis and need changes for the section format: \section: centered, normalfont (no bf), and control for line-spacing, \subsection: instead of left aligned I need it centered, and control for line-spacing \subsubsection: instead of in-line with paragraph I need it in the default format of \subsection: left aligned and bold

I tried the following, but this doesn't work:

\documentclass{apa6}
\usepackage{lipsum}
\usepackage{etoolbox}
\patchcmd{\subsection}% <cmd>
{\raggedright}% <search>
{\centering}% <replace>
{}{}% <success><failure>

\begin{document}
\subsection{A section}
\lipsum[1-2]
\end{document}


I also tried the titelsec package, but it conflicts with the APA6 class.

• Welcome to TeX.SE...Can you post your code in a compilable format? Nov 6 '19 at 5:42

In apa6 class file, \subsection definition doesn't contain the tag \raggedright, hence your tag doesn't work in a proper manner, please find the \bfseries tag in \subsubsection in apa6, then change it into \centering\bfseries, and the MWE is:

\documentclass{apa6}
\usepackage{lipsum}
\usepackage{etoolbox}
\patchcmd{\subsection}% <cmd>
{\bfseries}% <search>
{\centering\bfseries}% <replace>
{}{}% <success><failure>

\begin{document}
\subsection{A section}
\lipsum[1-2]
\end{document}


OUTPUT

• Thank you very much!. Shortly after I posted I found two other solutions: Solution 1 tex.stackexchange.com/questions/125537/… Solution 2 tex.stackexchange.com/questions/195441/… Nov 6 '19 at 7:01
• @togedo No issues, all our ultimate aim is the problem should resolve.... Nov 6 '19 at 7:12
• :-) Perhaps you can help me with this one: \makeatletter \e@level@one@skip=1\baselineskip \@plus .2ex \e@level@two@skip=1\baselineskip \@plus 0.2ex \makeatother --- how can I define normalfont? for level one. That's all I need for getting 3 levels formatted then Nov 6 '19 at 7:14
• Thanks again Mady, this works for me: pastebin.com/CPfJhygi Nov 6 '19 at 7:38
• that works!! Thank you again!! I wrote something like this, but used instead of \bfseries and \itshape textbf and textit which does not work. Nov 7 '19 at 15:49