我使用以下命令为我的论文添加附录:
\appendix \chapter{Appendix} \section{Some stuff here} \section{Some other stuff here}
然后我看到了下面的内容。
我不想右下角出现“附录”字样。然后我将上面的代码改为
\appendix \chapter{} \section{Some stuff here} \section{Some other stuff here}
但这次目录变成了这样:
我仍然希望目录显示“A. 附录”。我该如何实现?
可编译代码:
\documentclass[12pt,a4paper]{book}
\usepackage{amsmath, amssymb,amsthm}
\usepackage{fancyhdr}
\usepackage{a4wide}
\usepackage{placeins}
\usepackage{graphicx, wrapfig, caption, subfig}
\usepackage[dotinlabels]{titletoc}
\usepackage[ansinew]{inputenc}
\usepackage{array,arydshln}
\usepackage[british]{babel}
\usepackage[Glenn]{fncychap}
\usepackage[hidelinks,pdfborder=000]{hyperref}
\usepackage{natbib,enumerate}
\usepackage[ddmmyyyy]{datetime}
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{definition}{Definition}[chapter]
\newtheorem{example}{Example}[chapter]
\usepackage{xcolor}
\usepackage{dsfont}
\makeatletter
\def\thm@space@setup{
\thm@preskip=0.2cm plus 0cm minus 0cm
\thm@postskip=\thm@preskip
}
\makeatother
\hypersetup{
colorlinks,
linkcolor={red!50!black},
citecolor={blue!50!black},
urlcolor={blue!80!black}
}
\setlength{\parindent}{0cm}
\setlength{\parskip}{1em}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\leftmark}
\fancyfoot[C]{\bf{\thepage}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancypagestyle{plain}{
\renewcommand\headrulewidth{0pt}
\fancyhead{}
\fancyfoot[C]{}}
\titlecontents{chapter}[0.7cm]
{\vspace{-0cm}}
{\bfseries\large\contentslabel{0.7cm}}
{\bfseries\large\hspace{-0.7cm}}
{\titlerule*[2mm]{.}\bfseries\contentspage}
\setlength{\belowcaptionskip}{5pt}
\setlength{\abovecaptionskip}{5pt}
\usepackage{titlesec}
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage[title]{appendix}
\begin{document}
\frontmatter
\thispagestyle{empty}
\renewcommand{\contentsname}{Table Of Contents}
\setcounter{tocdepth}{2}
\tableofcontents
\mainmatter
\appendix
\chapter{Appendix}
Making the code compilable
\end{document}
答案1
这是使用 的方法apptools
。我提请您注意,根据l2tabu
指南,a4wide
不应再使用 。如果您想要比默认值更合理的边距,请加载geometry
。还应hyperref
作为最后一个包加载,只有极少数例外(最值得注意的是cleveref
):
\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb,amsthm}
\usepackage{fancyhdr}
%\usepackage{a4wide}
\usepackage{geometry} \usepackage{placeins}
\usepackage{graphicx, wrapfig, caption, subfig}
\usepackage[dotinlabels]{titletoc}
\usepackage{array, arydshln}
\usepackage[british]{babel}
\usepackage[Glenn]{fncychap}
\usepackage{natbib,enumerate}
\usepackage[ddmmyyyy]{datetime}
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{definition}{Definition}[chapter]
\newtheorem{example}{Example}[chapter]
\usepackage{xcolor}
\usepackage{dsfont}
\makeatletter
\def\thm@space@setup{
\thm@preskip=0.2cm plus 0cm minus 0cm
\thm@postskip=\thm@preskip
}
\makeatother
\usepackage{titlesec}
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage[title]{appendix}
\usepackage{lipsum}
\usepackage[hidelinks,pdfborder=000]{hyperref}
\hypersetup{
colorlinks,
linkcolor={red!50!black},
citecolor={blue!50!black},
urlcolor={blue!80!black}
}
\setlength{\parindent}{0cm}
\setlength{\parskip}{1em}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\leftmark}
\fancyfoot[C]{\bf{\thepage}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancypagestyle{plain}{
\renewcommand\headrulewidth{0pt}
\fancyhead{}
\fancyfoot[C]{}}
\titlecontents{chapter}[0.7cm]
{\vspace{-0cm}}
{\bfseries\large\contentslabel{0.7cm}}
{\bfseries\large\hspace{-0.7cm}}
{\titlerule*[2mm]{.}\bfseries\contentspage}
\setlength{\belowcaptionskip}{5pt}
\setlength{\abovecaptionskip}{5pt}
\usepackage{apptools}
\AtAppendix{\renewcommand\appendixname{\relax}}
\begin{document}
\frontmatter
\thispagestyle{empty}
\renewcommand{\contentsname}{Table Of Contents}
\setcounter{tocdepth}{2}
\tableofcontents
\mainmatter
\chapter{A First Chapter}
\lipsum
\appendix
\chapter{Appendix}
Making the code compilable
\end{document}