I was looking to create a table of contents for my preliminary thesis topics as Acknowledgments, Abstract, etc. I would put it after the cover so the reader can easy access the actual Table of Contents, Acknowledgments, Abstract, etc. This is due because on my thesis template it is required about 30 pages of contents as Acknowledgments, Abstract, etc. before the actual Table of Contents and the chapters. Initially I looked over creating two table of contents and I found these questions:
- Add preliminary elements to the ToC
- Two independent TOCs
- How do I set up two independent tables of contents
- ToC chapter number width & memoir class
- \part and tocloft
But when trying to make things work with memoir class I got several errors and problems on my thesis template. Then I noticed I just actually need a simple list of things. Therefore I started searching on how to create lists of contents manually. Then I found these questions:
And come up with the following minimal example which works fine with the report class:
\documentclass{memoir}
% \documentclass{report}
\usepackage{tocloft}
\usepackage{hyperref}
\usepackage[english]{babel}
\hypersetup{colorlinks=true}
\newcommand{\listexamplename}{List of mycustomfiction}
\newlistof{mycustomfiction}{mcf}{\listexamplename}
\newcommand{\mycustomfiction}[1]
{%
\refstepcounter{mycustomfiction}
\addcontentsline{mcf}{mycustomfiction}
{\protect\numberline{\themycustomfiction}#1}\par
}
\begin{document}
\tableofcontents
\newpage
\listofmycustomfiction
\chapter{Two mycustomfiction}
\mycustomfiction{Your first example}
\label{1st_ex}
Your first example
\mycustomfiction{Your second example}
\label{2nd_ex}
Your second example
\chapter{One example}
\mycustomfiction{Your third example. (See example \ref{1st_ex} and \ref{2nd_ex})}
Your third example. (See example \ref{1st_ex} and \ref{2nd_ex})
\end{document}
But throw these errors with the memoir class:
! LaTeX Error: Command \mycustomfiction already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.18 }
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
Redoing nameref's sectioning
Redoing nameref's label
LaTeX Info: Redefining \nameref on input line 20.
LaTeX Info: Redefining \ref on input line 20.
LaTeX Info: Redefining \pageref on input line 20.
LaTeX Info: Redefining \nameref on input line 20.
{D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map}]
! Undefined control sequence.
l.24 \listofmycustomfiction
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
[2
However when replacing the memoir class with report class, it does compiles without any errors:
How can it be fixed so I can build it with memoir class? Perhaps I should use another package other than tocloft
Update
Now I following the example from memoir class manual, but my list is going nuts:
\documentclass{memoir}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\usepackage[english]{babel}
\newcommand{\listanswername}{List of Answers}
\newlistof{listofanswers}{ans}{\listanswername}
\newcounter{answercounter}[chapter]
\renewcommand{\theanswercounter}{\arabic{answercounter}}
\newcommand{\answer}[1]
{
\refstepcounter{answercounter}
\par\noindent\textbf{Answer \theanswercounter. #1}
\addcontentsline{ans}{answercounter}{\protect\numberline{\theanswercounter}#1}\par
}
\begin{document}
\tableofcontents
\newpage
\listofanswers*
\chapter{Chapter Two mycustomfiction}
\answer{Your first example}
Your first example
\answer{Your second example}
Your second example
\chapter{One example}
\answer{Your third example.}
Your third example.
\end{document}
What is wrong with it?
Update 2
If I do:
\newcommand{\answer}[1]
{%
\refstepcounter{answercounter}
\addcontentsline{ans}{answercounter}{\newline\newline#1\hfill}
}
I got these warnings and format:
Underfull \hbox (badness 10000) in paragraph at lines 1--25
[]
Underfull \hbox (badness 10000) in paragraph at lines 1--25
[]
Underfull \hbox (badness 10000) in paragraph at lines 1--25
[]
[2]
Package hyperref Info: bookmark level for unknown answercounter defaults to 0 o
n input line 27.
[3





\newlistofcreate a control sequence with the same name. – Johannes_B Aug 27 '17 at 17:21memoirhave some external stuff so you don't need to loadtocloft? – Johannes_B Aug 27 '17 at 17:22\show\mycustomfictionaround your preamble and compile to see where a change happens. Works for other control sequences as well. – Johannes_B Aug 27 '17 at 17:29memoirdoes unfortunately emulate some other packages but incomplete, in my point of view, that's why I don't usememoir, however, it is possible todisemulatethe packages – Aug 27 '17 at 17:52memoir,KOMAand standard classes -- this is no good approach – Aug 27 '17 at 17:53reportclass it shows> \mycustomfiction=undefined. l.13 \show\mycustomfictionbut when I build withmemoirclass it shows> \mycustomfiction=macro: ->\@ifstar {\@nameuse {mem@mycustomfiction}{01}}{\@nameuse {mem@mycustomfiction }{00}}. l.13 \show\mycustomfiction– user Aug 27 '17 at 18:12\newlistofon the memoir manual and I found on page162the section9.3 NEW ‘LIST OF. . . ’ AND ENTRIES, which seems to explain the command\newlistof. Looked like I must remove the packagetocloftand use the memoir own implementation of it. I am going to look into the manual and see if I can figure it out on how to create new lists with memoir implementation oftocloft. – user Aug 27 '17 at 18:17p 192. of the LaTeX manual, notmemman.pdf– Aug 27 '17 at 18:21%\documentclass{report} %\usepackage{tocloft}
\newcommand{\listofsomethingname}{List of something} \newlistof{foo}{foo}{\listofsomethingname} \begin{document} \listoffoo
\end{document}
– Aug 27 '17 at 18:44-- it should work if I understandmemoircorrectly and then try the same with\documentclass{report}\usepackage{tocloft}`.pdfas far as I know – Aug 27 '17 at 18:46tocloftmanual the\newlistofmacro generates thefoocounter → it does so really withreport(or another non-memoir) class, but it does not define\c@fooetc. withmemoir's emulation oftocloft-- that's what I call incomplete – Aug 27 '17 at 18:49