# TOC - number of chapter in other line than its title (with memoir class)

Do you have any idea on how to combine this solution of putting the number of chapter and its name+page in different lines? Please have a look at the picture. I want to achieve this with memoir lass (ideally if we could have in centralized).

My problem is that I usage memoir class (no way to change the class now) and it doesn't work for me.

Minimal not MWE is:

\documentclass{report}
\usepackage{tocloft}
\setlength{\cftchapnumwidth}{0pt}
\renewcommand{\cftchappresnum}{\chaptername\ }
\renewcommand{\cftchapaftersnum}{.}
\renewcommand{\cftchapaftersnumb}{\newline}
\renewcommand{\cftchapdotsep}{\cftdotsep}
\begin{document}
\tableofcontents
\chapter{A Chapter}
\chapter{Another Chapter}
\end{document}


I also tried to redefine way of setting TOC with

\documentclass{memoir}

% redefinition for the ToC title
\renewcommand\printtoctitle[1]{\HUGE\sffamily#1}

% redefinitions for chapter entries
\renewcommand\chapternumberline[1]{}
\renewcommand\cftchapterfont{\sffamily}
\renewcommand\cftchapterpagefont{\huge\sffamily}

\makeatletter
\newcommand\l@mychap[3]{%
\vskip2ex%
\par\noindent
\parbox{15em}{%
\hfill\cftchapterfont#1%
}\hspace*{3em}%
\parbox{\dimexpr\textwidth-5.5em-15pt\relax}{%
{\cftchapterpagefont#2}    %
}\par%
}

\renewcommand*\l@chapter[2]{\\%
\l@mychap{#1}{#2}{\chaptername}%
}
\makeatother

\begin{document}

\tableofcontents*

\chapter{Down the Rabbit Hole}
\chapter{The Pool of Tears}
\chapter{The Caucus Race and a Long Tale}
\setcounter{page}{14}% just for the example

\end{document}


that comes from here.

Any ideas regarding the solution? Thanks and regards.

EDIT:

Would you be so kind and have a look at further problem I have regarding this issue. I don't feel like creating next question would be good now.

I used two lines of code:

\usepackage{fmtcount}
\renewcommand{\thechapter}{\NUMBERstring{chapter}}


to change digits to words, to make it look like Chapter ONE, Chapter TWO, etc. Instead, I'd need simply ONE, TWO, THREE that would be centralized correctly. It looks like this at the moment.

It looks like it's alignedto te left at the center, instead I want to have it centered correctly. The code is:

\documentclass{memoir}

\usepackage{fmtcount}
\renewcommand{\thechapter}{\NUMBERstring{chapter}}

\newlength\mylen
\settowidth\mylen{\thechapter}
\renewcommand{\cftchapteraftersnum}{\ }
\renewcommand{\cftchapteraftersnumb}{\newline\normalfont}
\renewcommand{\cftchapterafterpnum}{\cftparfillskip}

\makeatletter
\renewcommand*{\l@chapapp}[3]{%
\ifnum \c@tocdepth >\m@ne
\cftchapterbreak
\vskip\cftbeforechapterskip%
\centering%
{\memRTLrightskip\@tocrmarg%
\@afterindenttrue%
\interlinepenalty\@M%
\leavevmode%
\let\@cftbsnum\cftchapterpresnum
\let\@cftasnum\cftchapteraftersnum%
\let\@cftasnumb\cftchapteraftersnumb%
\setlength{\@tempdima}{\mylen}%
{\cftchapterfont\sffamily#1}\nobreak%
~ --- \cftchapterfillnum{\sffamily#2}}%
\fi}
\makeatother

\begin{document}

\tableofcontents*
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}

\end{document}


Any ideas? Thank you in advance!

-

\documentclass{memoir}

\newlength\mylen
\settowidth\mylen{\bfseries\chaptername\ .}
\cftsetindents{chapter}{0em}{\mylen}
\renewcommand{\cftchapterpresnum}{\chaptername\ }
\renewcommand{\cftchapteraftersnum}{.}
\renewcommand{\cftchapteraftersnumb}{\newline\hspace*{-\mylen}}
\renewcommand{\cftchapterdotsep}{\cftdotsep}

\begin{document}

\tableofcontents*
\chapter{A Chapter}
\chapter{Another Chapter}

\end{document}


Below I provide the code required to achieve the formatting requested in a comment to this answer and in the edit to the original question; centered entries, with the title and the label in separate lines and page number immediately after the title. no information was given about the title for the ToC so I used the default formatting:

\documentclass{memoir}

\usepackage{fmtcount}
\renewcommand{\thechapter}{\NUMBERstring{chapter}}

\newlength\mylen
\setlength\mylen{.5\linewidth}
\renewcommand{\cftchapteraftersnum}{\ }
\renewcommand{\cftchapteraftersnumb}{\newline\normalfont}
\renewcommand{\cftchapterafterpnum}{\cftparfillskip}

\makeatletter
\renewcommand*{\l@chapapp}[3]{%
\ifnum \c@tocdepth >\m@ne
\cftchapterbreak
\vskip\cftbeforechapterskip%
\centering%
{\memRTLrightskip\@tocrmarg%
\@afterindenttrue%
\interlinepenalty\@M%
\leavevmode%
\let\@cftbsnum\cftchapterpresnum
\let\@cftasnum\cftchapteraftersnum%
\let\@cftasnumb\cftchapteraftersnumb%
\setlength{\@tempdima}{\mylen}%
{\cftchapterfont\sffamily#1}\nobreak%
~ --- \cftchapterfillnum{\sffamily#2}}%
\fi}
\renewcommand{\chapternumberline}[1]{%
\chapternumberlinehook{#1}%
\@cftasnumb}
\makeatother

\begin{document}

\tableofcontents*
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}
\chapter{A Chapter}
\chapter{Another Chapter}

\end{document}


-
Works great! How about centering it (both Chapter 1 line and the other plus number sticked to the chapter name, not aligned to right)? – cajmer Jun 16 '12 at 1:40
@cajmer I've updated my answer. – Gonzalo Medina Jun 16 '12 at 3:02
@cajmer please see my updated answer. – Gonzalo Medina Jun 16 '12 at 15:22
Thank You Gonzalo Medina! Could you possibly explain me why the table is centered not to the whole page (according to page number from footer for example)? – cajmer Jun 16 '12 at 15:44
@cajmer: Try \memRTLrightskip0pt instead of \memRTLrightskip\@tocrmarg. – Werner Jun 16 '12 at 16:05