Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How will i create a table of contents to have an output like this...

                             CONTENTS



ILLUSTRATIONS ...........................................i

TABLES...................................................ii

ACKNOWLEDGEMENT..........................................iii

ABSTRACT.................................................iv

Chapter 1

     INTRODUCTION.........................................1
share|improve this question
    
If you don't want aligned numbers I don't understand why you use dots. You should put the numbers near each toc entry. –  Spike May 13 '11 at 7:46
1  
it's not clear what you are trying to achieve. Is it the dots you are trying to implement? Or the Roman/Arabic numerals? Or is it the numbers being ragged right? Please make this clearer: this will help people trying to answer you... –  Seamus May 13 '11 at 14:15
1  
What version of TeX are you using? You should consider changing your choice of tags to include the relevant version, as well as the "table-of-contents" tag. LaTeX, for instance, can do this automatically (on the second build) using its inbuilt sectioning and the \tableofcontents command. –  Nick Loughlin May 16 '11 at 3:55
2  
I've realised that the main content of your question is probably about how to format the TOC into the one you've given yourself. You should probably consider revising the question to make it clear what you've managed to accomplish in this direction and exactly what is left, i.e. what help you require from the community. Most of the question is misleading, including the tagging and the fact that the SE engine thinks your subsections are code input. Give a small example outlining the format of the desired result. –  Nick Loughlin May 16 '11 at 4:00
add comment

2 Answers 2

If you want to change the \chapter heading of all the chapters use the titlesec package. I would not recommend that you change the contents heading on its own. If you realy wants it, you can add

\renewcommand*\cfttoctitlefont{\Huge\bfseries\hfill\MakeUppercase}
\renewcommand*\cftaftertoctitle{\hfill}

The following will give more or less wat you want, execpt for the linebreak after Chapter 1. That will cause chaos if you include sections.

\documentclass{book}
\usepackage{tocloft}
    \newlength\mylenprt
    \newlength\mylenchp
    \newlength\mylenapp

    \renewcommand*\cftpartpresnum{\partname~}
    \renewcommand*\cftchappresnum{\chaptername~}
    \renewcommand*\cftchapaftersnum{.}
    \renewcommand*\cftchapdotsep{\cftdotsep}

    \settowidth\mylenprt{\cftpartfont\cftpartpresnum\cftpartaftersnum}
    \settowidth\mylenchp{\cftchapfont\cftchappresnum\cftchapaftersnum}
    \settowidth\mylenapp{\cftchapfont\appendixname~\cftchapaftersnum}
    \addtolength\mylenprt{\cftpartnumwidth}
    \addtolength\mylenchp{\cftchapnumwidth}
    \addtolength\mylenapp{\cftchapnumwidth}

    \setlength\cftpartnumwidth{\mylenprt}
    \setlength\cftchapnumwidth{\mylenchp}
\begin{document}
    \frontmatter
    \tableofcontents
    \chapter{ILLUSTRATIONS}
        \makeatletter\@starttoc{lof}\makeatother
    \chapter{TABLES}
        \makeatletter\@starttoc{lot}\makeatother
    \chapter{ACKNOWLEDGEMENT}
    \chapter{ABSTRACT}

    \mainmatter
    \chapter{INTRODUCTION}

    \begin{figure}
      \caption{Fig test}
    \end{figure}
    \begin{table}
      \caption{Tab Test}
    \end{table}

    \appendix
    \addtocontents{toc}{% NB!!! must be inside the first \include
        \protect\renewcommand\protect\cftchappresnum{\appendixname~}%
        \protect\setlength{\cftchapnumwidth}{\mylenapp}}%

    \backmatter
\end{document}
share|improve this answer
add comment

This is a repeat of your question "Table of contents". So here is the same answer, but with commands added to break the chapter line. The command \cftchapaftersnumb is added and the internal command \l@chapter is redefined.

Regarding the list of figures and tables headings, remember that they are chapter headings and need to be formated the same as all the other chapter headings in the book. If you want someting else, look at my answer in the post "How to show \listoffigures and \listoftables on one page and in the toc?". You can tune that to make them section headings.

\documentclass{book}
\usepackage{tocloft}
    \newlength\mylenprt
    \newlength\mylenchp
    \newlength\mylenapp

    \renewcommand*\cftpartpresnum{\partname~}
    \renewcommand*\cftchappresnum{\chaptername~}
    \renewcommand*\cftchapaftersnum{.}
    \renewcommand*\cftchapaftersnumb{\par\smallskip} %<<<<<<<< ADDED <<<<<
    \renewcommand*\cftchapdotsep{\cftdotsep}

    \settowidth\mylenprt{\cftpartfont\cftpartpresnum\cftpartaftersnum}
    \settowidth\mylenchp{\cftchapfont\cftchappresnum\cftchapaftersnum}
    \settowidth\mylenapp{\cftchapfont\appendixname~\cftchapaftersnum}
    \addtolength\mylenprt{\cftpartnumwidth}
    \addtolength\mylenchp{\cftchapnumwidth}
    \addtolength\mylenapp{\cftchapnumwidth}

    \setlength\cftpartnumwidth{\mylenprt}
    \setlength\cftchapnumwidth{\mylenchp}

    \makeatletter
    \renewcommand*{\l@chapter}[2]{%
        \ifnum \c@tocdepth >\m@ne
            \addpenalty{-\@highpenalty}%
            \vskip \cftbeforechapskip
            {\leftskip \cftchapindent\relax
            \rightskip \@tocrmarg
            \parfillskip -\rightskip
            \parindent \cftchapindent\relax\@afterindenttrue
            \interlinepenalty\@M
            \leavevmode
            \@tempdima \cftchapnumwidth\relax
            \let\@cftbsnum \cftchappresnum
            \let\@cftasnum \cftchapaftersnum
            \let\@cftasnumb \cftchapaftersnumb
            %\advance\leftskip \@tempdima %<<<<<< CHANGE <<<<<
            \null\nobreak\hskip -\leftskip
            {\cftchapfont #1}\nobreak
            \cftchapfillnum{#2}}%
        \fi}%
    \makeatother


\begin{document}
    \frontmatter
    \tableofcontents
    \chapter{ILLUSTRATIONS}
        \makeatletter\@starttoc{lof}\makeatother
    \chapter{TABLES}
        \makeatletter\@starttoc{lot}\makeatother
    \chapter{ACKNOWLEDGEMENT}
    \chapter{ABSTRACT}

    \mainmatter
    \chapter{INTRODUCTION}
    \section{MySQL}
    \section{Java}

    \mainmatter
    \chapter{THEORETICAL CONSIDERATIONS}
    \section{Records Management}
    \subsection{Entity-relationship diagram}

    \begin{figure}
      \caption{Fig test}
    \end{figure}
    \begin{table}
      \caption{Tab Test}
    \end{table}

    \appendix
    \addtocontents{toc}{% NB!!! must be inside the first \include
        \protect\renewcommand\protect\cftchappresnum{\appendixname~}%
        \protect\setlength{\cftchapnumwidth}{\mylenapp}}%

    \backmatter
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.