在旁注中添加章节部分列表

在旁注中添加章节部分列表

我想要在侧注中有一个简单的目录,如下图所示。

在此处输入图片描述

我试过 minitoc,但它对于边距来说太宽了,而且看起来也不像上面的图片。我不知道如何删除多余的间距、水平线和“目录”。有没有不使用 minitoc 就可以在侧注中添加章节列表的方法?

在此处输入图片描述

梅威瑟:

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

更新

添加三行后:

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

仍然有问题,首先,宽度不正确,其次,我不知道如何删除章节标题和页码之间的点。我还发现它与 titlesec 不兼容。(我没有注意到这个问题,所以我没有在 MWE 中包含 titlesec,抱歉。)(W0099(minitoc(hints))--- 已加载 titlesec 包。(minitoc(hints))它与 minitoc 包不兼容(minitoc(hints))。

更新2 最后我使用 \label{} 和 \nameref{} 来实现这一点。我在每个部分后添加标签,并使用 nameref 获取它们的名称。

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

答案1

我自己解决了这个问题。我使用了 \label{}、\nameref{} 和 tabularx。我使用 tabularx 是因为它适合较长的章节标题。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}

相关内容