圖列表新增了新零件的垂直空間

圖列表新增了新零件的垂直空間

當我有新零件時,我試圖刪除在圖形清單中新增的垂直空間。

這就是我在添加新章節時刪除垂直空間的方法:

\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}

這是正在生產的產品的圖片。我希望「第一部分第 2 章中的 2.2 圖」和「第二部分第 3 章中的 3.1 圖」之間沒有間隙。

在此輸入影像描述

請給我任何建議,告訴我可以從哪裡刪除這個額外的垂直空間。

預先感謝您的任何幫助。

答案1

您只需要查看 lof 檔案: 該空間是由命令建立的\ttl@tocsep,您可以簡單地在以下命令之前重新定義它\listoffigures

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

相關內容