首页 > 解决方案 > 在乳胶中的 TOC 标题前添加一些空格

问题描述

我尝试在 TOC 之前添加一些空格,我使用\vspace了但它不起作用

\documentclass[12pt, french,a4paper]{report}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

\begin{document}
   %...
  \vspace*{.3\paperheight} %doesn't work
  \tableofcontents
   %...
  \chapter{chapitre}
  \section{section}
  \subsection{subsection}

  \newpage
  \chapter{chapitre}
  \section{section}
  \subsection{subsection}
\end{document}

有人有解决方案吗?

我在图片中的问题

标签: latexlatex-environment

解决方案


目录将自动在新页面上开始新章节。如果你\vspace在它之前使用,它仍然会在前一页上,对你的目录没有任何影响。但是,您可以更改 toc 的定义并在其中添加一些空格:

\documentclass[12pt, french,a4paper]{report}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

\makeatletter
\renewcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\vspace{5cm}\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
    }
\makeatother



\begin{document}
   %...
  \tableofcontents
   %...
  \chapter{chapitre}
  \section{section}
  \subsection{subsection}

  \newpage
  \chapter{chapitre}
  \section{section}
  \subsection{subsection}
\end{document}

推荐阅读