부분/섹션/하위 섹션 위와 아래에 수직 간격이 있는 Titlesec

부분/섹션/하위 섹션 위와 아래에 수직 간격이 있는 Titlesec

나는 \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}

관련 정보