我为 \part、\section 和 \subsection 创建了新的标题格式。现在我尝试在每个标题上方和下方插入垂直空格。对于 \part,它工作正常,而对于其他两个,上方的空格不起作用,但文本下方的空格起作用。这是为什么?
\documentclass[]{article}
\usepackage{titlesec}
%\usepackage{xcolor}
\usepackage{titletoc}
%\usepackage{enumitem}
\usepackage[a4paper]{geometry}
\usepackage{showframe}
%\usepackage{fancyhdr}
%\usepackage{nameref}
\newcommand\content{%
\titleformat{\part}
[block]
{\centering\Large\bfseries}
{\MakeUppercase{Section}\thepart\linebreak}
{1ex}
{\MakeUppercase}
\titlespacing{\part}{0pt}{2cm}{1cm}
\titleformat{\section}
[block]
{\centering\Large\bfseries}
{\MakeUppercase{Section} \thepart\thesection\linebreak}
{1ex}
{\MakeUppercase}
\titlespacing{\section}{0pt}{2cm}{1cm}
\titleformat{\subsection}
[block]
{\centering\Large\bfseries}
{\MakeUppercase{Section}\thepart\thesection\thesubsection\linebreak}
{1ex}
{\MakeUppercase}
\titlespacing{\subsection}{0pt}{2cm}{1cm}}
\newcommand\testtitle{%
\titleformat{\section}
[hang]
{\normalfont\normalsize\bfseries}
{\thepart\thesection}
{1ex}
{\MakeUppercase}
\titleformat{\subsection}
[hang]
{\normalfont\normalsize\bfseries}
{\thepart\thesubsection}
{1ex}
{\MakeUppercase}
\titleformat{\subsubsection}
[hang]
{\normalfont\normalsize\bfseries}
{\thepart\thesubsubsection}
{1ex}
{\MakeUppercase}}
\begin{document}
\content
\part{aet}
Lorem
\newpage
\section{ok}
Lorem
\newpage
\subsection{lorem}
Lorem
\end{document}