![格式化目录和表格列表](https://linux22.com/image/315273/%E6%A0%BC%E5%BC%8F%E5%8C%96%E7%9B%AE%E5%BD%95%E5%92%8C%E8%A1%A8%E6%A0%BC%E5%88%97%E8%A1%A8.png)
作为一名 LaTeX 新手,当涉及到编辑论文中的目录和表格列表时,我完全不知所措。
我需要做两件事
- 我需要所有章节都有虚线。目前,我的目录只有小节有虚线。我尝试使用
tocstyle
带有样式的包allwithdots
,但这会将字体更改为无衬线,我希望字体保持不变。 - 格式指南还要求目录第一页的上边距为 2 英寸,而所有后续页面的上边距为 1 英寸。我一直在使用几何包来管理边距,但我不知道如何在目录第二页上使用不同的边距。
- 我学校的格式要求表格列表必须符合以下格式
我使用了此代码,该代码在另一个线程但这会将所有章节(包括其中没有表格的章节)添加到列表中。我的学校只要求包含表格的章节在此列表中显示,并在相应部分上显示表格和页面标题。不幸的是,我的学校没有为此提供模板。
\makeatletter
\xapptocmd{\@chapter}{\addtocontents{lot} {{\protect\centering\large\normalfont\thechapter~#1\par\addvspace{10pt}}}}{}{}
\makeatother
我怎样才能实现这个目标?
谢谢!
答案1
\documentclass[10pt,oneside]{book}
\usepackage[margin=1in]{geometry}
\usepackage{tocloft} % this package styles ToC, LoT and LoF
%========= Customizing ToC
% Z represents all three ToC, LoT an LoF respectively
% adding 1in vertical space to make total 2 inch space from top for Z
\setlength{\cftbeforetoctitleskip}{1in}
\setlength{\cftbeforelottitleskip}{1in}
\setlength{\cftbeforeloftitleskip}{1in}
\setlength{\cftaftertoctitleskip}{0pt}
% making titles of Z respectively centered and fontsize is
% \Large which can be changed to any value desired
\renewcommand{\cfttoctitlefont}{{~}\hfill\Huge}
\renewcommand{\cftaftertoctitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}
\renewcommand{\cftlottitlefont}{{~}\hfill\Huge}
\renewcommand{\cftafterlottitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}
\renewcommand{\cftloftitlefont}{{~}\hfill\Huge}
\renewcommand{\cftafterloftitle}{%
\hfill{~}\\[\baselineskip]{\normalfont Table}\hfill{\normalfont Page}\thispagestyle{empty}}
% reducing dot separation to make it look like a dotted line
\renewcommand{\cftdotsep}{1}
% increasing width for page number for Z
\cftsetpnumwidth{1cm}
% increasing right margin which makes width available for titles smaller
% hence grater the value smaller the title width
\cftsetrmarg{3cm}
% these commands sets leaders for part and chapter which by default
% are not shown, to make them disappear again replace dotsep value by
% \cftnodot
% e.g. \renewcommand{\cftpartdotsep}{\cftnodot}
\renewcommand{\cftpartdotsep}{1}
\renewcommand{\cftpartleader}{\cftdotfill{\cftpartdotsep}}
\renewcommand{\cftchapdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
\begin{document}
\tableofcontents
\clearpage
\listoftables
\clearpage
\listoffigures
\part{Part One}
\chapter{Chapter One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One One}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection C}
\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection B}
\subsection{Subection C}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\chapter{Chapter Two}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection B}
\subsection{Subection C}
\section{Section 1}
\subsection{Subection A}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection C}
\chapter{Chapter Three}
\section{Section 1}
\subsection{Subection A}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection B}
\subsection{Subection C}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\section{Section 1}
\subsection{Subection A}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection B}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\subsection{Subection C}
\section{Section 1}
\subsection{Subection A}
\subsection{Subection B}
\begin{table}[h!]
\caption{Table Caption}
\end{table}
\subsection{Subection C}
\begin{figure}[h!]
\caption{Figure caption}
\end{figure}
\part{Appendix}
% Use starred version of chapters, section etc which do not appear in table of contents
\chapter*{A}
\chapter*{B}
\part{Index}
\end{document}