目录的标题大小写

目录的标题大小写

我在用教派标题大写软件包将我的章节标题转换为标题大小写。但是,目录保持不变。我希望我的目录也以标题大小写显示。

这是 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}

相关内容