3

I am using the tufte-book documentclass to typeset notes. I'd like a minitoc in the margin at the start of each chapter. The (hacky) approach I turned to first is to use \marginnote{\minitoc}, however with long titles the hbox overflows and it gets cut off. Similarly with no long title, the contents box seems to extend over the page still.

Is this an appropriate way to set a minitoc into the margin of a tufte-book and, if so, how may I force the minitoc to stay within the page geometry?

MWE

\documentclass[openany]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{minitoc}

\begin{document}

\dominitoc\faketableofcontents

\chapter{Lorem?}

\marginnote{\minitoc}

\section{Ipsum}

\blindtext

\section{A long title, perhaps pondering the meaning of life}

\blindtext

\end{document}

MWE output

The warnings overleaf raises appear to be irrelevant to the problem:

  • "Marginpar on page 1 moved", which may be the problem; a search of similar problems on TeXOverflow seems to show it occurs when the marginnote is moved between compiles, which doesn't happen here.
  • "Package bibentry Warning: You have used \nobibliography* without a following \bibliography. You may not be able to run BibTeX."

sameple output from overleaf

0

2 Answers 2

4

The two warnings you get are nothing to worry about. The second one just comes from a package that is loaded by tufte-book. The first one tells you that the margin note is now at its correct place, but wasn’t when the document was compiled the first time.

The \documentclass you use also styles tables of contents. But it has a notoc option to prevent this. Because you probably don’t want such a big font size and large line width in your margin, you should use this option. Furthermore, it is necessary to place the mini TOC in a minipage with the width of the margin. It is also probably better to set \mtcindent to zero.

\documentclass[openany,notoc]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{minitoc}
\setlength{\mtcindent}{0pt}
\begin{document}

\chapter{Lorem?}

\marginnote{%
    \begin{minipage}{\marginparwidth}%
    \minitoc%
    \end{minipage}%
}

\section{Ipsum}

\blindtext

\section{A long title, perhaps pondering the meaning of life}

\blindtext

\end{document}

Result:

enter image description here

1
  • Many thanks, this did it! :)
    – Seabody
    Commented Nov 15, 2019 at 20:49
4

You could also use etoc:

\documentclass[openany]{tufte-book}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{etoc}
\etocsetstyle{section}
  {\parindent -1em \parskip 1ex}
  {\leftskip 1em}
  {\etocnumber
   \etocname\nobreak\hspace{2em}
   \etocpage\par}
  {}
\etocsetstyle{subsection}
  {\parindent -1em \parskip 1ex}
  {\leftskip 2em}
  {\etocname\nobreak\hspace{2em}
   \etocpage\par}
  {}
\etocsettocstyle{\normalfont\normalsize}{}
\etocsetnexttocdepth{2}

\begin{document}

\chapter{Lorem?}

\marginnote{\localtableofcontents}

\section{Ipsum}

\blindtext

\section{A long title, perhaps pondering the meaning of life}

\blindtext

\subsection{A subsection}

\blindtext
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .