[Tex/LaTex] Adding numbered appendices as section in documentclass report

appendicesreportsectioning

I'm writing a text using the documentclass report and I can't find a way to add appendices like this within the article class:

\documentclass{article}
\begin{document}
\tableofcontents
\section{First section}
\subsection{A subsection}
\appendix
\addcontentsline{toc}{section}{Appendices}
\section*{Appendices}
\section{First appendix}
\section{Second appendix}
\end{document}

What I would like is:
– A main section (not a chapter, except if it's too complicated to do) named : Appendices without any numbering here
– subsection for every new appendices, with numbering (or letters)

Like this:

Last chapter
Last section
Last subsection

Appendices (as a section*) \addcontentsline{toc}{section}{Appendices}
Appendix 1 (as a subsection) \addcontentsline{toc}{subsection}{Appendix 1}

Appendix 2 (as a subsection) \addcontentsline{toc}{subsection}{Appendix 2}

Appendix 3 (as a subsection) \addcontentsline{toc}{subsection}{Appendix 3}

I would also like to refer to the appendices (with a \label{stuff}) in the main text regarding their number (or letter, I don't really care here).
Every try I've done ended with strange numbering begin either with a dot like this .1 or with .0.1. Thanks.

Update:
This is almost working:

\documentclass{article}
\begin{document}
\tableofcontents
\section{First section}
\subsection{A subsection}
\appendix
\addcontentsline{toc}{section}{Appendices}
\section*{Appendices}
\renewcommand{\thesubsection}{\Alph{subsection}}
\section{First appendix}
\section{Second appendix}
\end{document}

But placing the letter in front of the Appendix name and I can't place it as the end. It would be great.

Best Answer

The following seems to be what you're after:

enter image description here

\documentclass{report}

\begin{document}

\tableofcontents

\chapter{A chapter}
\section{A section}
\subsection{A subsection}

\section*{Appendices}
\addcontentsline{toc}{section}{\bfseries Appendices}
\renewcommand{\thesubsection}{\arabic{subsection}}
\setcounter{subsection}{0}% Restart subsection numbering

\subsection{First appendix}
\subsection{Second appendix}

\end{document}

If you're using hyperref, more work needs to be done to accommodate for the referencing.

If you have more document content following the \chapter that contains your appendices, then you may have to restore the \subsection numbering. You can add

\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}

before that content.