8

I am having trouble adding a newlistof to a memoir file. My example follows the memoir answer example very closely, but I get an ugly "List of Comments" -- spacing across the page and returns are wrong.

Minimal TeX example below. As an uncredentialed user, I don't seem to be able to attach an image of the PDF. The appearance I get is a space after the comment number, the comment title, then no space and the comment page number; followed by no CR/LF between the first and second entry.

I want the List of Comments to look much like the List of Figures. Running TexShop.

\documentclass[11pt,letterpaper,openany]{memoir} % for a short document

 % Comment command
\newcommand{\listcommentname}{List of Comments}
\newlistof{listofcomments}{loc}{\listcommentname}
\newcounter{Comment}[chapter]
\renewcommand{\theComment}{\arabic{Comment}}
\newcommand{\Comment}[1] {
    \refstepcounter{Comment}    
    \par\noindent\textbf{Comment \theComment.  #1.}
    \addcontentsline{loc}{Comment}{\protect\numberline{\theComment}#1}\par} 

\begin{document}
%
\frontmatter

\tableofcontents*\clearpage
\listoffigures\clearpage
\listofcomments\clearpage

\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}

\mainmatter
\chapter{Introduction \& so on}
\Comment{Silly comment}
Here is a test comment.

\section{Example section}
And here is some text

\begin{figure}
\centering\mbox{Just text to generate a lof entry.}
\caption{Test figure}
\end{figure}

\clearpage

\Comment{Another silly comment}
Here is a second test comment, on a different page.

\end{document}
lockstep
  • 250,273

1 Answers1

6

You have to create a ToC-(LoC-)formatting command \l@Comment that resembles \l@figure. Add the following to your preamble:

\makeatletter
\let\l@Comment\l@figure
\makeatother

Consider also to add the chapter number to the "appearence" of the "Comments" counter:

\renewcommand{\theComment}{\thechapter.\arabic{Comment}}
lockstep
  • 250,273
  • 1
    Thanks! This helped solve my other question https://tex.stackexchange.com/questions/388489/custom-list-throw-latex-error-command-mycustomfiction-already-defined But just for explicitly state, the \let\l@Comment\l@figure is referring to the counter named Comment, not the command named Comment. Name both things with the same name was horrible for understanding on the question. – user Aug 27 '17 at 20:52