[Tex/LaTex] Error in displaying appendices

appendices

I'm having a problem when writing appendices for my thesis. This is the general structure:

\documentclass[11pt,a4paper,titlepage]{report}  
\usepackage[T1]{fontenc}  
\usepackage[latin9]{inputenc}  
\usepackage{amsmath}  
\usepackage{amsfonts}  
\usepackage{amssymb}  
\usepackage{graphicx}  

\begin{document}  
\chapter{Chap 1}  
...  
\appendix  
\chapter*{Appendix A}  
\addcontentsline{toc}{chapter}{Appendix A}  
\section{Section 1}  
...   
\chapter*{Appendix B}  
\addcontentsline{toc}{chapter}{Appendix B}  
\section{Section 1}  
...  
\end{document}  

For some reasons, all the sections in the two appendices are displayed like this: ".1" instead of "A.1" or "B.1". And the first section in Appendix B is numbered continuously from Appendix A (For example I have 3 sections in Appendix A. The first section in Appendix B is numbered as ".4"???)

Thank a lot for any suggestions to solve this problem!

Best Answer

Appendices should have a title. If you insist in not giving a title other than “Appendix A”, then you can add

\newcommand{\newappendix}{%
  \refstepcounter{chapter}\chapter*{Appendix \thechapter}%
  \addcontentsline{toc}{chapter}{Appendix \thechapter}%
}

to your preamble and do

\appendix
\newappendix\label{firstappendix}
\section{First section}

\newappendix\label{secondappendix}
\section{Another section}

Complete example

\documentclass[11pt,a4paper,titlepage]{report}

\newcommand{\newappendix}{%
  \refstepcounter{chapter}\chapter*{Appendix \thechapter}%
  \addcontentsline{toc}{chapter}{Appendix \thechapter}%
}


\begin{document}
\chapter{Chap 1}

\appendix

\newappendix\label{firstappendix}

\section{First section}

This is Appendix~\ref{firstappendix}


\newappendix\label{secondappendix}

\section{Another section}

This is Appendix~\ref{secondappendix}

\end{document}

enter image description here

Related Question