1

I need to produce a chapter index with latex code in document as follows:

 \setcounter{tocdepth}{0}
 \tableofcontents

I modified the example from other answer to set a table of contents by chapters in Spanish.

\documentclass{report}
% 
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{titletoc}% http://ctan.org/pkg/titletoc
\usepackage[ linkbordercolor={1 1 1} ,
    urlbordercolor={1 1 1} ]{hyperref}
\usepackage{bookmark}
\bookmarksetup{
  open,
  numbered,
  addtohook={%
    \ifnum\bookmarkget{level}>2 %
      \renewcommand*{\numberline}[1]{}%
    \fi
  },
}
% \usepackage[spanish]{babel}  % Ortografía
\usepackage[utf8]{inputenc}  % Permite acentos


\begin{document}
 \setcounter{tocdepth}{0}
\tableofcontents

\chapter{Introduction} 
\lipsum[1]
\section{First section} \lipsum[2-3]
\section{Second section} \lipsum[4-5]
\section{Last section} \lipsum[6-7]
\chapter{Second chapter} \lipsum[1]
\section{First section} \lipsum[2-3]
\section{Second section} \lipsum[4-5]
\section{Last section} \lipsum[6-7]
\chapter{Last chapter} \lipsum[1]
\section{First section} \lipsum[2-3]
\section{Second section} \lipsum[4-5]
\section{Last section} \lipsum[6-7]
\end{document}

I comented the Spanish babel call

% \usepackage[spanish]{babel} % Ortografía

and is working well. But when I turn spanish on, no index is made.

First error says

Missing \endcsname inserted \lipsum1

But I have many errors by line in the same code!

Of course, I am writing Spanish text, but errors are everywehere...

What should I modify?

Regards

jlopez
  • 111
  • 1
    Works for me (with TeXLive 2016). Former versions of lipsum had a bug, but it seems to be fixed. – Javier Bezos Jul 10 '16 at 07:10
  • I am using TeXLive 2013 in Linux Mint. It comes from repositories. I see similar problem with babel in another Spanish text I wrote. Chapter index is not possible to compile. – jlopez Jul 10 '16 at 15:03
  • While I found no answer at all. I created my personal table of contents at beginning of the book by making manual references to every chapter now. Continue looking for another solution. Thanks to Bezos, Hupter, Werner, Papiro, Seamus and Jesse. – jlopez Aug 01 '16 at 22:22

0 Answers0