0

I use the following command to add an appendix to my thesis:

\appendix \chapter{Appendix} \section{Some stuff here} \section{Some other stuff here}

Then I see the following.

enter image description here

I do not want the word "Appendix" at the bottom right corner. Then I change the code above to

\appendix \chapter{} \section{Some stuff here} \section{Some other stuff here}

But this time the table of contents turns into this:

enter image description here

I still want the table of contents to say A. Appendix. How do I accomplish this?

Compilable code:

\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}
2
  • Could you post a minimal compilable code?
    – Bernard
    Sep 15, 2016 at 16:38
  • @Bernard I just did. Sorry that it is not minimal but I lost track of what each command is doing and whenever I take out something the compiler complains. I hope this is not too cluttered.
    – Calculon
    Sep 15, 2016 at 17:52

1 Answer 1

1

Here is a way with apptools. I draw your attention to the fact that, according to the l2tabu guide, a4wide should not be used any more. If you want more sensible margins than the default, load geometry. Also hyperref should be loaded as the last package, with very few exceptions (most notable 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} 

enter image description here enter image description here

2
  • Thank you so much for your solution and your other suggestions. Really appreciated.
    – Calculon
    Sep 15, 2016 at 19:58
  • 1
    B.t.w., I forgot to mention it, but you might want to replace enumerate with enumitem which has the same functionalities as the former, but is much more powerful.
    – Bernard
    Sep 15, 2016 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .