减少图表列表和表格列表上方的空间

减少图表列表和表格列表上方的空间

我有这段代码。问题是 \tableofcontents 上方的空间与 \listoffigure 和 \listoftables 上方的空间不同。\listoffigures 和 \listoftables 上方的空间小于 \tableofcontents 上方的空间。如何减少 \listoffigures 和 listoftables 中的空间,以使空间(与 \tableofcontents 上方)相同?

\documentclass[a4paper]{book}
    \usepackage{tocbasic}
    \renewcommand{\contentsname}{DAFTAR ISI}
    % Redefinition of ToC command to get centered heading
    \makeatletter
    \renewcommand\tableofcontents{%
      \cleardoublepage\null\vspace{-12pt}\hfill\textbf{\large\contentsname}\hfill\null\par
      \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
      \vspace{30pt}
      \@starttoc{toc}%
    }
    \makeatother

    \usepackage{eqparbox} %membuat spasi chapter rata

    \usepackage{titletoc}%
    \titlecontents{chapter}% <section-type>
      [0pt]% <left>
      {\vspace{12pt}\bfseries}% <above-code>
      {\eqmakebox[TC][l]{\chaptername~\thecontentslabel }\quad}% <numbered-entry-format>
      {}% <numberless-entry-format>
      {\hfill\contentspage}[\vspace{0pt}]

      \titlecontents{section}[27mm]   
        {\vspace{0pt}\normalsize\normalfont} 
        {\contentslabel[\thecontentslabel]{24pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}  

      \titlecontents{subsection}[38mm]   
        {\vspace{0pt}\normalsize\normalfont} 
        {\contentslabel[\thecontentslabel]{30pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}  
    %listoffigures
    \renewcommand{\listfigurename}{DAFTAR GAMBAR}
    \cleardoublepage
    \makeatletter
    \renewcommand\listoffigures{{%
      \let\oldnumberline\numberline%
      \renewcommand{\numberline}{\figurename~\oldnumberline}%
      \null\vspace{-24pt}\hfill\textbf{\fontsize{14}{12}\selectfont\listfigurename}\hfill\null\par
      \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
      \vspace{20pt}

        \@starttoc{lof}%
    }}

    \titlecontents{figure}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Gambar~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}

    % from https://tex.stackexchange.com/a/275577:
    \usepackage{xpatch}
    \makeatletter
    \xpatchcmd{\@chapter}{%
      \addtocontents{lof}{\protect\addvspace{10\p@}}%
      \addtocontents{lot}{\protect\addvspace{10\p@}}%
    }{}{}{}
    \makeatother

    %listoftables
    \renewcommand{\listtablename}{DAFTAR TABEL}
    \cleardoublepage{}
    \makeatletter
    \renewcommand\listoftables{%
      \null\hfill\textbf{\large\listtablename}\hfill\null\par
      \@mkboth{\MakeUppercase\listtablename}{\MakeUppercase\listtablename}%
      \vspace{20pt}

        \@starttoc{lot}%
    }
    \renewcommand{\listtablename}{DAFTAR TABEL}
    \cleardoublepage{}
    \makeatletter
    \renewcommand\listoffigures{{%
      \let\oldnumberline\numberline%
      \renewcommand{\numberline}{\figurename~\oldnumberline}%
      \null\hfill\textbf{\large\listfigurename}\hfill\null\par
      \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
      \vspace{20pt}

        \@starttoc{lof}%
    }}
    \titlecontents{table}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Tabel~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}

    % from https://tex.stackexchange.com/a/275577:
    \usepackage{xpatch}
    \makeatletter
    \xpatchcmd{\@chapter}{%
      \addtocontents{lof}{\protect\addvspace{10\p@}}%
      \addtocontents{lot}{\protect\addvspace{10\p@}}%
    }{}{}{}
    \makeatother
    \begin{document}
    \tableofcontents
    \cleardoublepage
    \listoftables
    \cleardoublepage
    \listoffigures
    \end{document}

答案1

我只是简单地复制了所有 titletoc 内容,没有检查或测试。

\documentclass[a4paper]{book}
    \usepackage{tocbasic}
    \renewcommand{\contentsname}{DAFTAR ISI}
    % Redefinition of \chapter* to change spacing and center title
\makeatletter
\def\@makeschapterhead#1{%
  \vspace*{-12\p@}% originally 50pt
  {\centering% could take more than one line
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 30\p@% originally 40pt
  }}
\makeatother

    \usepackage{eqparbox} %membuat spasi chapter rata

    \usepackage{titletoc}%
    \titlecontents{chapter}% <section-type>
      [0pt]% <left>
      {\vspace{12pt}\bfseries}% <above-code>
      {\eqmakebox[TC][l]{\chaptername~\thecontentslabel }\quad}% <numbered-entry-format>
      {}% <numberless-entry-format>
      {\hfill\contentspage}[\vspace{0pt}]

      \titlecontents{section}[27mm]   
        {\vspace{0pt}\normalsize\normalfont} 
        {\contentslabel[\thecontentslabel]{24pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}  

      \titlecontents{subsection}[38mm]   
        {\vspace{0pt}\normalsize\normalfont} 
        {\contentslabel[\thecontentslabel]{30pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}  
    %listoffigures
    \renewcommand{\listfigurename}{DAFTAR GAMBAR}

    \titlecontents{figure}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Gambar~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}

    % from https://tex.stackexchange.com/a/275577:
    \usepackage{xpatch}
    \makeatletter
    \xpatchcmd{\@chapter}{%
      \addtocontents{lof}{\protect\addvspace{10\p@}}%
      \addtocontents{lot}{\protect\addvspace{10\p@}}%
    }{}{}{}
    \makeatother

    %listoftables
    \renewcommand{\listtablename}{DAFTAR TABEL}

    \titlecontents{table}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Tabel~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}

    \usepackage{showframe}

    \begin{document}
    \tableofcontents
    \listoftables
    \listoffigures

    \end{document}

相关内容