In my table of contents I would like to have it say "Appendix A Regression results". However my code is giving the following output:

My code is the following

    \documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.25in]{geometry}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{ltxtable}
\usepackage{ltablex}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[titletoc,page]{appendix}
\usepackage[nottoc,notlot,notlof]{tocbibind}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
\end{filecontents}

\usepackage{blindtext}

\renewcommand\appendix{\par
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
\renewcommand\thesection{Appendix \Alph{section}}
\renewcommand\thefigure{\Alph{section}\arabic{figure}}
\renewcommand\thetable{\Alph{section}\arabic{table}}
}

\usepackage{hyperref}
\hypersetup{
citecolor=black,
filecolor=black,
urlcolor=black
}

\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.5}

\begin{document}
\tableofcontents

\appendix

\section{Regression tables}
Here is the
\clearpage

\end{document}


I hope this helps you understanding the problem. Thank you so much!

• Please make your code compilable! – CarLaTeX May 4 '17 at 6:11
• It is a bad idea in 99.9% of all cases to include words in to \thesection etc. Please use the tocloft package and change the \cftsecnumwidth length such that the word Appendix fits into it – user31729 May 4 '17 at 6:25
• Will this post be improved or is it kept unclear? – user31729 May 5 '17 at 18:01
• Sorry @ChristianHupfer, what do you mean add words in \thesection? Like for starting a section in the text in general I do \section{Determinant Analysis}, is that bad? I tried doing what you suggested but now every word in the table contents is separated from the number. Also, maybe you could be more on how I could improve the post. – urpi May 5 '17 at 18:43
• Sorry, @ChristianHupfer, I think my code now compiles. – urpi May 5 '17 at 18:58

Using \begin{appendices}...\end{appendices} will provide most of the features that are requested, rather than changing \thesection.

The \Alph - counting style of \thesection is the default for article if the appendix is used, titletoc prepends the title Appendix A etc. to the entry in the toc.

In order to apply the figure/table counter resetting within section, use \counterwithin from chngcntr package, right at the begin of appendices, either manually or \AtBeginEnvironment{appendices}{...}

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.25in]{geometry}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{ltxtable}
\usepackage{ltablex}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage[titletoc,page]{appendix}
\usepackage[nottoc,notlot,notlof]{tocbibind}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
\end{filecontents}

\usepackage{blindtext}

\usepackage{etoolbox}
\usepackage{chngcntr}
\AtBeginEnvironment{appendices}{%
\counterwithin{figure}{section}
\counterwithin{table}{section}
}

\usepackage{hyperref}
\hypersetup{
citecolor=black,
filecolor=black,
urlcolor=black
}

\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.5}

\begin{document}
\tableofcontents

%\appendix
\begin{appendices}
\section{Regression tables}

\begin{figure}
\caption{A figure}
\end{figure}

\begin{table}
\caption{A table}
\end{table}
\end{appendices}
Here is the
\clearpage

\end{document}