我在用教派和标题大写软件包将我的章节标题转换为标题大小写。但是,目录保持不变。我希望我的目录也以标题大小写显示。
这是 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}