答案1
使用,您可以定义将包含在本地目录中的etoc
每个部分命令(在此示例中)的样式。\section
\etocsetstyle{<levelname>}{<start>}{<prefix>}{<contents of the entry>}{<finish>}
对于主要部分,即条目的内容,您可以
\etocnumber
部分编号(本例中未使用)
\etocname
章节标题
\etocpage
章节的页面
\documentclass[a4paper]{book}
\usepackage{lipsum}% dummy text
\usepackage{etoc} % added <<<<<<<<<<<<
\etocsetnexttocdepth{section} %list up to and including section
\newcommand{\inlinetoc}{% produce the inline local table of contents
\begingroup
\etocsettocstyle{\vskip-2\baselineskip}{\vskip0.5\baselineskip} % etoc style for the local TOC
\etocsetstyle{section}% level = section
{\etocskipfirstprefix\sffamily}% code before. (Do not use prefix for the first section}
{\space}% prefix to contents of the entry (space)
{\etocname{}~\textbf{\etocpage}\enspace}% content of the entry
{}% after (nothing)
\localtableofcontents % local ToC
\endgroup
}
\begin{document}
\chapter{The Market}
\inlinetoc %local table of contents inline
\section{Constructing a Model}
\lipsum[4-8]
\section{Optimization and Equilibrium}
\lipsum[4-8]
\section{The Demand Curve}
\lipsum[4-8]
\section{The Supply Curve}
\lipsum[4-8]
\section{Market Equilibrium}
\lipsum[4-8]
\section{Comparative Statics}
\lipsum[4-8]
\section{Other Ways to Allocate Apartments}
\end{document}
包文档包含许多片段,可帮助您熟悉各种可能性。(可能需要 Acrobat 阅读器来提取文档 pdf 中的嵌入代码)