附录环境中没有章节编号的章节标题

附录环境中没有章节编号的章节标题

我在书本课上写论文,并通过使用子附录环境在各个章节后直接添加附录。对于正文,我使用了一种在章节内标记章节编号的格式没有前面的章节号。即,我没有使用“II.2 标题第 2 节”,而是使用“2 标题第 2 节”。请参阅下面的代码(章节标题部分,也位于目录中)。

我希望我的附录也能如此。我尝试了很多方法,比如在 中使用 counterwithout,\AtBeginEnvironment{subappendices}以及使用与普通章节相同的代码来更改章节标题。但子附录环境似乎对这些命令视而不见。结果是我的附录以章节编号开头(在正文和目录中都是):"IA 附录标题",而不是我想要的,只是 "A 附录标题"。

任何帮助将非常感激。

\documentclass[a4paper,twoside,12pt,openany]{book}

%subappendices
\usepackage{appendix}
\usepackage{chngcntr}
\usepackage{etoolbox}

\AtBeginEnvironment{subappendices}{%
%\counterwithout{section}{chapter}
%\titleformat{\section}{\bfseries\large}{\thesection}{20pt}{\bfseries\large}
\chapter*{Appendix}
\addcontentsline{toc}{section}{Appendix}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\counterwithin{equation}{section}
\renewcommand\theequation{\maybe{ 
\arabic{chapter}}\Alph{section}.\arabic{equation}}
\renewcommand\thechapter{\Roman{chapter}}
\DeclareRobustCommand\maybe[1] 
{\ifnum#1=\value{chapter}\relax\else\thechapter.\fi}
}

%table of contents
\usepackage{tocloft}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}



%chapter/section headings
\usepackage{titlesec}
\titleformat{\chapter}{\scshape\rmfamily\huge}{\thechapter}{20pt} 
{\centering\scshape\rmfamily\huge}
\titleformat{\section}{\bfseries\large}{\thesection}{20pt}{\bfseries\large}

\begin{document}

\tableofcontents

\chapter{Chapter 1}

\begin{subappendices}

\section{Title Appendix}

\end{subappendices}

\end{document}

相关内容