以下是我目前编写的代码:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, margin=1in]{geometry}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{tocloft}
\begin{document}
\pagenumbering{roman}
\setcounter{page}{2}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\newgeometry{top=1.75in, hmargin=1in ,bottom=1in}
\begin{center}
ACKNOWLEDGEMENTS
\end{center}
\vspace{1.5\baselineskip}
%\hspace{5pt}
\normalsize
\doublespacing
\setlength{\parindent}{.5 in}
\lipsum[1-2]\\
\vspace*{.5\baselineskip}\noindent\hspace{0.5\textwidth}Marwa A.S. Mosallam
\newpage
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\newgeometry{top=1.75in, hmargin=1in ,bottom=1in}
\begin{center}
TABLE OF CONTENTS
\end{center}
\vspace{1.5\baselineskip}
\newcommand{\page}[1]{\rightskip=25pt \dotfill\rlap{\hbox to 25pt{\hfill#1}}\par}
\doublespacing
ACKNOWLEDGEMENT ................................................ii\\
LIST OF FIGURES ...............................................iii\\
CHAPTER
\begin{itemize}
\item[2.1] An example \page{21}
\item[2.2] A longer example like this such that the line wraps down to the
next line and the last entry gets wrapped to the next line \page{22}
\item[2.31] Another example \page{132}
\end{itemize}
\end{document}
但我很难调整 ACHNOWLEDGMENT 和 LIST OF FIGURES 旁边的编号,使其正好位于 2.1、2.2 等项目的其他编号上方。有人能帮我调整一下吗?
编辑:
最后我主要需要我的目录看起来像这样:
答案1
\documentclass[12pt, twoside]{book}
\usepackage{lipsum}
\usepackage[nottoc]{tocbibind} % For adding List of Tables and List of Figures to Table of Contents
% Title cover page
\title{Your book}
\author{Your name}
\date{}
\begin{document}
\maketitle
\frontmatter %<-------------- Your preface, acknowledgement, table of contents and any prechapter materials goes here. Page numbered in roman numerals
\chapter{Acknowledgements} % Your acknowledgements
\lipsum[1]
\chapter{Preface} % Your preface
\lipsum[2]
\tableofcontents % Your contents
\listoftables
\listoffigures
\mainmatter %<--------- All your main chapters and contents goes here. Page numbered in arabic numerals
\chapter{Chap 1}
\lipsum[3]
\section{Sec 1}
\lipsum[4]
\subsection{Subsec 1}
\lipsum[5]
\chapter{Chap 2}
\lipsum[3]
\section{Sec 1}
\lipsum[4]
\subsection{Subsec 1}
\lipsum[5]
\backmatter %<------------------------ Your appendices and other back matter contents here. Page number continued from mainmatter
\appendix
\chapter{Appendix A}
\lipsum[6]
\end{document}
编辑:
如果您希望在 LoT、LoF 和章节后面使用前导点,您可以tocloft
在序言中使用titles
带有选项的包,然后使用\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
beforetableofcontents
命令。因此,完整的代码现在如下所示:
\documentclass[12pt, twoside]{book}
\usepackage{lipsum}
\usepackage[nottoc]{tocbibind} % For adding List of Tables and List of Figures to Table of Contents
\usepackage[titles]{tocloft}
% Title cover page
\title{Your book}
\author{Your name}
\date{}
\begin{document}
\maketitle
\frontmatter %<-------------- Your preface, acknowledgement, table of contents and any prechapter materials goes here. Page numbered in roman numerals
\chapter{Acknowledgements} % Your acknowledgements
\lipsum[1]
\chapter{Preface} % Your preface
\lipsum[2]
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\tableofcontents % Your contents
\listoftables
\listoffigures
\mainmatter %<--------- All your main chapters and contents goes here. Page numbered in arabic numerals
\chapter{Chap 1}
\lipsum[3]
\section{Sec 1}
\lipsum[4]
\subsection{Subsec 1}
\lipsum[5]
\chapter{Chap 2}
\lipsum[3]
\section{Sec 1}
\lipsum[4]
\subsection{Subsec 1}
\lipsum[5]
\backmatter %<------------------------ Your appendices and other back matter contents here. Page number continued from mainmatter
\appendix
\chapter{Appendix A}
\lipsum[6]
\end{document}