# Referencing wrong appendix in chapter. Should reference A.1 instead references A

My problem is when I reference a piece of document which is in my appendix it states the wrong one in my chapter content. I.e blah blah in 'A'. When it should be 'A.1'. Every document in the appendix is behind by 1 in relation to the main content of my piece of work. However its weird, addtocontents in the main.tex file it shows in order. A.1, A.2, A.3 etc. But like I said it should start from A.1 and not A like it shows in my contents page.

%----------------------------------------------------------------------------------------
%   DISSERTATION CONTENT - CHAPTERS
%----------------------------------------------------------------------------------------

\mainmatter % Begin numeric (1,2,3...) page numbering

\pagestyle{fancy} % Return the page headers back to the "fancy" style

% Include the chapters of the dissertation as separate files from the Chapters folder
% Uncomment the lines as you write the chapters

\input{Chapters/Chapter1}

%---------------------------------------------------------------------
%   DISSERTATION CONTENT - APPENDICES
%----------------------------------------------------------------------------------------

\appendix % Cue to tell LaTeX that the following 'chapters' are Appendices

% Include the appendices of the dissertation as separate files from the Appendices folder
% Uncomment the lines as you write the Appendices

\input{Appendices/AppendixA}
%\input{Appendices/AppendixB}
%\input{Appendices/AppendixC}

\backmatter


I also have a separate .cls file which holds certain commands. In relation to the appendix this is shown below:

\newcommand{\aref}[1]{Appendix~\ref{#1}}


Example in my main.tex:

\documentclass[11pt, a4paper, oneside]{Thesis}
%All my packages included here

\begin{document}
%All the contents and fancy thesis layout set here. Such as setting the title page, contents page, figures page, table page, chapter, appendices etc. Which will automatically appear.
\end{document}


My Chapter1.tex starts like this:

\chapter{Analysis}
\label{Analysis}

\section{Overview}
The purpose of the Analysis chapter is to analyse different \ref{Web}...


That command \ref{} automatically looks at my AppendixA.tex file to reference the relevant appendice.

My AppendixA.tex starts like this:

% Appendix A
\vspace{2.0em}
\chapter{Appendix} % Main appendix title

\lhead{\emph{Terms of Reference}} % This is for the header on each page perhaps a shortened title

\label{TermsofReference} % Change X to a consecutive letter; for referencing this appendix elsewhere, use \ref{AppendixX}

\section{Terms of Reference}


Therefore I use the \ref{} command and stick the relevant content thats within the parenthesis of the \label{} command.

Can anyone help me please, as this is really annoying. When anyone was to read my piece of work they will always be looking at the wrong document in my appendix. Sorry I am quite new to LaTeX and used a Thesis template to help me.

-
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Christian Hupfer Apr 14 '14 at 20:03
Hi Christian. I have edited my post. Sorry if I have explained it wrong as I am fairly new to LaTex. But I used a thesis template, the main.tex holds all the commands for to set the fancy document, including the chapter and appendix being automatically inserted. I hope you can help me. – Shaju Apr 14 '14 at 20:29
I can send you a zip file if that would help. – Shaju Apr 14 '14 at 20:36
Please also have a look on our starter guide: (meta.tex.stackexchange.com/q/1436) to familiarize yourself further with our format. And try to keep the edits of the gurus here (... and no, I do not think I am one of them!) – Christian Hupfer Apr 14 '14 at 20:45
Okay thanks. I would show an example but the template I used is the reason why I cannot reproduce the situation also being fairly new. The LaTeX template I used is latextemplates.com/template/masters-doctoral-thesis – Shaju Apr 14 '14 at 21:09

If you want to refer to section Terms of Reference, place the label after \section{Terms of Reference}.