TeX - LaTeX Asked by edvard on February 23, 2021
I am using the book
class and have several appendices. These are titled ‘Appendix A’, ‘Appendix B’, etc., where actually all letters are small caps. To achieve small caps for the labels (A, B, …), I use renewcommand{thechapter}{{normalfontscshape alph{chapter}}}
. While that works fine, it also changes the appendix labels in the table of contents to small caps, which I don’t want. I can’t figure out how to avoid this. Does anyone know of a package, or a trick, that would make the labels A, B, etc., appear as normal capitals in the toc?
The following reproduces the problem:
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}{protectsetcounter{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]{}
{filcenternormalfontromanspacedlargescshape chapter thechapter}
{.2cm}
{normalfontLargeromanspaceditshapefilcenter}
usepackage{titlesec}
titleformat{section}[block]{bfseriesfilcenter}{thesection}{1em}{}
titleformat{subsection}[block]{itshapefilcenter}{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]{}
{filcenternormalfontromanspacedlargescshape appendix thechapter}
{.2cm}
{normalfontLargeromanspaceditshapefilcenter}
appendixpage
noappendicestocpagenum
addappheadtotoc
chapter{Proof of Theorem 1}
... still more text ...
chapter{Proof of Theorem 2}
... and more ...
end{document}
A sufficient solution for your example would be to redefine textsc just before tableofcontents (while ensuring that the whole is grouped, so the redefinition remains local):
{renewcommand{textsc}[1]{MakeUppercase #1}
tableofcontents
}
Something more refined would be called for in cases where small caps are needed somewhere in the toc.
Answered by Mark van Atten on February 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP