图表列表添加垂直空间,包含新部分

图表列表添加垂直空间,包含新部分

当我有新的零件时,我试图删除图形列表中添加的垂直空间。

这是我在添加新章节时删除垂直空间的方法:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{}
\makeatother

我原本以为我可以使用相同的方法来消除零件的垂直空间,但当我查看 report.cls 时,我没有\addtocontents{lof}{\protect\addvspace{10\p@}}在“零件”部分找到任何地方。所以我不知道从哪里可以删除这个空间。

这是我的 MWE 以及我的文档其余部分的序言。

\documentclass[12pt]{report}
\usepackage[left=1.0in, right=1.0in, top=1.0in, bottom=1.0in]{geometry}

% including package for figures
\usepackage{float}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[capitalise,noabbrev]{cleveref}
\usepackage{wrapfig}

% indent first paragraph
\usepackage{indentfirst}

% change table of contents and list of figures spacing
\usepackage{titletoc}
\setcounter{tocdepth}{2}
\titlecontents{part}[0em]{\addvspace{1pc}\bfseries}{\contentslabel{2em}}{} {\titlerule*[1pc]{.}\contentspage}
\titlecontents{chapter}[4em]{\addvspace{.7pc}\bfseries}{\contentslabel{2em}}{} {\titlerule*[1pc]{.}\contentspage}
\titlecontents{section}[6em]{\addvspace{.4pc}\bfseries}{\contentslabel{2em}}{} {\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsection}[9em]{\addvspace{.1pc}\bfseries}{\contentslabel{3em}}{} {\titlerule*[1pc]{.}\contentspage}
\titlecontents{figure}[2.5em]{\addvspace{.1pc}\bfseries}{\contentslabel{2.5em}}{} {\titlerule*[1pc]{.}\contentspage}

% change spacing of part, chapter, section, and subsection headings
\usepackage{xcolor}
\usepackage{titlesec}
\titleclass{\part}{top}
\titleformat{\part}[hang]{\normalfont\huge\bfseries\color{red}}{Chapter\ \thepart:}{5pt}{}   
\titlespacing*{\part}{0pt}{0pt}{0pt}

\titleformat{\chapter}[hang]{\centering\normalfont\LARGE\bfseries\color{blue}}{Section\ \thechapter:}{5pt}{}   
\titlespacing*{\chapter}{0pt}{12pt}{0pt}

\titleformat{\section}[hang]{\normalfont\Large\bfseries\color{black}}{\thesection}{5pt}{}   
\titlespacing*{\section}{0em}{12pt}{0pt}

\titleformat{\subsection}[hang]{\centering\normalfont\large\bfseries\color{black}}{}{5pt}{}   
\titlespacing*{\subsection}{0em}{12pt}{0pt}

% remove new page as start of new chapter
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{}
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       End Of Preamble and start of document           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

    \tableofcontents
    \listoffigures

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \part{Part Title}
        Some text in part \thepart.

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \chapter{Chapter Title}
            Some text in part \thepart chapter \thechapter.
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \chapter{Chapter Title}
            Some text in part \thepart chapter \thechapter.
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \part{Part Title}
        Some text in part \thepart.

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \chapter{Chapter Title}
            Some text in part \thepart chapter \thechapter.
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \chapter{Chapter Title}
            Some text in part \thepart chapter \thechapter.
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}
            \begin{figure}[H]
                \centering\includegraphics[width=0.15\textwidth]{Untitled.png}
                \caption{Figure in part \thepart\space chapter \thechapter}
            \end{figure}


\end{document}

这是正在制作的图片。我希望“第 I 部分第 2 章中的 2.2 图”和“第 II 部分第 3 章中的 3.1 图”之间没有间隙。

在此处输入图片描述

请给我一些建议,告诉我可以从哪里删除这个额外的垂直空间。

在此先感谢您的帮助。

答案1

您只需查看 lof 文件:该空间由命令创建\ttl@tocsep,您可以简单地重新定义它,例如在之前\listoffigures

 \makeatletter\def\ttl@tocsep{}\makeatother

相关内容