# How do I indent the 2nd line a long chapter name created using the tocloft package so that it lines up correctly?

I am using the tocloft package already. I have a couple of long chapter names that wrap onto a second line, but it lines it up with the section numbers below. I must have this new line line up with the original chapter name. I have seen one other similar question, but it was not answered. Example:

CHAPTER 1:  THIS IS AN EXTREMELY LONG,
LONG CHAPTER NAME.......................2
1.1 blah blah...........................3
1.2 blah blah...........................4

I need it to be:

CHAPTER 1:  THIS IS AN EXTREMELY LONG,
LONG CHAPTER NAME...............2
1.1 blah blah...........................3
1.2 blah blah...........................4


Hope someone can help!

Note: Someone else wrote the class file that I am using for my dissertation, so I am trying to edit it to fit the formatting needs of my University.

Here is the original code that's being used to generate the TOC:

  % TABLE OF CONTENTS ----------------------------------------------------------
\renewcommand{\cftbeforechapskip}{\baselineskip}        % allow spacing after each chapter/section entry
\renewcommand{\cftbeforetoctitleskip}{-0.25in}        % Title is 1in from top
\renewcommand{\cftaftertoctitleskip}{2.0\baselineskip}% 1 double space after title
\renewcommand{\cfttoctitlefont}{\hfill}               % Blank space before title
\renewcommand{\cftaftertoctitle}{\hfill}              % Blank space after title
\renewcommand{\cftchapfont}{ }                        % Can make it bold faced here
\renewcommand{\cftchapdotsep}{\cftdotsep}             % Puts dots after chapter entries
\renewcommand{\cftchappresnum}{CHAPTER }                %
\renewcommand{\cftchapaftersnum}{ }                     %
\renewcommand{\cftchapaftersnumb}{\phantom{CHAPTER}\rm} %
\renewcommand{\cftchappagefont}{ }                      %


This compiles fine, no errors... When I replace the line

\renewcommand{\cftchappresnum}{CHAPTER }                %
with
\renewcommand{\cftchappresnum}{CHAPTER\ }               %


\renewcommand{\cftchapnumwidth}{1in}


I get 9 errors in the .toc file.

Update: Repaired the 9 errors in .toc file by using

\setlength{\cftchapnumwidth}{1.2in}


\renewcommand{\cftchapnumwidth}{1in}.


The last thing I'm working on is how these fixes will jive with the appendix patch:

\newcommand*\tocappendixpatch{%
\renewcommand{\thesection}%
{\Alph{chapter}.\arabic{section}\hspace{-.5em}\setcounter{equation}{0}}
}


The rest of the TOC looks excellent, but I think the code in the appendixpatch is conflicting, so I'm working on figuring that out, now.

Update: I got it! I replaced the line

\addtocontents{toc}{\settowidth{\cftchapnumwidth}{\hspace*{9mm}}}


with

\setlength{\cftchapnumwidth}{1.2in}


within the appendix patch, and the spacing came out perfectly, matching the lines above it.
This has been quite stressful. It took my whole weekend! It would've been much simpler to just shorten the chapter names!!

Thanks to all of you who helped!! I hope I can help people with their questions later when I have time!

-
You can also give abbreviated chapter names as an optional argument: \chapter[Short Name]{Long Name} The short name is then used in the TOC –  Lagerbaer Apr 18 '11 at 0:08

There are numerous problems with the code you posted, which will explain why the titles don't line up.

Specifically:

\renewcommand{\cftchapfont}{ } % this should not have a space


it should be

\renewcommand{\cftchapfont}{} % notice there is no space here


The following command:

\renewcommand{\cftchapaftersnumb}{\phantom{CHAPTER}\rm}


is a hack for spacing. It should be removed altogether.

Another extra space in:

\renewcommand{\cftchappagefont}{ }    % this should not have a space either


should be

\renewcommand{\cftchappagefont}{}


You can specify the width of the chapter number and the text will wrap appropriately. So adding your commands to a minimal document, you get the following:

\documentclass{book}
\usepackage{tocloft}

\begin{document}
\renewcommand{\cftbeforechapskip}{\baselineskip}      % allow spacing after each chapter/section entry
\renewcommand{\cftbeforetoctitleskip}{-0.25in}        % Title is 1in from top
\renewcommand{\cftaftertoctitleskip}{2.0\baselineskip}% 1 double space after title
\renewcommand{\cfttoctitlefont}{\hfill}               % Blank space before title
\renewcommand{\cftaftertoctitle}{\hfill}              % Blank space after title
\renewcommand{\cftchapfont}{}                         % Can make it bold faced here; don't put a space in the {}
\renewcommand{\cftchapdotsep}{\cftdotsep}             % Puts dots after chapter entries
\renewcommand{\cftchappresnum}{CHAPTER\ }             %
\renewcommand{\cftchapaftersnum}{}                    % Don't put a space in the {}
\renewcommand{\cftchappagefont}{}                      %
\renewcommand{\cftchapnumwidth}{1in}
\frontmatter
\tableofcontents

\mainmatter
\section{First section}
\section{Second section}
\chapter{Another chapter}
\section{Another section}
\end{document}


-
So add an example just like mine (but adapted to what you have done) to your question, so that we can see what you are doing. –  Alan Munn Apr 18 '11 at 0:30
Ok, I edited my main question to include the code and more details. I will include a picture shortly. I am new at this message board, so I appreciate your patience. –  Valjean Elander Apr 18 '11 at 0:59
It won't let me submit a picture to show the output since I am a new user. –  Valjean Elander Apr 18 '11 at 1:03