目录中的附录标签

目录中的附录标签

我正在使用该类book,并且有几个附录。这些附录的标题为“附录 A”、“附录 B”等,实际上所有字母都是小写字母。为了使标签 (A、B、...) 变为小写字母,我使用了\renewcommand{\thechapter}{{\normalfont\scshape \alph{chapter}}}。虽然这样做效果很好,但它也会将目录中的附录标签更改为小写字母,而这并不是我想要的。我不知道如何避免这种情况。有没有人知道一个包或一个技巧,可以让标签 A、B 等在目录中显示为正常大写字母?

以下重现了该问题:

\documentclass[11pt,b5paper,twoside,dvipsnames]{book}
\RequirePackage{luatex85}
\usepackage{titlesec}
\usepackage[top=1.2in,bottom=1.15in,right=1.15in,left=1.15in,headheight=50pt,headsep=4mm]{geometry}
\usepackage[american]{babel}
\usepackage[titletoc]{appendix}

\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}

\usepackage[no-math]{fontspec}
\setmonofont[Scale=.753]{DejaVu Sans Mono}
\usepackage{ebgaramond}
\usepackage[cmintegrals,cmbraces]{newtxmath}
\usepackage{ebgaramond-maths}
\usepackage{anyfontsize}
\usepackage[italic,defaultmathsizes,nolessnomore]{mathastext}
\defaultfontfeatures{RawFeature={+calt,+clig,+dlig,liga,cv06}}

\usepackage{fancyhdr}
\pagestyle{fancy}
%\setlength{\headheight}{15pt}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\, #1}}
\fancyhf{} % delete current setting for header and footer
\fancyhead[LE,RO]{\thepage}
\fancyhead[CO]{\textit{\rightmark}}
\fancyhead[CE]{\leftmark}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{50pt} % make space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
}

\titleformat{\chapter}[display]{}
    {\filcenter\normalfont\romanspaced\large\scshape chapter\ \thechapter}
    {.2cm}
    {\normalfont\Large\romanspaced\itshape\filcenter}
    
\usepackage{titlesec}
\titleformat{\section}[block]{\bfseries\filcenter}{\thesection}{1em}{}
\titleformat{\subsection}[block]{\itshape\filcenter}{\thesubsection}{1em}{}

\begin{document}

\author{\Large Author}
\date{}

\frontmatter

\title{\Huge \textsc{title} \\[5cm] {}}

\maketitle

\begingroup
\defaultfontfeatures{Ligatures={NoContextual}}
\setmainfont{EB Garamond}[
  Numbers={OldStyle,Monospaced},
]
\fancyhead[C]{\emph{Contents}}
\tableofcontents
\endgroup

\pagestyle{fancy}

\chapter{Preface}

\fancyhead[CE]{\leftmark}

Some text here ...

\mainmatter

\pagestyle{fancy}

\fancyhead[CE]{\leftmark}
\fancyhead[CO]{\textit{\rightmark}}

\chapter{Introduction}

Some more text ...

\chapter{Second chapter}

... and more ...

\appendix

\renewcommand{\thechapter}{{\textsc{\alph{chapter}}}}

\titleformat{\chapter}[display]{}
    {\filcenter\normalfont\romanspaced\large\scshape appendix \thechapter}
    {.2cm}
    {\normalfont\Large\romanspaced\itshape\filcenter}

\appendixpage
\noappendicestocpagenum
\addappheadtotoc

\chapter{Proof of Theorem 1}

... still more text ...

\chapter{Proof of Theorem 2}

... and more ...

\end{document}

答案1

对于您的示例,一个足够的解决方案是在 \tableofcontents 之前重新定义 \textsc(同时确保整体被分组,因此重新定义仍然是本地的):

{\renewcommand{\textsc}[1]{\MakeUppercase #1}
\tableofcontents
}

当目录中需要使用小型大写字母时,就需要采用一些更加精细的方法。

相关内容