7

I am writing a little book with the memoir class and I would love to add little table of contents at the start of each chapter. I found that I could use the minitoc package, but it doesn't seem to work. I tried mtcpatchmem.sty by importing \usepackage{mtcpatchmem} (with mtcpatchmem.sty in my root directory) but it still does not work.

Is there a solution, or workaround? If there are any workarounds, I would like it to look like the minitoc package, since I really like the style.

\documentclass{memoir}

\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}

\usepackage{minitoc}

\usepackage{shorttoc}
\usepackage{lipsum}

\usepackage{libertine} %MikTeX says this is depreciated, alternative?
\renewcommand*\oldstylenums[1]{{\fontfamily{fxlj}\selectfont #1}}

\title{Hello, World}

\begin{document}
\maketitle
\newpage
\shorttableofcontents{Les Grandes Lignes}{0}
\tableofcontents

\part{Introduction}

\chapter{Merci}
This does not work.
\minitoc

\section{Contenu}
\lipsum[1]

\section{Hello}
\subsection{Bye Bye}
\end{document}

PS: I am well aware there is a similar question, but it never really had a real answer. Also, I am using MikTeX 2.9.

Raphael
  • 245
  • There is an alternative solution in the linked question using titletoc. Is there any reason why that won't work for you? – Alan Munn Mar 31 '12 at 17:38
  • Simply, I prefer the ouput of the minitoc package. But if it's not possible, titletoc works well enough. – Raphael Mar 31 '12 at 17:51
  • 1
    I don't know what the specific differences are, but surely it wouldn't be too hard to get titletoc to produce identical output? – Alan Munn Mar 31 '12 at 17:56

1 Answers1

6

As was mentioned elsewhere, there seems to be some problems with minitoc and memoir; as Alan Munn suggested, you could use titletoc instead.

In the following example I followed this approach and I defined a new command \Mprintcontents which is basically an adaptation of titletoc's \printcontents. \Mprintcontents places a nice title (controlled by \partialtocname), frames the partial ToC between two horizontal rules and invokes \printcontents[chapters]{toc}{}{1}{} to build the partial ToC imitating the standard behaviour of minitoc:

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{shorttoc}
\usepackage{titletoc}
\usepackage{libertine} %MikTeX says this is depreciated, alternative?

\newcommand\partialtocname{Petite table des mati\`eres}
\newcommand\ToCrule{\noindent\rule[5pt]{\textwidth}{1.3pt}}
\newcommand\ToCtitle{{\large\bfseries\partialtocname}\vskip2pt\ToCrule}
\makeatletter
\newcommand\Mprintcontents{%
  \ToCtitle
  \ttl@printlist[chapters]{toc}{}{1}{}\par\nobreak
  \ToCrule}
\makeatother

\begin{document}

\shorttableofcontents{Les Grandes Lignes}{0}
\tableofcontents

\part{Introduction}
\chapter{Merci}
\startcontents[chapters]
\Mprintcontents

\section{Contenu}
\lipsum[1]
\section{Hello}
\stopcontents[chapters]

\chapter{Beaucoup}
\startcontents[chapters]
\Mprintcontents

\section{An Outre Contenu}
\lipsum[1]
\section{Bye}
\stopcontents[chapters]

\end{document}

Here are images of the first pages of each chapter illustrating the partial ToCs:

enter image description here

enter image description here

Of course, feel free to make the adjustments that you consider necessary.

bisgardo
  • 103
Gonzalo Medina
  • 505,128
  • 1
    Thanks. This works fine in the minimal working version of my document, but in my full document there seems to be some issues: http://i.imgur.com/38kYh.png – Raphael Apr 01 '12 at 05:14
  • @bobicool: I think there is an issue using titletoc and hyperref together. I too got similar result as your in my document. unfortunately I do not have an answer to that. p.s.: this is a comment to bobicool's comment on Gonzalo Medina's answer. for some reason I cannot find anyway to comment on answer. need help ... – mythealias Apr 01 '12 at 07:17
  • @mythealias You need a reputation score of 50 for making comments, see the [faq]. Currently you need just 5 more. This is also for preventing spam comments. Once you have a small amount of reputation, you can comment. The spammers hardly know TeX well enough get a few points. ;-) – Stefan Kottwitz Apr 01 '12 at 10:05
  • 1
    I finally made it work. All I had to do was put the hyperref package at the end of my preamble. I'm not sure why, but it works. – Raphael Apr 01 '12 at 13:39