我该如何像这样在目录中设置章节?(我得到的和我想要的的比较在代码中)

我该如何像这样在目录中设置章节?(我得到的和我想要的的比较在代码中)
   \documentclass[twoside]{book}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\chaptername}{BAB}        
\makeatletter
\renewcommand{\@makechapterhead}[1]{        

{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\center \MakeUppercase{\normalsize\bfseries \@chapapp\space \thechapter}

\par\nobreak
\vskip 6\p@ 
\fi
\fi
\interlinepenalty\@M
\normalsize \uppercase{\bfseries #1\par\nobreak} 
\vskip 30\p@ 
}}
%

\makeatother                        
\usepackage{titlesec}
\renewcommand{\contentsname}{DAFTAR ISI}
   \makeatletter
\renewcommand\tableofcontents{%
  \null\hfill\textbf{\normalsize\contentsname}\hfill\null\par
  \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
  \vspace{30pt}
  \@starttoc{toc}%
}
\makeatother
\usepackage{titletoc}% 
\titlecontents{chapter}% <section-type>
  [0pt]% <left>
  {}% <above-code>
  {\bfseries\chaptername \thecontentslabel \qquad}% <numbered-entry-format>
  {\bfseries}% <numberless-entry-format>
  {\bfseries\hfill\contentspage}
\begin{document}
\tableofcontents

I want to make the chapter like this\\
\begin{tabular}{ll}
\textbf{BAB I} & \textbf{PPPP}\\
\textbf{BAB II} & \textbf{PPPP}\\
\textbf{BAB III} & \textbf{PPPP}\\
\textbf{BAB IV} & \textbf{PPPP}\\
\textbf{BAB V} & \textbf{PPPP}\\
\end{tabular}
\chapter{PPPP}
\chapter{PPPP}
\chapter{PPPP}
\chapter{PPPP}
\chapter{PPPP}
\end{document}

答案1

欢迎!使用此套餐非常简单eqparbox

 \documentclass[twoside]{book}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\chaptername}{BAB}
\makeatletter
\renewcommand{\@makechapterhead}[1]{

{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\center \MakeUppercase{\normalsize\bfseries \@chapapp\space \thechapter}

\par\nobreak
\vskip 6\p@
\fi
\fi
\interlinepenalty\@M
\normalsize \uppercase{\bfseries #1\par\nobreak}
\vskip 30\p@
}}
%

\makeatother
\usepackage{titlesec}
\renewcommand{\contentsname}{DAFTAR ISI}
 \makeatletter
 \renewcommand\tableofcontents{%
 \null\hfill\textbf{\normalsize\contentsname}\hfill\null\par
 \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
 \vspace{30pt}
 \@starttoc{toc}%
 }
\makeatother

\usepackage{eqparbox}

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

\begin{document}

\tableofcontents

\chapter{PPPP}
\chapter{PPPPF}
\chapter{PPPPFF}
\chapter{PPPPFFF}
\chapter{PPPPFFFF}

\end{document} 

在此处输入图片描述

相关内容