2

I have been struggling to fix this for a while now. I hope one of you could help me fix this tiny issue with table of contents.

  1. I want the regular chapters to have a Chapter prefix
  2. I want the appendix chapters to only have 'Appendix' prefix and NOT "Appendix Chapter" prefix as shown below.

Problem

How can I fix this issue? I've tried many complicated workarounds like using \chapter* and manually adding entry to table of contents, but this messes with chapter formatting and further when I link the appendix in the main manuscript, the link is lost. And so I am hesitant to go through the route of complicated workarounds. Are there any minimal clean solutions for me to rename appendix prefixes?

Summary of the Problem and Solution

My thesis.sty file was messing up the format. As @Sveinung suggested, found the code related to the chapter definition in the STY file

\makeatletter \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect Chapter \numberline{\thechapter:} #1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}

and modified it slightly (i.e. replaced "Chapter" with "Appendix") and placed it just below \appendix command of Thesis.TEX as shown below.

\appendix \makeatletter \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect Appendix \numberline{\thechapter:} #1}%
                       \else
                         \addcontentsline{toc}{chapter}{#1}%
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
2
  • Welcome to TeX.SX! While you provide a code example which you are working with, it is much easier for the community to answer your questions if you reduce your code to a MWE (minimal working example) by removing all parts of code that are unrelated to the issue you are asking about.
    – greyshade
    Dec 16, 2014 at 13:53
  • A real hack in a poorly written .sty file. Nice work!
    – Sveinung
    Dec 16, 2014 at 20:43

1 Answer 1

1

To start the appendices section, you use the command \appendix, not an environment. Change

\begin{appendices}

to

\appendix

and remove

\end{appendices}

If you need more flexibility, load Will Robert­son and Peter Wilson’s appendix-package.

Here is an ‘MWE’ something that at least compile:

\documentclass[
11pt,           
a4paper,         
draft,             
oneside]{book}

\pagestyle{plain}

\begin{document}

\fussy
\frontmatter

\typeout{Title}%
\title{title}
\maketitle%
\clearpage

\chapter*{}%
\label{ch:dedication}
\thispagestyle{empty}

\cleardoublepage%
\chapter{Acknowledgements}
\label{ch:acknowledgement}

\normalsize

\cleardoublepage%
\chapter{Abstract}
\index{Abstract}%
\typeout{Abstract}%

\cleardoublepage%

\mainmatter

\cleardoublepage%
\sloppy

\chapter{Introduction}
\label{ch:Intro}

\chapter[Constrained Motion and the Fundamental Equation]{Constrained Motion Approach and the Fundamental Equation of Mechanics}
\label{ch:Chapter2}

\chapter{Energy Control of Inhomogeneous Nonlinear Lattices}
\label{ch:Chapter3}

\chapter[Synchronization of Multiple Coupled Slave Gyroscopes]{Synchronization of Multiple Coupled Slave Gyroscopes with a Master Gyroscope}
\label{ch:Chapter4}

\chapter[Control of Hyperelastic Beams]{Control of Rubber-like Incompressible Hyperelastic Beams}
\label{ch:Chapter5}

\chapter{Conclusions and Future Work}
\label{ch:Chapter6}

%\backmatter

\cleardoublepage%

\appendix
\chapter[Energy is a positive definite function]{{Energy ${H}$ is a positive definite function}{Energy is a positive definite function}}
\label{A1}

\chapter[Explicit Closed Form Control Force]{{A Closed Form Expression for the Control Force ${F^C}$}{A Closed Form Expression for the Control Force}}
\label{A2}

\chapter[Origin is a single isolated fixed point]{{Origin $O$ is a unique and isolated equilibrium point}{Origin is a unique and isolated equilibrium point}}
\label{A3}

\chapter{{Set ${\Omega}$ is compact}{Omega set is compact}}
\label{A4}

\chapter[Sufficient Conditions on Actuator Placements]{{Actuator positions for which the only invariant set of ${\dot{q}_C \equiv 0}$ is the origin}{Sufficient Conditions on Actuator Placements}}
\label{A5}

   \nocite{*}
   \makeatletter
   \makeatother
   \interlinepenalty=10000
   \bibliographystyle{acm}%
   \bibliography{Chapters/reference}%
   \addcontentsline{toc}{chapter}{\bibname}%

\end{document}
8
  • Thanks for your answer. I did try \appendix instead of the appendices environment earlier, but it did not help. I think I now understand what the problem is.. I have a thesis.sty template file which is creating all the problems.
    – Harsha
    Dec 16, 2014 at 15:23
  • Do you know how I should go about modifying the thesis.sty file to obtain the desired result. Thanks.
    – Harsha
    Dec 16, 2014 at 15:32
  • Try to load the packages appendix as I suggest. May be it is able to correct some of the errors your thesis.sty is doing. Load it after the thesis.sty. Probably the style-file redefines the definition of chapter command in an incompatible way...
    – Sveinung
    Dec 16, 2014 at 15:32
  • You have to open the thesis style in an text editor and search for the definition of the chapter-command. Then you have to redefine the chapter-command, and place the code just after you have issued the appendix-command.
    – Sveinung
    Dec 16, 2014 at 15:47
  • Hi Sveinung, I think I already loaded the appendix package if you see my original post using \usepackage[titletoc]{appendix} I'm a newbie in Latex and don't know how to redefine chapter names. Can I post the thesis.sty file somewhere so you could help me out. Thanks much for your help!
    – Harsha
    Dec 16, 2014 at 15:52

You must log in to answer this question.

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