How do I get multiple ToC entries in the same line?

I need that, in the ToC, all the \paragraph references appear in the same line, like.

1 First Chapter................................................1
1.1 First Section.............................................1
One paragraph 1, Another § 3, One more § 4
1.2 Second Section.......................................7
§ in sec. two 7, Another § in sec. two 11


And so on… I'm using the memoir class, which, in its manual, actually uses this for its subsections, but don't explain how to do it.

The titletoc package provides a means to format ToC-entries:

\documentclass{memoir}% http://ctan.org/pkg/memoir
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{titletoc}% http://ctan.org/pkg/titletoc
\titlecontents*{subsection}% <section>
[1.5em]% <left>
{\small}% <above-code>
{}% <numbered-entry-format>; you could also use {\thecontentslabel. } to show the numbers
{}% <numberless-entry-format>
{\ \thecontentspage}% <filler-page-format>
[,\ ]% <separator>
[]% <end>
\setcounter{tocdepth}{2}% Display up to \subsection in ToC
\begin{document}
\tableofcontents
\chapter{First chapter} \lipsum
\section{First section} \lipsum
\subsection{One paragraph} \lipsum
\subsection{Another paragraph} \lipsum
\subsection{One more paragraph} \lipsum
\section{Second section} \lipsum
\subsection{Paragraph in section two} \lipsum
\subsection{Another paragraph in section two} \lipsum
\end{document}


I've left the original no-dotted-leader for the chapter formatting, since the bold typeface already links the title with the page number. However, it would be possible to add this as well.

I also typeset your paragraphs as \subsections, since there's no need to use \pararaph here. Not sure whether this is what you're after, since you only mentioned ToC specifications. I've also left the Contents in the ToC, which can be removed, if needed.

Page 16 of the titletoc documentation describes the layout of the command \titlecontents. Remember to compile twice for the ToC entries to settle.

• marlonob is using memoir. Your solution will also work, but you need to add \setcounter{tocdepth}{2} to get subsections into the TOC (which memoir doesn't do by default.) – Alan Munn Dec 20 '11 at 3:21
• @AlanMunn: Yikes! Thanks for picking that up. – Werner Dec 20 '11 at 3:28
• @Werner: Hey! Just what I needed. One more thing: I have changed the format for the page numbers --just the page numbers, not the title-- to be sans serif and \tiny with the memoir \renewcommand*{\cftparagraphpagefont}{\sffamily\tiny}. This is much more clear because of the numbers after the section sign, which can be confusing. Any idea of how to preserve that or stablish it with titletoc?. I will check the documentation anyway. Many thanks! – marlonob Dec 20 '11 at 17:08