# How to get new TOC format?

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
\vskip 1.0em
\@plus\p@
\setlength\@tempdima{4.5em}%
\begingroup
\parindent \z@
\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \normalfont % mengganti bfseries menjadi normal font
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi
}
\makeatother

-
The tocloft package can do this quite easily. If you search for 'tocloft' on the site you can find many examples of it in use. –  Alan Munn Aug 10 '11 at 4:24
Perhaps you could explain what you mean by your code "doesn't work well". It doesn't compile? What error do you get? It compiles but doesn't look right? Where are the problems? –  Seamus Aug 10 '11 at 9:51

\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{\cftchappagefont}{\bfseries}
\renewcommand{\cftchappresnum}{CHAPTER }
\renewcommand{\cftchapnumwidth}{2.8cm}

\begin{document}

\pagenumbering{Roman}
\tableofcontents
\newpage

\listoffigures
\newpage

\listoftables

\newpage
\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}


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.

-
wow, that's great, thanks for this, I'll try than for both at TexMaker and Lyx –  Verly Aug 20 '11 at 5:13
Hii Tom, I've tried yours and as expected it running well in my Texmaker. But I have a problem when I use it in Lyx. I put the code in the preamble. No warning error. but I got my toc with no "chapter". it seem the code "\renewcommand{\cftchappresnum}{CHAPTER }" doesn't work in my Lyx. I use the same class,report. could you help me Tom? –  Verly Aug 28 '11 at 13:48
I don't use Lyx, but potentially I had something to do with missing %? I added them at the end of each line, please try again? –  Tom Bombadil Aug 28 '11 at 15:04
I'm sorry Tom, It seems I really need yor help, can I sent my code to your e-mail ? I create a class file and I combine with your code, it works well when I use it without tocloft package, but when I use that package, all of the format are unformatted. could you help me please? –  Verly Aug 30 '11 at 4:09
I'm not a pro, so I probably won't find the answer alone. I think it is best you post your code here (or in a new question), as there are many very skilled people on this platform. While I might find an answer after a very long time, people here usually can find a better solution than mine within a few days. –  Tom Bombadil Aug 30 '11 at 8:58