当我使用下面的方法将部分文本变为大写时:
\makeatletter
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftsectionname}
}
\makeatother
我的章节和部分之间的间距被添加到与(回忆录中的目录间距):
\setlength{\cftbeforechapterskip}{12pt}
但如果我删除这些行:
\makeatletter
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftsectionname}
}
\makeatother
章节和部分之间的间距是正确的:
如何使目录部分标题大写,且不弄乱章节和部分之间的空格?
使用此完整代码,您可以在构建两次后重现该问题:
\documentclass{abntex2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% TOC Spacing in Memoir
% https://tex.stackexchange.com/questions/60317/toc-spacing-in-memoir
\setlength{\cftbeforechapterskip}{12pt}
\makeatletter
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftsectionname}
}
\makeatother
\begin{document}
\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\chapter{Chapter One}
\section{Section One One}
\subsection{Section One One}
\section{Section One Two}
\subsection{Section One Two}
\section{Section One Three}
\section{Section One Four}
\chapter{Chapter One}
\section{Section One One}
\section{Section One Two}
\section{Section One Three}
\section{Section One Four}
\end{document}
答案1
我设法使用针对article
我在如何使目录中的章节名称大写?:
\documentclass{memoir}
\usepackage{textcase}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\makeatletter
\let\oldcontentsline\contentsline
\def\contentsline#1#2{%
\expandafter\ifx\csname l@#1\endcsname\l@section
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{%
\oldcontentsline{#1}{\MakeTextUppercase{#2}}%
}{%
\oldcontentsline{#1}{#2}%
}%
}
\makeatother
\begin{document}
\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}
\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
\chapter{Chapter One}
\section{Section One One}
\subsection{Section One One}
\section{Section One Two}
\subsection{Section One Two}
\section{Section One Three}
\section{Section One Four}
\chapter{Chapter One}
\section{Section One One}
\section{Section One Two}
\section{Section One Three}
\section{Section One Four}
\end{document}
还必须从我的文件中删除以下声明:
\renewcommand*{\l@chapter}[2]
{%
\l@chapapp{\uppercase{#1}}{#2}{\cftchaptername}
}
\renewcommand*{\l@section}[2]
{%
\l@chapapp{\ABNTEXsectionfont\uppercase{#1}}{#2}{\cftsectionname}
}
它们是我所有问题的根源。我不知道为什么它们会滚动所有内容,因为这样会导致部分和章节之间的间距与章节之间的间距相同。
最后这应该是由于命令重新定义了\l@section
with \l@chapapp
,这无异于自找麻烦和奇怪的行为。
以下是回忆录类的相关参考资料及目录: