0

This is my code:

    \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}
Jan
  • 5,293
Eddy
  • 98
  • Welcome to TeX.SE. I am sorry, but I have no clue, what you are asking for. Please edit your question and add more details, especially a clear description, what you want to achieve. (If you have problems to find the right words, take a pencil, make a sketch, make a photo and upload that as help.) Where did you get that code from your MWE? The PDF produced from your example looks correct to me. – Jan Dec 06 '19 at 20:07
  • It's not correct. The space is not whay I want. Please run the code – Eddy Dec 06 '19 at 21:19
  • sorry, that I wanted to help, but was not able to understand your question. I am attempted to downvote your question. :-( – Jan Dec 07 '19 at 00:37

1 Answers1

1

Do not use titlesec and titletoc together with a KOMA-Script class. These classes load package tocbasic automatically. So you can use package tocbasic to change the layout of TOC and lists like LOF and 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}

Result:

enter image description here


Suggestion using the MWE from the question and the standard class book (because of a comment of the 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}
esdd
  • 85,675
  • I don't know what's wrong with my latex. I have copy your code, but I get an error "Undefined Control Sequence \DeclareTOCStyleEntry". – Eddy Dec 06 '19 at 21:17
  • Which KOMA-Script version do you use? \DeclareTOCStyleEntry was introduced in version 3.20 in 2016. Current version is 3.27. – esdd Dec 06 '19 at 21:38
  • I use the 2012 version. Any solution for this version? – Eddy Dec 06 '19 at 21:54
  • 1
    @Eddy update to the actual version of KOMA-Script? – Jan Dec 07 '19 at 00:44
  • @Eddy I do not have such an outdated version. But I think, option listof=nochaptergap should work anyway. So you can remove the additional space between entries of different chapters. Maybe the first mandatory argument of \titlecontents{figure} (the empty one in your code) can bei used to add vertical space before each figure entry. You should mention in your questions that you use such an old TeX version and outdated classes and packages. – esdd Dec 07 '19 at 01:49
  • @esdd. Ya, the option listof=nochaptergap is work. But the space for the line in one caption not yet. I'll try to mention it. Thank you. – Eddy Dec 07 '19 at 01:59
  • @Jan do you have solution for old versin? – Eddy Dec 07 '19 at 02:00
  • If \titlecontents{figure}[...]{\addvspace{18pt}}{...}{...}{...} does not work with the code in your question then maybe your titletoc version is outdated too. – esdd Dec 07 '19 at 02:13
  • @esdd how to make this code work in book class not scrbook class? – Eddy Dec 07 '19 at 04:31
  • @Eddy I have added a suggestion for book. But I do not know, if it works with your really very old TeX distribution. – esdd Dec 07 '19 at 21:25
  • @esdd if you don't mind, I want to try it. – Eddy Dec 08 '19 at 07:42
  • @esdd thank you very much. It work with my TeX. – Eddy Dec 08 '19 at 07:54