我想知道如何使用 LaTeX 创建如下所示的目录:
TABLE OF CONTENT
CHAPTER TITLE PAGE NO
ABSTRACT i
LIST OF TABLES ii
1 INTRODUCTION 1
1.1 Abc 1
1.2 Rtcfgc 2
2 LITERATURE SURVEY 8
2.1Xyz 8
请任何人帮助我。
答案1
这是第一次启动,使用埃托克和长桌。其思想是告诉etoc
章节和部分用 的行填充标记列表变量longtable
。然后longtable
在此过程结束时对环境进行排版。
% TABLE OF CONTENT
% CHAPTER TITLE PAGE NO
% ABSTRACT i
% LIST OF TABLES ii
% 1 INTRODUCTION 1
% 1.1 Abc 1
% 1.2 Rtcfgc 2
% 2 LITERATURE SURVEY 8
% 2.1Xyz 8
\documentclass{book}
\usepackage[linktoc=all]{hyperref}
\usepackage{longtable}
\usepackage{etoc}
\newtoks\toctoks
\newtoks\tmptoks
% This appends to a token list variable given as first argument
% the once expanded second argument
\newcommand*{\appendtotok}[2]
% #1=token list variable defined with \newtoks, %
% #2=macro,
{#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}}
% document is assumed not to contain `\part'
% it is a bit complicated to get the chapter to inscribe the uppercased version,
% together with the hyperref link, inside the \toctoks which will be injected
% into a longtable
\etocsetstyle{chapter}
{}
{}
{\appendtotok\toctoks {\etocthelinkednumber &}%
\tmptoks\expandafter{\expandafter\etocthelink\expandafter{\expandafter
\MakeUppercase\expandafter{\etocthename}}}%
\expandafter\appendtotok\expandafter\toctoks\expandafter{\the\tmptoks &}%
\appendtotok\toctoks{\etocthelinkedpage \\\relax}}
{}
\etocsetstyle{section}
{}
{}
{\toctoks\expandafter{\the\toctoks &}%
\appendtotok\toctoks{\etocthelinkednumber\ }%
\appendtotok\toctoks{\etocthelinkedname &}%
\appendtotok\toctoks{\etocthelinkedpage \\\relax}}
{}
\etocsettocstyle
{%
\centerline{\large\bfseries TABLE OF CONTENTS}
\toctoks {\hspace*{1cm}\textbf{CHAPTER}\hspace*{1cm}&
\hspace*{1cm}\textbf{TITLE}\hspace*{1cm}&
\hspace*{1em}\textbf{PAGE NO}\hspace*{1em}\\\relax }%
}
{\begin{longtable}{clc}\the\toctoks\end{longtable}}
% alternative: put above \global\toctoks\expandafter{\the\toctoks}
% and the typeset the longtable at your convenience, after \tableofcontents
\setcounter{tocdepth}{1}
% only chapters and sections.
\begin{document}
\frontmatter
\tableofcontents
\chapter {Abstract}
\chapter {List of tables}
% \chapter {List of figures}
% or rather, perhaps:
\addcontentsline{toc}{chapter}{List of figures}
\mainmatter
\chapter {Introduction}
\section {Abc}
\section {Rtcfgc}
\chapter {Literature survey}
\section {Xyz}
\end{document}