number width in predefined (amsbook?) list of figures too wide - self-defined lists okay

First of all, sorry for the long mwe - I wanted to include everything I use so that someone may see a potential clash.

I based this off of the document class amsbook. I am also going to add a "List of Proofs" section too...

I've seen some references to adjusting the width of the numbers in the List of Figures (though I don't think they had

 \numberswithin{figures}{subsubsection}


level of detail. Some relied on

 \usepackage{tocloft}


which sounds great but I couldn't get the news errors to be fixed when implementing that package. I also found one (How to modify the indentation before sectioning titles in the table of contents?) that tried to fix it (in the book class) without that package, relying on something to do with

 \makeatletter
\renewcommand*\l@subsection{\@dottedtocline{2}{1.8em}{3.2 em}}
\makeatother


but my file complained about that itself being undefined so I took it out - I suppose it comes with the tocloft package?

This worked part ways, until more obscure errors (for me) came up, so I took this out too...

\let\listofdefinitions\relax
\let\endlistofdefinitions\relax
\let\listofexamples\relax
\let\endlistofexamples\relax
\let\listofremarks\relax
\let\endlistofremarks\relax
\usepackage{tocloft}


I'd like to use the

 tocloft


package and so I took my 150 page notebook down to a MWE' to see if someone knew why it didn't work.

Here is the start of the preamble.

\documentclass{amsbook}%{scrbook}%{book}

\usepackage{amsthm,varwidth,array,ragged2e}%amsmath
\usepackage[fleqn]{mathtools}

\newtheoremstyle{mystyle}
{\topsep}{\topsep}{}{}{\bfseries}{:}{\newline}
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}%
\ifstrempty{#3}%
%
\theoremstyle{mystyle}
\newtheorem{mydef}{Definition}
%
\makeatletter
\newcommand\definitionname{Definition}
\newcommand\listdefinitionname{List of Definitions and Theorems}
\newcommand\listofdefinitions{%
\section*{\listdefinitionname}\@starttoc{def}}
\makeatother

\newtheoremstyle{myotherstyle}
{\topsep}{\topsep}{}{-3pt}{\bfseries}{:}{\newline}% -3 indents the header
{\thmname{#1}\thmnumber{ #2}\thmnote{ ({\color{black}{#3}})}%
\ifstrempty{#3}%
%
\theoremstyle{myotherstyle}
\newtheorem{myrem}{Remark}
%
\makeatletter
\newcommand\remarkname{Remark}
\newcommand\listremarkname{List of Remarks}
\newcommand\listofremarks{%
\section*{\listremarkname}\@starttoc{rem}}
\makeatother

\newtheoremstyle{myotherstyleT}
{\topsep}{\topsep}{}{-3pt}{\bfseries}{:}{\newline}% -3 indents the header
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}%
\ifstrempty{#3}%
%
\theoremstyle{myotherstyleT}
\newtheorem{mythm}{Theorem}

\usepackage[usenames,dvipsnames,table]{xcolor}

\usepackage{mdframed}
\usepackage{cancel}
\usepackage{amssymb}
\usepackage[strict]{changepage}

\usepackage[top=1.2in, left=0.9in, bottom=1.2in, right=0.9in,heightrounded,marginparwidth=2cm,marginparsep=2mm]{geometry}

\usepackage{thmtools}

\usepackage{hyperref}
\hypersetup{
pdffitwindow=true,
citecolor=Sienna,
urlcolor=Navy,
%filebordercolor={red},
frenchlinks=true, %eventually comment out
bookmarks=true,
bookmarksnumbered=true,
hypertexnames=false,
backref=true,
hyperindex=true,
pdfauthor={hellslfjkdsl},
final,
%pdftitle={PHYS 5300},
pagebackref=true,
}
\RequirePackage[hyperpageref]{backref}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{
\ifcase #1
No cited.
\or
Cited on page #2.
\else
Cited on pages #2.
\fi}

\usepackage{amsmath}

\usepackage{tikz}

\usepackage{tikz-cd}

\usepackage{marginfix}

\usepackage{natbib}

\usepackage{wrapfig}
\usepackage{mathabx}

\usepackage{scrextend}

\usepackage{mathdots}

\usepackage{pdfpages}
\usepackage{grffile}
\usepackage{stmaryrd}

\usepackage{etoolbox}

\newmdtheoremenv{theo}{Theorem} % has to be after mdframed package

\usepackage[parfill]{parskip}

\usepackage{pdfpages}

\usepackage{multicol}

\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{colortbl,array} % für farbige cells
\usepackage{multirow,bigdelim}

\usepackage[hang,small,bf]{caption}
\setlength{\captionmargin}{25pt}
\usepackage{subcaption} %clashes with subfigure :(

\usepackage{scalefnt} %for controlling font scale in tikz ppg pictures.

\usepackage[xindy,counter=section,sanitize={name=false}]{glossaries} %[toc]% %\glstoctrue
\usepackage{nomencl}
\makeglossaries %has to be after \usepackage{hyperref}
%
\glossarystyle{long3col}
%\glossarystyle{super3col}

\setlength{\glsdescwidth}{0.6\textwidth}
\setlength{\glspagelistwidth}{0.15\textwidth}
\newglossaryentry{RM}
{
name=Reidemeister move,
description={Refer}
}
\newglossaryentry{RieSurf}
{
name=Riemann Surface,
description={}
}

\usepackage{footmisc}

\usepackage[normalem]{ulem}

\setcounter{tocdepth}{5}

\usepackage[all,knot,poly,cmtip]{xy}
\usepackage{empheq}

\newcommand{\blankbox}[2]{%
\parbox{\columnwidth}{\centering

\setlength{\fboxsep}{0pt}%
\fbox{\raisebox{0pt}[#2]{\hspace{#1}}}%
}%
}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
%
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}

\newtheorem{xca}[theorem]{Exercise}
%
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
%
\numberwithin{section}{chapter}
\numberwithin{equation}{chapter}

\numberwithin{figure}{subsubsection}

\newtheoremstyle{exx}
{\topsep}{\topsep}{}{}{\bfseries}{:}{\newline}
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}
\ifstrempty{#3}
\theoremstyle{exx}
\newtheorem{exx}{Example}

\makeatletter
\newcommand\examplename{Example}
\newcommand\listexamplename{List of Examples}
\newcommand\listofexamples{
\section*{\listexamplename}\@starttoc{exx}}
\makeatother

\usepackage{lipsum}

\makeindex


and here is the beginning of the document, after the preamble

\begin{document}
\frontmatter
\title{Literature Review f .......}

\maketitle

%    Change page number to 7 if a dedication is present.
\setcounter{page}{5}

%\hypertarget{toc}{} not sure what this does...
\tableofcontents
\newpage
\listoffigures
\newpage
\listofdefinitions %see \newtheoremstyle{mystyle}
\newpage
\listofexamples
\newpage
\listofremarks

\part{Rjdlkfj lkdjsalf jlj fldksjaf lj fdlksja flkdj lkjd f lksdj fkdj skflajsfskjf oi falj aijf l ejf jself jselij flie sjlgfij gski}

\section{one one one one one one one one one one one one one one one one one one one one one one one one one one one }  a
\section{one} b

\subsection{oneA}1

\subsubsection{stuff to do}a

\begin{figure}
\centering
\rule{2cm}{2cm}
\caption{Really long explanation of a picture that doesn't exist but if it did it would still require a really long explanation and please let me worry about the aesthetics of such a beast and I promise to never ever do it again!}
\end{figure}

\subsubsection{stuff to do}n
\subsubsection{stuff to do}o

\begin{figure}
\centering
\rule{2cm}{2cm}
\blankbox{3cm}{3cm}
\end{figure}

\begin{mydef}[stuff what happens if this is really long? Does it just wrap around or does it affect the indentation of neighboring stuff?]
I define nothing!
\end{mydef}

\begin{mythm}[stuff what happens if this is really long? Does it just wrap around or does it affect the indentation of neighboring stuff?]
Nothing matters.
\end{mythm}

\begin{proof}[fjl fkls dlsfk jldk flkj fkdlj flj fsj fdkl fdjfsl fjl sf flks flk flkfj ls lf fsl lfs jflksj fslj fslj fslj fslkj f jfslkj fsljfs lkfsj lkfsj flsk fks jfsofs jl]
stuff
\end{proof}

\chapter{Introduction''}

state' is defined by tholynomial.
\begin{myrem}[Automatically Lagrfkdlsaj ksalfj afdkla lajd  falsd fldasf lasfj ld dorm]
nothing
\end{myrem}

even up to leading order.
\begin{exx}[Q dsajf lji kl ldskkdl fkds alkf  fkl alsj fjls ja fdlksj  lkads fldjs fajkf jdsalkf dsja fldsja jd sadls fksla dlsamute]
a

\end{exx}
tes \index{Choice n}, that es'\index{Canoaes}

\subsection{Cano fjasl sjal f lfajf a falsdjf aklf dlka fl aflkjda fdksjalf dla fdaf dla flkdsa fldsajf da flasmetry}

e \S 3.2 of \cite{RolfBerndt2001}

\begin{myrem}[Choice of Pola]
Inde:
\begin{equation*}
\partial\,u
\end{equation*}
wes.
\end{myrem}
\index{here is something}

\newgeometry{left=5mm,bottom=15mm,top=15mm,right=5mm}
\glsaddall % if want to print all glossary entries
\printglossaries
\restoregeometry

\appendix
\backmatter
\bibliographystyle{alpha}%plain, abbrv, alpha, unsrt, acm, {plainnat}%{amsplain}
\bibliography{/Users/sbh/MainBibliography}%{../MathHomework}%MathHomework.bib
\printindex

\end{document}

-
Please provide a true minimal example (a preamble with 500+ lines can hardly be considered minimal). Besides this, your code (when pasted together) doesn't produce a compilable document (it generates errors). – Gonzalo Medina Aug 20 '13 at 23:17
As a side note, tocloft is incompatible with the AMS document classes. – Gonzalo Medina Aug 21 '13 at 0:03
Thanks for the comments about compatability with AMS. Heard tocloft was a great and powerful package to do this with :( Here is my new MWE which is now under 500 lines! – nate Aug 21 '13 at 0:56

amsbook.cls has

\def\l@figure{\@tocline{0}{3pt plus2pt}{0pt}{1.5pc}{}}


and 1.5pc is too little space in your case, since you are subordinating the figure counter to the subsubsection counter; you can increase the spacing using a higher value for the fourth argument of \@tocline, adding something like the following lines to the preamble:

\makeatletter
\def\l@figure{\@tocline{0}{3pt plus2pt}{0pt}{5pc}{}}
\makeatother


The tocloft package and AMS classes are incompatible (AMS classes have their own mechanism to handle ToC,LoF,LoT entries).

By the way (not related to the question), the order in which you are loading hyperref is not the most standard one.

-
I've noticed that ordering is important for hyperref (probably other) and will review tex.stackexchange.com/questions/1863/… . Your solution worked for me in the little MWE as well as my big beast :) Still trying to get to that level of reading .cls files and those things... – nate Aug 21 '13 at 1:24