如何在表格列表中每个表名的第一行后添加缩进?

如何在表格列表中每个表名的第一行后添加缩进?

我想在表格列表中的每个表格名称的第一行后添加缩进,如下图所示。该怎么做?

在此处输入图片描述

进入这个

在此处输入图片描述

这是我的代码:

\documentclass[a5paper,11pt]{book}
%\usepackage{newtxtext,newtxmath}
\usepackage[margin=1.5cm, inner=2.5cm]{geometry}
\usepackage{tocbasic}
\usepackage{times}
\usepackage[bookmarks=true]{hyperref}% load as last package
\usepackage{caption}
\usepackage{multirow}
\usepackage{setspace}
\DeclareTOCStyleEntry[
linefill=\bfseries\TOCLineLeaderFill,
beforeskip=0pt,
entrynumberformat=\chapterprefixintoc,
dynnumwidth
]{tocline}{chapter}

\newcommand*\chapterprefixintoc[1]
{\MakeUppercase{\chaptername}~#1\enskip}

\begin{document}
    \cleardoublepage
    \phantomsection\addcontentsline{toc}{chapter}{CONTENTS}
    \tableofcontents

    %=========TABLE======================
    \newpage\phantomsection\addcontentsline{toc}{chapter}{DAFTAR TABEL}
    \setcounter{page}{15}
    \begin{singlespacing}
        \let\oldnumberline\numberline%
        \renewcommand{\numberline}{\tablename~\oldnumberline}%
        \listoftables\end{singlespacing}
    \newpage
    \null\vfill
    %===========================================

    \chapter{PENDAHULUAN}
    contents...
    \section{Latar Belakang}
    contents...
    \subsection{ABCD}
    contents
    \subsection{EFGH}
    ...
    \section{Rumusan Masalah}
    \vspace{0.3cm}
    blablabla
    \section{Tujuan Penulisan}
    \vspace{0.25cm}
    blablabla..

    \chapter{DASAR TEORI}
    contents...
    \chapter{PEMBAHASAN}

    \begin{table}[htbp]
        \captionsetup{
            font=footnotesize,
            justification=raggedright,
            singlelinecheck=false
        }
        \caption{Naik dan turunnya nilai parameter $\beta,\alpha,\omega$ sebesar $10\%$, menaikkan dan menurunkan nilai $R_0$ sebesar $10\%$}\label{tabel3}
        \begin{tabular}{|c|c|c|c|}
            \hline
            \multirow{2}{*}{No}&\multirow{2}{*}{Parameter} & \multicolumn{2}{c|}{Nilai $R_0$}\\\cline{3-4}
            &&$p+10\%$&$p-10\%$\\
            \hline
            1 & $\beta$ & $4.18539$ & $3.42441$\\
            \hline
            2 & $\alpha$ & $3.83536$ & $3.77342$\\
            \hline
            3 & $\omega$ & $3.99695$ & $3.59932$\\
            \hline
        \end{tabular}
    \end{table}
    \begin{table}[htbp]
        \captionsetup{
            font=normalsize,
            justification=raggedright,
            singlelinecheck=false
        }
        \caption{Naik dan turunnya nilai parameter $\phi,\rho$ sebesar $10\%$, menaikkan dan menurunkan nilai $R_0$ sebesar $10\%$}\label{tabel4}
        \begin{tabular}{|c|c|c|c|}
            \hline
            \multirow{2}{*}{No}&\multirow{2}{*}{Parameter} & \multicolumn{2}{c|}{Nilai $R_0$}\\\cline{3-4}
            &&$p+10\%$&$p-10\%$\\
            \hline
            1 & $\phi$ & $3.58773$ & $4.05005$\\
            \hline
            2 & $\rho$ & $3.68281$ & $3.93536$\\
            \hline
        \end{tabular}
    \end{table}
    \chapter{PENUTUP}
    contents...
    \chapter*{BIBLIOGRAPHY}
    \addcontentsline{toc}{chapter}{BIBLIOGRAPHY}
    contents
\end{document}

答案1

使用包,tocbasic您可以使用\DeclareTOCStyleEntryfortablefigure添加前缀并numwidth使用选项自动设置dynnumwidth

\documentclass[a5paper,11pt]{book}

\usepackage[margin=1.5cm, inner=2.5cm]{geometry}
\usepackage{tocbasic}
\usepackage{newtxtext,newtxmath}% instead times
\usepackage{caption}
\usepackage{multirow}
\usepackage{setspace}

\usepackage[bookmarks=true]{hyperref}% load as last package

\DeclareTOCStyleEntry[
  linefill=\bfseries\TOCLineLeaderFill,
  beforeskip=0pt,
  entrynumberformat=\useprefix{\MakeUppercase{\chaptername}},
  dynnumwidth
]{tocline}{chapter}
\DeclareTOCStyleEntry[
  indent=0pt,
  entrynumberformat=\useprefix{\tablename},
  dynnumwidth
]{tocline}{table}
\DeclareTOCStyleEntry[
  indent=0pt,
  entrynumberformat=\useprefix{\figurename},
  dynnumwidth
]{tocline}{figure}

\newcommand*\useprefix[2]
  {#1~#2\enskip}

\begin{document}
    \cleardoublepage
    \phantomsection\addcontentsline{toc}{chapter}{CONTENTS}
    \tableofcontents

    %=========TABLE======================
    \newpage\phantomsection\addcontentsline{toc}{chapter}{DAFTAR TABEL}
    \setcounter{page}{15}
    \begin{singlespacing}
        \let\oldnumberline\numberline%
        \renewcommand{\numberline}{\tablename~\oldnumberline}%
        \listoftables
    \end{singlespacing}
    \newpage
    \null\vfill
    %===========================================

    \chapter{PENDAHULUAN}
    contents...
    \section{Latar Belakang}
    contents...
    \subsection{ABCD}
    contents
    \subsection{EFGH}
    ...
    \section{Rumusan Masalah}
    \vspace{0.3cm}
    blablabla
    \section{Tujuan Penulisan}
    \vspace{0.25cm}
    blablabla..

    \chapter{DASAR TEORI}
    contents...
    \chapter{PEMBAHASAN}

    \begin{table}[htbp]
        \captionsetup{
            font=footnotesize,
            justification=raggedright,
            singlelinecheck=false
        }
        \caption{Naik dan turunnya nilai parameter $\beta,\alpha,\omega$ sebesar $10\%$, menaikkan dan menurunkan nilai $R_0$ sebesar $10\%$}\label{tabel3}
        \begin{tabular}{|c|c|c|c|}
            \hline
            \multirow{2}{*}{No}&\multirow{2}{*}{Parameter} & \multicolumn{2}{c|}{Nilai $R_0$}\\\cline{3-4}
            &&$p+10\%$&$p-10\%$\\
            \hline
            1 & $\beta$ & $4.18539$ & $3.42441$\\
            \hline
            2 & $\alpha$ & $3.83536$ & $3.77342$\\
            \hline
            3 & $\omega$ & $3.99695$ & $3.59932$\\
            \hline
        \end{tabular}
    \end{table}
    \begin{table}[htbp]
        \captionsetup{
            font=normalsize,
            justification=raggedright,
            singlelinecheck=false
        }
        \caption{Naik dan turunnya nilai parameter $\phi,\rho$ sebesar $10\%$, menaikkan dan menurunkan nilai $R_0$ sebesar $10\%$}\label{tabel4}
        \begin{tabular}{|c|c|c|c|}
            \hline
            \multirow{2}{*}{No}&\multirow{2}{*}{Parameter} & \multicolumn{2}{c|}{Nilai $R_0$}\\\cline{3-4}
            &&$p+10\%$&$p-10\%$\\
            \hline
            1 & $\phi$ & $3.58773$ & $4.05005$\\
            \hline
            2 & $\rho$ & $3.68281$ & $3.93536$\\
            \hline
        \end{tabular}
    \end{table}
    \chapter{PENUTUP}
    contents...
    \chapter*{BIBLIOGRAPHY}
    \addcontentsline{toc}{chapter}{BIBLIOGRAPHY}
    contents
\end{document}

请注意,我已将章节更改为使用与和entrynumberformat相同的命令。\withprefixfiguretable

运行三次即可获得

在此处输入图片描述

相关内容