如何改变图形列表中的空格?

如何改变图形列表中的空格?

这是我的代码:

    \documentclass[12pt,twoside]{scrbook}
\usepackage{titlesec}
\usepackage{scrextend}
\usepackage[font=footnotesize,format=plain,up,textfont=up]{caption}
\captionsetup[figure]{labelsep=space}
\usepackage{tocbasic}
\usepackage{titletoc}%
%listoffigures
\renewcommand{\listfigurename}{DAFTAR GAMBAR}
\makeatletter
\renewcommand\listoffigures{%
  \null\hfill\textbf{\normalsize\listfigurename}\hfill\null\par
  \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
  \vspace{20pt}

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

\begin{document}
{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\figurename~\oldnumberline}%
\listoffigures%
}
\chapter{kkk}
\begin{figure}
\caption{This is the first}
\end{figure}
\chapter{LLLLLLLLLLLL}
\begin{figure}
\caption{This is the Second}
\end{figure}
\begin{figure}
\caption{I want to make the space in list of figure is 18pt.}
\end{figure}
\begin{figure}
\caption{For example, I want the space \textbf{Gambar 1.1} to \textbf{Gambar 2.1} is same with space \textbf{Gambar 2.1} to \textbf{Gambar 2.2}}
\end{figure}
\begin{figure}
\caption{That's mean, that space for each \textbf{Gambar} is same}
\end{figure}
\chapter{LLLLLLLLLLLL}
\begin{figure}
\caption{But, for case \textbf{Gambar 2.3} and this part, I want to make the space only 12pt. Because \textbf{Gambar 2.3} have 2 line in one caption}
\end{figure}
\end{document}

答案1

不要将titlesectitletoc与 KOMA-Script 类一起使用。这些类会tocbasic自动加载包。因此,您可以使用包tocbasic来更改 TOC 和 LOF 和 LOT 等列表的布局。

\documentclass[
  12pt,
  %twoside,% default
  listof=entryprefix,
  listof=nochaptergap,
  indonesian
]{scrbook}
\usepackage{babel}
%\usepackage{scrextend}% not needed for this example

\addtokomafont{caption}{\footnotesize}
\renewcommand{\captionformat}{\ }
\setcapindent{0pt}

\BeforeTOCHead[lof]{%
  \renewcommand*\raggedchapter{\centering}%
  \addtokomafont{chapter}{\normalsize\rmfamily}%
  \renewcommand\chapterlinesformat[3]{\MakeUppercase{#3}}%
  \RedeclareSectionCommand[beforeskip=\baselineskip,afterindent=false,afterskip=20pt]{chapter}%
}

\DeclareTOCStyleEntry[
  beforeskip=18pt
]{default}{figure}
\makeatletter\renewcommand\@dotsep{2.5}\makeatother

\begin{document}
\listoffigures
\chapter{kkk}
\begin{figure}
\caption{This is the first}
\end{figure}
\chapter{LLLLLLLLLLLL}
\begin{figure}
\caption{This is the Second}
\end{figure}
\begin{figure}
\caption{I want to make the space in list of figure is 18pt.}
\end{figure}
\begin{figure}
\caption{For example, I want the space \textbf{Gambar 1.1} to \textbf{Gambar 2.1} is same with space \textbf{Gambar 2.1} to \textbf{Gambar 2.2}}
\end{figure}
\begin{figure}
\caption{That's mean, that space for each \textbf{Gambar} is same}
\end{figure}
\chapter{LLLLLLLLLLLL}
\begin{figure}
\caption{But, for case \textbf{Gambar 2.3} and this part, I want to make the space only 12pt. Because \textbf{Gambar 2.3} have 2 line in one caption}
\end{figure}
\end{document}

结果:

在此处输入图片描述


建议使用问题中的 MWE 和标准班book(因为 OP 的评论):

\documentclass[12pt]{book}
\usepackage{titlesec}
\usepackage[font=footnotesize,format=plain,up,textfont=up]{caption}
\captionsetup[figure]{labelsep=space}
\usepackage{titletoc}%
\renewcommand{\listfigurename}{DAFTAR GAMBAR}
\makeatletter
\renewcommand\listoffigures{{%
  \let\oldnumberline\numberline%
  \renewcommand{\numberline}{\figurename~\oldnumberline}%
  \null\hfill\textbf{\normalsize\listfigurename}\hfill\null\par
  \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
  \vspace{20pt}

    \@starttoc{lof}%
}}
\titlecontents{figure}
  [2.5cm]
  {\addvspace{18pt}}
  {\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

\begin{document}
\listoffigures
\chapter{kkk}
\begin{figure}
\caption{This is the first}
\end{figure}
\chapter{LLLLLLLLLLLL}
\begin{figure}
\caption{This is the Second}
\end{figure}
\begin{figure}
\caption{I want to make the space in list of figure is 18pt.}
\end{figure}
\begin{figure}
\caption{For example, I want the space \textbf{Gambar 1.1} to \textbf{Gambar 2.1} is same with space \textbf{Gambar 2.1} to \textbf{Gambar 2.2}}
\end{figure}
\begin{figure}
\caption{That's mean, that space for each \textbf{Gambar} is same}
\end{figure}
\chapter{LLLLLLLLLLLL}
\begin{figure}
\caption{But, for case \textbf{Gambar 2.3} and this part, I want to make the space only 12pt. Because \textbf{Gambar 2.3} have 2 line in one caption}
\end{figure}
\end{document}

相关内容