请给我LaTeX
一些建议,说明如何将单词Chapter 1
显示在目录中,而不是仅1
在下一章中显示等等。以下是我们大学论文的模板:
\documentclass[12pt,openany,oneside]{book}
\usepackage[pdftex]{graphicx}
\usepackage[a4paper,portrait,left=1.5in,
right=1in,top=1in, bottom=1.33in, footskip=0.33in]{geometry}
%\usepackage{sectsty}
%\sectionfont{\fontsize{12}{15}\selectfont}
\usepackage{titlesec}
\usepackage{lipsum}
%\titleformat{\chapter}[display]
%{\normalfont\Large\filcenter\sffamily}
%{\vspace*{\fill}
%\titlerule[1pt]
%\vspace{1pc}
%\LARGE\MakeUppercase{\chaptertitlename}~\thechapter}
%{1pc}
%{\titlerule\Huge}
%[\vspace*{\fill}\newpage]
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\centering}{\chaptertitlename
\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{250pt}{40pt}
\usepackage{epstopdf}
\usepackage{subfigure}
\usepackage{epsfig}
\usepackage{color}
%\usepackage{a4wide}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{ntheorem}
\usepackage[normalem]{ulem}
\usepackage{chngcntr}
%\usepackage[pdfencoding = auto, psdextra, bookmarksdepth = 4]{hyperref}
%\usepackage{microtype}
\overfullrule=5pt
\hfuzz=20pt
\vfuzz=20pt
\hbadness=10000
\vbadness=\maxdimen
\renewcommand{\chaptermark}[1]{
\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{
\markright {\thesection.\ #1}}
\parindent0pt
\newlength{\defbaselineskip}
\setlength{\defbaselineskip}{\baselineskip}
\newcommand{\setlinespacing}[1]%
{\setlength{\baselineskip}{#1 \defbaselineskip}}
\newcommand{\doublespacing}{\setlength{\baselineskip}%
{2.0 \defbaselineskip}}
\newcommand{\singlespacing}{\setlength{\baselineskip}{\defbaselineskip}}
\setlinespacing{1.5}
\newtheorem*{theorem-non}{Theorem}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{remark}{Remark}[chapter]
\newtheorem{example}{Example}[chapter]
\newtheorem{corollary}{Corollary}[chapter]
\newenvironment{proof}%
{\medskip\par\noindent{\bf Proof\;}}%
{\hspace{\fill}$\Box$\medskip\par}
\numberwithin{equation}{chapter}
\numberwithin{theorem}{chapter}
\numberwithin{lemma}{chapter}
\numberwithin{corollary}{chapter}
\numberwithin{example}{chapter}
\numberwithin{remark}{chapter}
\numberwithin{definition}{chapter}
\renewcommand{\bibname}{}
\hyphenpenalty 50
\newtheorem{property}{Property}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newcommand{\cchapter}[1]{\chapter[#1]}{\centering #1}}
%%%%%%%%%%%%%%%%%%%%%
%\newgeometry{left=1.5in, right=1.0in, bottom=1.75in, top=1in, footskip=0.75in}
%\addtolength{\oddsidemargin}{0.5cm}
% \addtolength{\evensidemargin}{0.5cm}
% \addtolength{\textwidth}{0.0cm}
% \addtolength{\topmargin}{0.0cm}
% \addtolength{\textheight}{0.0cm}
%%%%%%%%%%%%%%%%%%%
\usepackage[noabbrev]{cleveref}
\begin{document}
\pagestyle{plain} \setlinespacing{1.5}
%\input{Acknowledgement}
\newpage
\input{mytitle.tex}
%%%%%%%%%%%%%%%%%%%%
\newpage
\pagenumbering{arabic}
\setcounter{page}{1}
\input{chap1.tex}
%%%%%%%%%%%%%%%%%%
\input{chap2.tex}
%%%%%%%%%%%%%%%%%%
\input{chap3.tex}
%%%%%%%%%%%%%%%%
\input{chap4.tex}
%%%%%%%%%%%%%%%%%
\input{chap5.tex}
%%%%%%%%%%%%%%%%%%%
\input{chap6.tex}
%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
\input{chap7.tex}
%%%%%%%%%%%%%%%%%%%
\input{chap8.tex}
\input{bib.tex}
%%%%%%%%%%%%%%%
\end{document}
目录中有以下命令:
\newpage
\tableofcontents
答案1
我建议您使用该tocloft
包来实现您的格式化目标。请注意仅有的下面的代码所做的就是在章节号前插入单词“Chapter”(和空格)。特别是,section
目录中的 -level 条目的外观没有被修改。
\documentclass{book}
\usepackage{calc} % for '\widthof' macro
\usepackage[titles]{tocloft}
\renewcommand\cftchappresnum{Chapter }
\cftsetindents{chap}{0pt}{\widthof{\large\textbf{Chapter 1}}}
\begin{document}
\tableofcontents
\chapter{AAA}
\section{A1}
\section{A2}
\chapter{BBB}
\section{B1}
\section{B2}
\end{document}