In amsart
, how do you leave an additional \vspace{3mm}
between the heading 'Contents' and the Table of Contents?
-
Just for the ToC or alos for the List of Figures and List of Tables, for consistency's sake? – Gonzalo Medina Sep 21 '15 at 20:15
-
@GonzaloMedina, yes, also for LoF and LoT; thanks. – user87695 Sep 21 '15 at 20:50
Here's one option:
\documentclass{amsart}
\makeatletter
\def\@starttoc#1#2{\begingroup
\setTrue{#1}%
\par\removelastskip\vskip\z@skip
\@startsection{}\@M\z@{\linespacing\@plus\linespacing}%
{.5\linespacing}{\centering\contentsnamefont}{#2}%
\ifx\contentsname#2%
\vspace{3mm}% Here for the ToC only
\else \addcontentsline{toc}{section}{#2}\fi
%\vspace{3mm}% Here for all lists
\makeatletter
\@input{\jobname.#1}%
\if@filesw
\@xp\newwrite\csname tf@#1\endcsname
\immediate\@xp\openout\csname tf@#1\endcsname \jobname.#1\relax
\fi
\global\@nobreakfalse \endgroup
\addvspace{32\p@\@plus14\p@}%
\let\tableofcontents\relax
}
\makeatother
\begin{document}
\tableofcontents
\listoftables
\listoffigures
\section{Test section}
\begin{figure}
\caption{A test figure}
\end{figure}
\begin{table}
\caption{A test table}
\end{table}
\end{document}
use
\vspace{3mm}% Here for the ToC only
to add the spacing for the ToC only. Comment out the previous line and uncomment
%\vspace{3mm}% Here for all lists
if the addition must be also done for the LoF and the LoT.
-
Thanks. How do you do it for LoF and LoT? – user87695 Sep 21 '15 at 20:58
-
1@Ryo My answer already explains (read the final part) how to do it for LoF and Lot. – Gonzalo Medina Sep 21 '15 at 21:41
-
Right. Sorry, I didn't see
%\vspace{3mm}% Here for all lists
. Thanks again. – user87695 Sep 22 '15 at 11:27
For all ToC-related structures, the following patch from etoolbox
works:
\usepackage{etoolbox}
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@starttoc}{.5\linespacing}{5\baselineskip}{}{}
\makeatother
It replaces the existing vertical gap (of .5\linespacing
or 6pt) with 5\baselineskip
(or whatever you choose). If you want to only affect the ToC (and not the LoF or LoT), then you need to place the following before the above patch:
\makeatletter
\let\old@starttoc\@starttoc
\renewcommand{\listoffigures}{\old@starttoc{lof}\listfigurename}
\renewcommand{\listoftables}{\old@starttoc{lot}\listtablename}
\makeatother
Here is a complete example:
\documentclass{amsart}
\usepackage{etoolbox}
\makeatletter
\let\old@starttoc\@starttoc
\renewcommand{\listoffigures}{\old@starttoc{lof}\listfigurename}
\renewcommand{\listoftables}{\old@starttoc{lot}\listtablename}
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@starttoc}{.5\linespacing}{5\baselineskip}{}{}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\section{A section}
\begin{figure}
\caption{A figure caption}
\end{figure}
\end{document}