每节前的段落突出显示

每节前的段落突出显示

我希望在我的书中每个部分前面列出某些段落的重点内容,就像达尔文的这本书一样:

在此处输入图片描述

我不知道这个功能的正确名称是什么,这就是为什么找不到正确的 LaTeX 包。它是什么?我需要使用哪个包?

PS. 我想,我需要一些类似的东西。这是我正在寻找的文档结构:

\documentclass{book}
\begin{document}
\tableofcontents
\chapter{Insects}
\section{Order Lepidoptera}
\paragraph{Courtship of butterflies}
In this great Order the most interesting point for us is the difference
in colour between the sexes of the same species, and between 
the distinct species of the same genus. Nearly the whole of 
the following chapter will be devoted to this subject.
\paragraph{Battles}
Every one has admired the extreme beauty of many butterflies and 
of some moths; and we are led to ask, how has this beauty 
been acquired?
\end{document}

首先,我想在目录中看到这一点:

1 Insects
1.1 Order Lepidoptera
Courtship of butterflies - Battles

然后,在文档正文中:

Chapter 1: "Insects"

Section 1.1: Order Lepidoptera

Courtship of butterflies - Battles

Courtship of butterflies.
In this great Order the most interesting point for us is the difference
in colour between the sexes of the same species, and between 
the distinct species of the same genus. Nearly the whole of 
the following chapter will be devoted to this subject.

Battles. 
Every one has admired the extreme beauty of many butterflies and 
of some moths; and we are led to ask, how has this beauty 
been acquired?    

答案1

下面是使用该包的解决方案(带有页面范围)etoc(需要两次编译才能获得正确的目录):

\documentclass{book}
\usepackage{hyperref}
\usepackage{etoc}

\newcommand\listofparagraphsincurrentsection{%
  \begingroup%
  \etocsetlevel{subsection}{6}%
  \etocsetlevel{subsubsection}{6}%
  \etocsetlevel{subparagraph}{6}%
  \etocsetstyle{paragraph}{}%
  {\etociffirst{\edef\myfirstpage{\etocpage}}{ -- }\edef\mylastpage{\etocpage}}%
  {\etocname}{\dotfill \myfirstpage{}-\mylastpage{}}%
  \etocsettocstyle{}{}%
  \etocsettocdepth{5}%
  \localtableofcontents%
  \endgroup%
}

\begin{document}
\tableofcontents

\chapter{Insects}

\section{Order Lepidoptera}

\listofparagraphsincurrentsection

\paragraph{Courtship of butterflies} In this great Order the most
interesting point for us is the difference in colour between the sexes
of the same species, and between the distinct species of the same
genus. Nearly the whole of the following chapter will be devoted to this
subject.

\subsection{Test with a subsection}

\paragraph{Battles} Every one has admired the extreme beauty of many
butterflies and of some moths; and we are led to ask, how has this
beauty been acquired?

\end{document}

在此处输入图片描述

相关内容