1

I'm see this answer to indent the chapters of my appendix as sections in the table of contents but it's not working

My code is:

\documentclass[11pt,a4paper]{book}

\usepackage[toc,page]{appendix}

\begin{document}

\tableofcontents
\listoftables
\listoffigures
\appendix

\renewcommand{\thechapter}{A\Roman{chapter}}
\renewcommand{\thefigure}{A.\Roman{chapter}.\arabic{figure}}  
\renewcommand{\thetable}{A.\Roman{chapter}.\arabic{figure}}

\input{anexo}
  inside many figures
more imput...
\end{document}

And i get

enter image description here

And for list of figures

enter image description here

I dont know how to fix it

  • 1
    welcome to tex.sx. does this question help: Roman numerals become “too wide” in table of contents ? – barbara beeton Mar 17 '17 at 1:56
  • Hi. I still have the problem. I find tocloft and this is the code i need: \renewcommand{\cftchapnumwidth}{6em} But i want to only apply in appendix. I insert the code after \appendix but it's not working – Ivan Mar 17 '17 at 12:31
  • you need to force that line into the relevant toc file in the appropriate place. at the top of your file anexo.tex place this line: \addtocontents{toc}{\renewcommand{\cftchapnumwidth}{6em}} and similarly for {lof}. it must be in the file with the appendix material. i know that if it's placed in a "calling" file and the "text" file is called with \include, the \addtocontents is delayed until after that file has been input; i'm not sure about the ordering if \input is used, but it's better not to take a chance. – barbara beeton Mar 17 '17 at 13:43
  • It's not working. i think that i can change the name in table of content with \addcontentsline{toc}{chapter}{Anexo \Roman{chapter}} but i do not know how hide A.I Anexo – Ivan Mar 17 '17 at 14:10
  • you want the entries for the appendix entries to be omitted? the question seems to ask something different -- that space be made so that the section numbers don't overlap. but the principle is the same. you have to insert something into the .toc (or .lof, etc.) file in the appropriate place. – barbara beeton Mar 17 '17 at 14:35
1

If the changes of the numwidth boxes in the ToC, LoF and LoT should be restricted to some part of the document, the \addtolength{cftchapnumwidth}{10pt} etc. has to be written literally into the relevant ToC - file.

Please note that this might produce inconsistent layout in the ToCs.

The value of 40pt is of course too large, I have used it just for demonstration.

\documentclass[11pt,a4paper]{book}

\usepackage[toc,page]{appendix}
\usepackage{tocloft}
\usepackage{pgffor}


\begin{document}

\tableofcontents
\listoftables
\listoffigures

\clearpage

% 
\chapter{Regular content}
\foreach \x in {1,...,10} {%
\begin{figure}
\caption{Figure caption \x}
\end{figure}

\begin{table}
\caption{Table caption \x}
\end{table}
}


\clearpage
\appendix


\addtocontents{toc}{\protect\addtolength{\protect\cftchapnumwidth}{10pt}}
\addtocontents{lof}{\protect\addtolength{\protect\cftfignumwidth}{40pt}}
\addtocontents{lot}{\protect\addtolength{\protect\cfttabnumwidth}{40pt}}




\renewcommand{\thechapter}{A.\Roman{chapter}}
\renewcommand{\thefigure}{\thechapter.\arabic{figure}}  
\renewcommand{\thetable}{\thechapter.\arabic{figure}}



%\input{anexo}

\chapter{Appendix content One}


\foreach \x in {1,...,10} {%
\begin{figure}
  \caption{Figure caption \x}
\end{figure}
\begin{table}
  \caption{Table caption \x}
\end{table}
}

\chapter{Appendix content Two}

\foreach \x in {1,...,10} {%
\begin{figure}
  \caption{Figure caption \x}
\end{figure}
\begin{table}
  \caption{Table caption \x}
\end{table}
}



\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.