章节目录

章节目录

如何制作这样的目录?我尝试了 minitoc,但输出完全不同,而且我找不到命令来制作这样的目录。例如,删除章节编号,删除页码和章节名称之间的点。 在此处输入图片描述

\documentclass[a4paper,10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{palatino}
\usepackage{multicol}
\usepackage{minitoc}

\begin{document}
\dominitoc
\nomtcrule
\tableofcontents
\chapter{Introduction}
\begin{multicols}{2}
\minitoc
test
\vfill
\columnbreak
test2
\end{multicols}
\section{blubb}

\section{foo}
\end{document}

答案1

下面是一个使用 的示例etoc。它旨在将本地保留到通过和\localtableofcontents发出的位置。我还在调用中放置了选项,以方便此示例,而不是因为我认为您一定应该以这种方式构建文档。\begingroup\endgrouptwocolumn\documentclass

所有这些中的关键命令是\etocsetstyle,它需要五个强制参数。(请参阅手册中的§4.1。)

\documentclass[twocolumn, a4paper,10pt, openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{palatino}
\usepackage{etoc, soul, lipsum}

\newcommand\mylocaltableofcontents{%
\begingroup
\etocsettocstyle{\par\noindent \large \contentsname \par\nobreak\bigskip}{}
\renewcommand*{\contentsname}{\ul{Contents}}
\setcounter{secnumdepth}{2}
\etocsettocdepth{2}

\etocsetstyle{section}
{\par\noindent}
{\normalsize\rmfamily}
{\etocname{} \quad \etocpage}
{\par\noindent}

\etocsetstyle{subsection}
{\par\noindent}
{\normalfont\hspace*{2em}}
{\parbox{\dimexpr\linewidth - 2em\relax}{\etocname{} \quad~\etocpage}}
{\par\noindent}

\localtableofcontents
\endgroup
}

\begin{document}
\tableofcontents

\chapter{Introduction}
\section{Baz}
\subsection{Bar}
\subsubsection{Foo}
\section{Baz}
\subsection{How to make a table of contents like this? I tried minitoc
  but the output is completely different, also, I can't find commands
  to make my table of contents like this.}
\subsubsection{Foo}
\section{Baz}
\subsection{Bar}
\subsubsection{Foo}
\section{Baz}
\subsection{Bar}
\subsubsection{Foo}

\lipsum

\chapter{Introduction}

\mylocaltableofcontents

\section{Baz}
\subsection{Bar}
\subsubsection{Foo}
\section{Baz}
\subsection{How to make a table of contents like this? I tried minitoc
  but the output is completely different, also, I can't find commands
  to make my table of contents like this.}
\subsubsection{Foo}
\section{Baz}
\subsection{Bar}
\subsubsection{Foo}
\section{Baz}
\subsection{Bar}
\subsubsection{Foo}

\lipsum

\chapter{Introduction}

\localtableofcontents

\section{Baz}
\subsection{Bar}
\subsubsection{Foo}
\section{Baz}
\subsection{How to make a table of contents like this? I tried minitoc
  but the output is completely different, also, I can't find commands
  to make my table of contents like this.}
\subsubsection{Foo}
\section{Baz}
\subsection{Bar}
\subsubsection{Foo}
\section{Baz}
\subsection{Bar}
\subsubsection{Foo}

\lipsum

\end{document}

结果如下所示(没有其他定制):

etoc 图像

相关内容