如何刪除圖表清單之前的空格

如何刪除圖表清單之前的空格

如何刪除「圖形清單」頁面中「圖形清單」之前的空格。我正在使用報告類。

謝謝

答案1

負責放置 LoF 標題的巨集是\@makeschapterhead,與列印加星號的章節 ( ) 時涉及的巨集相同\chapter*

因此,實現您想要的效果的一種方法是\@makeschapterhead先前進行修補\listoffigures,以刪除間距,然後將其修補回來以恢復原始行為。

執行此操作的程式碼如下(需要etoolbox):

\let\oldlistoffigures\listoffigures
\makeatletter
\renewcommand{\listoffigures}{%
  \patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{\relax}{}{}%
  \oldlistoffigures%
  \patchcmd{\@makeschapterhead}{\relax}{\vspace*{50\p@}}{}{}%
}  
\makeatother

完整的 MWE:

\documentclass{report}

\usepackage{showframe} % just for the example

\usepackage{etoolbox}

\let\oldlistoffigures\listoffigures
\makeatletter
\renewcommand{\listoffigures}{%
  \patchcmd{\@makeschapterhead}{\vspace*{50\p@}}{\relax}{}{}%
  \oldlistoffigures%
  \patchcmd{\@makeschapterhead}{\relax}{\vspace*{50\p@}}{}{}%
}  
\makeatother

\begin{document}

\listoffigures

\chapter*{Test}

\end{document} 

輸出:

在此輸入影像描述

相關內容