如何在章节名称目录中添加点

如何在章节名称目录中添加点

在此处输入图片描述

我怎样才能在章节 \addcontentsline 中添加点,就像在节和小节中添加点一样?

这是我的代码,我看到其他人主要使用 Tocloft 的问题,但我不知道如何在我的模板论文中使用 tocloft

\documentclass[12pt,a4paper]{report}
\usepackage[style=apa, backend=biber]{biblatex}
\addbibresource{reference.bib}

% for chapters
\usepackage{array}
\usepackage{makecell}
\usepackage{fancyhdr}
\usepackage{microtype}
\usepackage{tabto}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\usepackage{mathptmx}
\usepackage{graphicx} % Required for inserting images
\graphicspath{{img/}}
\usepackage{multirow}
\usepackage{caption}
\usepackage{longtable}

\usepackage{geometry}
\geometry{
    top=4cm,
    right=3cm,
    left=4cm,
    bottom=3cm, 
}

\usepackage{pdflscape}
\usepackage{everypage}
\usepackage{tabularray}
\usepackage{listings}
\lstset{
    basicstyle=\fontsize{10}{12}\selectfont\ttfamily,
    linewidth=\dimexpr\linewidth-2cm\relax,
    breaklines=true, % Margin bingkai kanan % Atur ukuran font dan jenis huruf
}
\usepackage[table]{xcolor}
\usepackage{setspace}
\doublespacing
\usepackage{everypage}
\AddEverypageHook{\ifdim\textwidth=\linewidth\else\rotatebox{90}{\thepage}\fi}


\renewcommand{\thechapter}{\centering \Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}

\def\contentsname{DAFTAR ISI}
\renewcommand\bibname{DAFTAR PUSTAKA}
\def\chaptername{BAB}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\bfseries\centering}{\MakeUppercase{\chaptertitlename}~\thechapter}{0pt}{}
\titlespacing*{\chapter}{0pt}{-2pt}{16pt}

\renewcommand{\arraystretch}{1.5}

\renewcommand\thechapter{\Roman{chapter}}
\newcommand{\arabicchapter}{\arabic{chapter}}
\renewcommand\thesection{\arabic{section}}
\def\thesection{\arabic{chapter}.\arabic{section}}
\def\thetable{\arabic{table}}


\titleformat{\section}[block]{\bf\normalsize}{\thesection}{0.6em}{}
\titlespacing*{\section}{0pt}{5pt}{0pt}
\titleformat{\subsection}[block]{\bf\normalsize}{\thesubsection}{0.6em}{}
\titlespacing*{\subsection}{0pt}{5pt}{0pt}

\usepackage{setspace}
%\singlespacing
\doublespacing
%\doublespacing
%\setstretch{1.1}
\renewcommand{\tablename}{Tabel}
\renewcommand{\figurename}{Gambar}
\renewcommand{\thefigure}{\arabicchapter.\arabic{figure}}
\renewcommand{\thetable}{\arabicchapter.\arabic{table}}
\usepackage[breaklinks]{hyperref}
\renewcommand{\listfigurename}{DAFTAR GAMBAR}
\renewcommand{\listtablename}{DAFTAR TABEL}

\hyphenation{me-la-in-kan}

\input{settings}
\begin{document}
\singlespacing
\input{cover}
\clearpage
\pagenumbering{roman}
\onehalfspacing
\input{pengesahan}
\input{pernyataan}
\input{katapengantar}
%\input{pengesahanpenguji}
\newpage
\doublespacing
\tableofcontents
\addcontentsline{toc}{chapter}{DAFTAR ISI}

\singlespacing
\listoftables
\addcontentsline{toc}{chapter}{\listtablename}

\listoffigures
\addcontentsline{toc}{chapter}{\listfigurename}


\singlespacing
\input{abstrak}
\input{abstract}
\clearpage
\doublespacing
\pagestyle{myheadings}
\makeatletter
\renewcommand{\sectionmark}[1]{\markboth{}{\bfseries}}
\pagenumbering{arabic}
% \setcounter{page}{1}
\input{bab1}
\input{bab2}
\input{bab3}
\input{bab4}
\input{bab5}

\onehalfspacing
\renewcommand{\bibname}{Daftar Pustaka}
\printbibliography
\addcontentsline{toc}{chapter}{DAFTAR PUSTAKA}
\end{document}

答案1

请在序言部分(之前\begin{document})添加以下几行:

\renewcommand{\thechapter}{\arabic{chapter}.}

\renewcommand{\thesection}{\thechapter\arabic{section}.}

\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}

结果是:

toc 示例

brg,d

相关内容