Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

enter image description here

\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.

share|improve this answer
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.