我无法使用titlesec
subsection 和 subsubsection 获取正确的数字。如果我删除它们,titlesec
它们会显示出来。
输出如下
\documentclass[10pt]{report}
\usepackage[svgnames]{xcolor}
\definecolor{Burgundy}{HTML}{800020}
%-------------Title Chap & Section------------------------
\usepackage{titlesec}
%\titleformat{\section}[block]{\filleft\bfseries\Large}{\thesection.}{0.5em}{}
\titleformat{\subsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}
\titleformat{\subsubsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}
\titleformat
{\chapter} % command
[display] % shape
{\HUGE\bfseries\color{Burgundy}\raggedleft} % format
{\thechapter} % label
{20pt} % separation between label and chapter-title
{\Huge}[\vspace{2ex}] % before-code
\titleformat
{\section} % command
[block] % shape
{\Large\bfseries\color{Burgundy}\raggedleft} % format
{\thesection} % label
{0.5em} % separation between label and chapter-title
{\Large}[\vspace{1ex}] % before-code
\newcommand{\HUGE}{\fontsize{45}{12}\selectfont} % (the first number is the pt size of the font, the second number the space in pts between lines: this becomes the value of \baselineskip)
\titlespacing*{\chapter}{0pt}{\baselineskip}{\baselineskip}
\titlespacing*{\section}{0pt}{\baselineskip}{.7\baselineskip}%{6ex}{4ex}
\titlespacing*{\subsection}{0pt}{\baselineskip}{.7\baselineskip}%{6ex}{4ex}
\titlespacing*{\subsubsection}{0pt}{\baselineskip}{.7\baselineskip}%{6ex}{4ex}
%-------------------------------------------------------------------
\begin{document}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsection{Subsection}
\subsubsection{SubSubSection}
\subsubsection{SubSubSection}
\subsubsection{SubSubSection}
\subsubsection{SubSubSection}
\end{document}
答案1
根据@daleif
错误提供的信息,使用名称命名子节和子子节\thesection
而不是这个
\titleformat{\subsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}
\titleformat{\subsubsection}[block]{\filleft\bfseries\large}{\thesection.}{0.5em}{}
它应该是
\titleformat{\subsection}[block]{\filleft\bfseries\large}{\thesubsection.}{0.5em}{}
\titleformat{\subsubsection}[block]{\filleft\bfseries\large}{\thesubsubsection.}{0.5em}{}