为什么我不能修改子部分样式(使用 titlesec)?

为什么我不能修改子部分样式(使用 titlesec)?

我正在尝试为我的文档创建一个新的布局,并且我正在使用 titlesec 包。

我可以设法修改部分和子部分的样式,但我不明白为什么我不能修改子部分的样式。我做了完全一样的事情(我认为)。我希望子部分的标题具有相同的样式。

我的代码有错误吗?你知道我该如何解决我的问题吗?

谢谢。

以下是我的示例:

\documentclass[a4paper, 11pt]{report}
\usepackage[a4paper,inner=3cm,outer=2cm,top=2cm,bottom=3cm]{geometry}       

%----------LANGUAGE-------------------
\usepackage[french]{babel}

%----------INPUT TYPOS----------------      
\usepackage[T1]{fontenc}        
\usepackage[utf8]{inputenc}

\usepackage{lipsum}

%----------DRAW & FIGURES ------------
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usepackage{tkz-tab}

%---============================================= DOCUMENT LAYOUT =============================================---
\usepackage{color}
\usepackage{titlesec} 

%----------SECTION STYLE-------------------------
\newcommand\titlebarsection{%
\tikz[baseline,trim left=2cm,trim right=3cm] {
        \fill [lightgray](2.5cm,-2.3mm) rectangle (\textwidth+2cm,5.5mm);
        \fill [lightgray](\textwidth+2cm,5.5mm) arc[radius=11pt,start angle= 90,end angle= -90];
        \node [fill=black,
                     anchor= base east,
                     rounded rectangle,
                     minimum height=3.5ex] at (3cm,0) 
            {
                \textcolor{lightgray}{\textbf{\arabic{chapter}.\thesection.}}
            };
    }%
}
\titleformat{\section}{\bfseries\scshape\Large}{\titlebarsection}{0.1cm}{\color{black}}

\renewcommand*{\thesection}{\arabic{section}}

%----------SUBSECTION STYLE----------------------
\newcommand\titlebarsubsection{%
\tikz[baseline,trim left=1.8cm,trim right=3cm] {
        \fill [black](2.2cm,-1.65mm) rectangle (\textwidth+2cm,4.35mm);
        \fill [black](\textwidth+2cm,4.35mm) arc[radius=8.5pt,start angle= 90,end angle= -90];
        \node [fill=black,
                     anchor= base east,
                     rounded rectangle,
                     minimum height=2.5ex] at (3cm,0) 
            {
                \textcolor{lightgray}{\textbf{\arabic{chapter}.\thesubsection.}}
            };
    }%
}
\titleformat{\subsection}{\bfseries\scshape\large}{\titlebarsubsection}{0.1cm}{\color{lightgray}}

%----------SUBSUBSECTION STYLE-------------------
\newcommand\titlebarsubsubsection{%
\tikz[baseline,trim left=2.2cm,trim right=3cm]
  {
        \fill [lightgray](2.2cm,2.2ex) arc [radius=2pt,start angle= 90,end angle= 270];
        \fill [lightgray](2.2cm,-0.8ex) rectangle (\textwidth+2cm,2.3ex);
        \fill [lightgray](\textwidth+2cm,2.3ex) arc[radius=2pt,start angle= 90,end angle= -90];
        \node [fill=lightgray,
                     anchor= base east,
                     rounded rectangle,
                     minimum height=2.5ex] at (3cm,0) 
            {
                \textcolor{black}{\textbf{\thesubsubsection.}}
            };
    }%
}
\titleformat{\subsubsection}{\bfseries}{\titlebarsubsubsection}{0.1cm}{\color{black}}


\begin{document}
\pagenumbering{arabic}

\chapter{Chapter One}

\section{Section A}

\subsection{Subsection AA}
\subsection{Subsection AB}
\subsubsection{Subsubsection ABA}
\lipsum
\subsubsection{Subsubsection ABB}
\subsubsection{Subsubsection ABC}

\subsection{Subsection AC}
\subsubsection{Subsubsection ACA}
\subsubsection{Subsubsection ACB}
\subsubsection{Subsubsection ACC}

\end{document}

相关内容