![目录的标题大小写](https://linux22.com/image/381215/%E7%9B%AE%E5%BD%95%E7%9A%84%E6%A0%87%E9%A2%98%E5%A4%A7%E5%B0%8F%E5%86%99.png)
我在用教派和标题大写软件包将我的章节标题转换为标题大小写。但是,目录保持不变。我希望我的目录也以标题大小写显示。
这是 MWE
\documentclass{book} % The default font size and one-sided printing (no margin offsets)
% packages for setting section headings to titles caps
\usepackage{sectsty}
\usepackage{titlecaps}
\sectionfont{\titlecap}
\subsectionfont{\titlecap}
\subsubsectionfont{\titlecap}
\begin{document}
\tableofcontents
\section{This should be in upper case}
It is!
\subsection{a sub section}
here it is
\subsubsection{a sub sub section}
here it is
\section{This should \o be in title case}
It is!
\end{document}
答案1
将\sectionfont
和替换\subsectionfont
为
\let\oldsection\section
\def\section#1{\oldsection{\titlecap{#1}}}
\let\oldsubsection\subsection
\def\subsection#1{\oldsubsection{\titlecap{#1}}}
产量:
代码:
\documentclass{book} % The default font size and one-sided printing (no margin offsets)
% packages for setting section headings to titles caps
\usepackage{sectsty}
\usepackage{titlecaps}
%\sectionfont{\titlecap}
%\subsectionfont{\titlecap}
\subsubsectionfont{\titlecap}
\let\oldsection\section
\def\section#1{\oldsection{\titlecap{#1}}}
\let\oldsubsection\subsection
\def\subsection#1{\oldsubsection{\titlecap{#1}}}
\begin{document}
\tableofcontents
\section{This should be in upper case}
It is!
\subsection{a sub section}
here it is
\subsubsection{a sub sub section}
here it is
\section{This should \o be in title case}
It is!
\subsection{er\"ods-r\'enyi random graph model}
\end{document}