[Tex/LaTex] How to get new TOC format

table of contents

This is what I want :

                    CONTAINT 

CONTAINT .............................................................. i

TABLE ...................................................................... ii

FIGURE .................................................................... iii

APPENDIX ................................................................ iv

CHAPTER I   PENDAHULUAN .................................... 1 

              1.1 Latar Belakang ................. 2
              1.2 Kontribusi ..................... 3
CHAPTER II  KAJIAN TEORI ...................................... 4

              2.1 Landasan Teori ................. 4
              2.2 Studi Pendahuluan .............. 5

I use the report class.
Could anyone help me please? I'm very beginner in LaTeX and I have to write a large document with LaTeX for my bachelor graduation.

my code doesn't work well :

\renewcommand{\cftchapfont}{\large\MakeUppercase} 
\makeatletter 
\renewcommand*\l@chapter[2]{% 
    \ifnum \c@tocdepth >\m@ne 
        \addpenalty{-\@highpenalty}% 
        \vskip 1.0em 
        \@plus\p@ 
        \setlength\@tempdima{4.5em}% 
        \begingroup 
            \parindent \z@ 
            \rightskip \@pnumwidth 
            \parfillskip -\@pnumwidth 
            \leavevmode \normalfont % mengganti bfseries menjadi normal font
            \advance\leftskip\@tempdima 
            \hskip -\leftskip 
            #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par 
            \penalty\@highpenalty 
        \endgroup
    \fi
}
\makeatother 

Best Answer

How about this:

\documentclass{report}
\usepackage{tocloft}
\usepackage{tikz}
\usepackage[left=20mm,right=40mm,top=40mm,bottom=20mm]{geometry}

\renewcommand\contentsname{CONTENTS}

\newcommand{\newchapter}[1]%
{   \renewcommand{\thechapter}{\Roman{chapter}}%
    \chapter{#1}%
    \renewcommand{\thechapter}{\arabic{chapter}}%
}
\setlength{\cftsecindent}{2.5cm}
\renewcommand{\cftchapdotsep}{4.5}   % same spacing as for sections

\renewcommand{\cftchapfont}{\bfseries}
\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftchapdotsep}}
\renewcommand{\cftchappagefont}{\bfseries}
\renewcommand{\cftchappresnum}{CHAPTER }
\renewcommand{\cftchapnumwidth}{2.8cm}

\begin{document}

\pagenumbering{Roman}
\addcontentsline{toc}{chapter}{TABLE OF CONTENTS}
\tableofcontents
\newpage

\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures
\newpage

\addcontentsline{toc}{chapter}{LIST OF TABLES}
\listoftables

\newpage
\addcontentsline{toc}{chapter}{APPENDIX}
\chapter*{APPENDIX}

\setcounter{chapter}{0}

\newchapter{FIRST CHAPTER}
    \setcounter{page}{1}
    \pagenumbering{arabic}

    \section{first section}
    \section{second section}

\newchapter{SECOND CHAPTER} 
    \section{third section}
    \section{fourth section}

\end{document}

enter image description here

It appears you want bigger right margins for \sections{}, but the tocloft manual states that it "should remain constant in any given document", so I'm not sure if you should change it. Probably there is another way?

The \newchapter{} just changes from arabic to roman for the chapter label itself, so the section labels are unaffected.