2

I want to have a simple toc in the sidenotes, which looks like the following picture.

enter image description here

I tried minitoc, but it is too wide for the margin, also, it doesn't look like the above picture. I don't know how to delete the extra spacing, the horizontal lines and "Contents". Is there any method to add a list of sections in sidenotes without using minitoc?

enter image description here

MWE:

\documentclass{book}
\usepackage[utf8]{inputenc}

\usepackage{sidenotes} \usepackage{minitoc} \usepackage{lipsum}

\usepackage{calc} \setlength{\textheight}{700pt}%598,674 \setlength{\textwidth}{325pt}%325 \setlength{\marginparwidth}{180pt}%+20+9%180 \setlength{\voffset}{-51pt} \setlength{\oddsidemargin}{0.5\paperwidth-0.5\textwidth-0.5\marginparsep-0.5\marginparwidth-1in} \setlength{\evensidemargin}{0.5\paperwidth-0.5\textwidth+0.5\marginparsep+0.5\marginparwidth-1in} \begin{document} \dominitoc \chapter{123} \marginpar{\minitoc} \lipsum[1] \section{Introduction} \lipsum[1] \section{Introduction2} \lipsum[1] \section{Introduction3} \lipsum[1] \end{document}

UPDATE

After adding three lines:

\mtcsettitle{minitoc}{}
\mtcsetrules{*}{off}
\setlength{\mtcindent}{-1.5em}

There are still problems, first, the width is not correct, second, I don't know how to remove the dots between section title and page number. I also found that it is not compatible with titlesec.(I didn't notice this problem so I didn't include titlesec in MWE, sorry.) (W0099(minitoc(hints)) --- The titlesec package is loaded. (minitoc(hints)) It is incompatible (minitoc(hints)) with the minitoc package.)

UPDATE 2 Finally I use \label{} and \nameref{} to achieve this. I add label after each section and use nameref to get their names.

 \marginpar{1.1\hfill\nameref{1-1}\\%
    1.2\hfill\nameref{1-2}}
fairytale
  • 769

1 Answers1

1

I solved the problem by myself. I used \label{}, \nameref{} and tabularx. I used tabularx because it is suitable forlong section title. MWE:

\documentclass{book}
\usepackage[utf8]{inputenc}

\usepackage{sidenotes} \usepackage{minitoc} \usepackage{lipsum}

\usepackage{calc} \setlength{\textheight}{700pt} \setlength{\textwidth}{325pt} \setlength{\marginparwidth}{180pt} \setlength{\voffset}{-51pt} \setlength{\oddsidemargin}{0.5\paperwidth-0.5\textwidth-0.5\marginparsep-0.5\marginparwidth-1in} \setlength{\evensidemargin}{0.5\paperwidth-0.5\textwidth+0.5\marginparsep+0.5\marginparwidth-1in}

\usepackage{tabularx} \usepackage{hyperref}

\begin{document}

\chapter{123} \marginpar{% \begin{tabularx}{180pt}{cX} \leavevmode\ \textbf{1-1} & \nameref{1-1}\ \textbf{1-2} & \nameref{1-2}\ \textbf{1-3} & \nameref{1-3}\ \end{tabularx}% }% \lipsum[1] \section{Introduction}\label{1-1} \lipsum[1] \section{Introduction2}\label{1-2} \lipsum[1] \section{Introduction3}\label{1-3} \lipsum[1] \end{document}

fairytale
  • 769