0

I believe there are many questions on this topic already answered. However, I tried all of them, but none of them worked with me. Perhaps someone can help me find the issue.

Currently, my TOC looks like this: enter image description here

But, instead of "A" in the appendix, I want it to say "Appendix", like this enter image description here

I tried this solution using Appendix package: https://stackoverflow.com/questions/5690679/add-appendix-before-a-in-thesis-toc But it does not work, it hangs when I compile it. Below you can see my code and all the packages that I'm using. Maybe some of them are conflicting.

%% document class
\documentclass[a4paper]{book}
\usepackage[table]{xcolor}
\usepackage[spanish,es-tabla]{babel}
\usepackage{ragged2e}
\usepackage[numbers]{natbib}
\usepackage{hyperref}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{longtable}
\usepackage{enumerate} % needed for some options in enumerate
\usepackage{makeidx} % needed for creating an index
\usepackage{blindtext} 
\usepackage{amsmath}
\usepackage{bigstrut}
\usepackage{upgreek}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tikz}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{titletoc}
\usepackage{appendix}
\titleformat*{\section}{\LARGE\bfseries}
\titleformat*{\subsection}{\Large\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}

\hypersetup{%
    colorlinks=true,
    citecolor=black,
    linkcolor=black,   
    urlcolor=black}
\addto\captionsspanish{% Replace "english" with the language you use
  \renewcommand{\contentsname}%
    {Contenido}%
}
\newcommand\myhline{\noalign{\global\arrayrulewidth=1pt}\arrayrulecolor{white}\hline}

\arrayrulecolor{gray!80}

%% page settings
\input{settings/page}

%% own commands
\newcommand{\imp}[1]{\underline{\textit{#1}}}
\newcommand{\q}[1]{``#1''}
\input{settings/macros}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
My document, table of content, Chapters, Sections, etc

\bibliographystyle{ieeetran}
\bibliography{literature/library}

\begin{appendix}
\chapter{Just an example appendix}
\label{app_ex1}
\section{Section of appendix A}
\end{appendix}
\end{document}
2
  • One issue here... load hyperref far later than it currently is being loaded.
    – Werner
    Commented Dec 12, 2018 at 8:01
  • Everytime I try to use \begin{appendices} \end{appendices} the compiler hangs. I still don't know what's the issue. Commented Dec 12, 2018 at 13:57

1 Answer 1

1
\documentclass{book}
\usepackage[table]{xcolor}
\usepackage[spanish,es-tabla]{babel}
\usepackage[titletoc]{appendix}
\usepackage{ragged2e}
\usepackage[numbers]{natbib}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{longtable}
\usepackage{enumerate} % needed for some options in enumerate
\usepackage{makeidx} % needed for creating an index
\usepackage{blindtext} 
\usepackage{amsmath}
\usepackage{bigstrut}
\usepackage{upgreek}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}
\usepackage{array}
\usepackage{tikz}
\usepackage[nottoc]{tocbibind}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{titletoc}
%\titleformat*{\chapter}{\LARGE\bfseries}
\titleformat*{\section}{\LARGE\bfseries}
\titleformat*{\subsection}{\Large\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}

\addto\captionsspanish{% Replace "english" with the language you use
  \renewcommand{\contentsname}%
    {Contenido}%
}
\newcommand\myhline{\noalign{\global\arrayrulewidth=1pt}\arrayrulecolor{white}\hline}

\arrayrulecolor{gray!80}

%% page settings
%\input{settings/page}
\usepackage{bookmark}

\hypersetup{% colorlinks=true, citecolor=green, linkcolor=red,
urlcolor=pink}

%% own commands
\newcommand{\imp}[1]{\underline{\textit{#1}}}
\newcommand{\q}[1]{``#1''}
%\input{settings/macros}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\tableofcontents
\newpage
My document, table of content, Chapters, Sections, etc
\chapter{sadfs}
asdfds
\bibliographystyle{ieeetran}
\bibliography{literature/library}

\begin{appendices}
\chapter{Just an example appendix}
\label{app_ex1}
\section{Section of appendix A}
\end{appendices}
\end{document}

Use \usepackage[titletoc]{appendix} and then use appendices environment will do the result.

Hopes this helps

4
  • Why did you remove hyper setup and hyperreff package. Is that what's causing issues? Commented Dec 12, 2018 at 13:06
  • Yes, hyperref is the culprit.
    – Samjith
    Commented Dec 14, 2018 at 8:07
  • 1
    Found that bookmark works instead hyperref. Can you use bookmark
    – Samjith
    Commented Dec 14, 2018 at 12:05
  • Yes, I added the bookmark and works well now. Commented Dec 15, 2018 at 14:27

You must log in to answer this question.

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