目录编辑

目录编辑

这是我在网站上的第一个问题,我想将“Chapter”一词全部大写,并在章节标题前面加上“:”。我使用了报告文档类,TOC 的唯一包是 \usepackage[toc,page] 、 \usepackage[nottoc,notlof,notlot]{tocbibind} 我不知道它们是否用于修改...我真的只是 latex 用户,这是我第一次尝试写论文

   \documentclass[12pt,a4paper]{report} 
   \usepackage{amsmath,amssymb,amsthm,amsfonts,mathrsfs} 
   \usepackage{graphicx,epsfig,subfig}                 
   \usepackage{geometry}                               
   \usepackage{setspace}                                 
   \usepackage{array}                                
   \usepackage[toc,page]{appendix}               
   \usepackage[labelfont=bf]{caption}                  
   \usepackage{xpatch}                              
   \usepackage{fmtcount}                       
   \renewcommand{\thechapter}{\NUMBERstring{chapter}} 
   \renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}  
   \renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}  
   \makeatletter
   \input{fc-british.def}
   \xpatchcmd{\@chapter}% <cmd>
   {\numberline{\thechapter}}% <search>
   {\@chapapp~\thechapter\quad}% <replace>
   {}{}% <success><failure>
   \makeatother
   \newcolumntype{L}[1]{>
   {\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
   \newcolumntype{C}[1]{>
  {\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
   \newcolumntype{R}[1]{>
   {\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
    \usepackage{caption}
    \usepackage[pagestyles]{titlesec}
    \titleformat{\chapter}[display]
   {\normalfont\LARGE\bfseries\centering}
   {\centering\MakeUppercase{\chaptertitlename}\ \thechapter}{20pt}{\Large}
    \titlespacing*{\chapter}
    {0pt}{50pt}{40pt}
    \geometry{verbose,a4paper,tmargin=30mm,bmargin=25mm,
     lmargin=30mm,rmargin=25mm}
    \renewcommand{\baselinestretch}{1.65}
    \usepackage{fancyhdr}
    \usepackage{psfrag}
    \usepackage{array}
    \usepackage{booktabs}
    \usepackage{float}
    \usepackage{caption}
    \usepackage{multirow}
    \usepackage[shortlabels]{enumitem}
    \usepackage[monochrome]{xcolor}
    \usepackage{pdflscape}
    \usepackage[toc,page]{appendix}
    \usepackage{titlesec}
    \usepackage{amsmath}
    \usepackage[nottoc,notlof,notlot]{tocbibind} 
    \renewcommand\bibname{References}
    \makeatletter
    \newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}
    \makeatother
    \setcounter{secnumdepth}{5} 
    \setcounter{tocdepth}{5}    
    \newtheorem{theorem}{Theorem}
    \newtheorem{acknowledgement}{Acknowledgement}
    \newtheorem{algorithm}{Algorithm}
    \newtheorem{axiom}{Axiom}
    \newtheorem{case}{Case}
    \newtheorem{claim}{Claim}
    \newtheorem{conclusion}{Conclusion}
    \newtheorem{condition}{Condition}
    \newtheorem{conjecture}{Conjecture}
    \newtheorem{corollary}{Corollary}
    \newtheorem{criterion}{Criterion}
    \newtheorem{definition}{Definition}
    \newtheorem{example}{Example}
    \newtheorem{exercise}{Exercise}
    \newtheorem{lemma}{Lemma}
    \newtheorem{notation}{Notation}
    \newtheorem{problem}{Problem}
    \newtheorem{proposition}{Proposition}
    \newtheorem{remark}{Remark}
    \newtheorem{solution}{Solution}
    \newtheorem{summary}{Summary}
    \numberwithin{equation}{chapter}
    \numberwithin{theorem}{chapter}
    \fancypagestyle{plain}{%
    \fancyhf{} % clear all header and footer fields 
    \fancyfoot[C]{\bfseries\large\thepage} % except the center
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}}

    \begin{document}

    \addcontentsline{toc}{chapter}{Contents}
    \tableofcontents 

    \chapter{General Introduction}\label{chapter:Intro} 
    \section{Introduction}
    Composite steel-concrete construction

    \end{document}  

在此处输入图片描述

答案1

我首先将你的代码简化为一个更简单的工作示例。虽然你显然不想在实际文档中这样做,但你应该修剪和组织您的前言。您多次加载包,有时使用不同的选项,并加载冲突的包或与传递给其他包的选项冲突的包。例如,pagestyles传递给titlesec将加载该包的页脚/页眉表亲。然后,该表亲将与fancyhdr文档布局的该方面竞争控制权。选择。一个,另一个或两者都不是。但不能两者兼而有之。您也可以在titlesec没有此选项的情况下加载,如果您碰巧没有遇到不会触发错误的顺序,这也会产生潜在的冲突。

然后我调整了\xpatch命令,将“章节”设置为“CHAPTER”,并在数字词后放置一个结束符。我知道你要求使用冒号,但坦率地说,我认为这看起来很奇怪。但是,如果你真的喜欢(或必须使用)这种格式,你可以轻松地.用冒号替换冒号。:

\documentclass{report} 
\usepackage[toc,page]{appendix}               
\usepackage{xpatch}                              
\usepackage[british]{fmtcount}% set dialect in a standard way the package recommends                
% \usepackage[pagestyles]{titlesec}% use of pagestyles conflicts with use of fancyhdr
\usepackage{titlesec}% use of pagestyles conflicts with use of fancyhdr
\usepackage{fancyhdr}
\usepackage[nottoc,notlof,notlot]{tocbibind} 

\renewcommand{\thechapter}{\NUMBERstring{chapter}} 
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}  
\makeatletter
\xpatchcmd{\@chapter}% <cmd>
{\numberline{\thechapter}}% <search>
{\MakeUppercase{\@chapapp}~\thechapter.\quad}% <replace>% <= \MakeUppercase for the capitalisation; added . for dot
{}{}% <success><failure>
\makeatother
\titleformat{\chapter}[display]
{\normalfont\LARGE\bfseries\centering}
{\centering\MakeUppercase{\chaptertitlename}\ \thechapter}{20pt}{\Large}
\titlespacing*{\chapter}
{0pt}{50pt}{40pt}
\setcounter{tocdepth}{5}    
\fancypagestyle{plain}{%
  \fancyhf{}% clear all header and footer fields 
  \fancyfoot[C]{\bfseries\large\thepage}% except the center
  \renewcommand{\headrulewidth}{0pt}%
  \renewcommand{\footrulewidth}{0pt}}

\begin{document}

\addcontentsline{toc}{chapter}{Contents}
\tableofcontents 

\chapter{General Introduction}\label{chapter:Intro} 
\section{Introduction}
Composite steel-concrete construction

\end{document} 

调整了章节的目录行

相关内容