2

I'm writing a document in Spanish (with babel), but the name of \tableofcontents is still "Contents". I've tried with \renewcommand{\contentsname}, \addto\captionsspanish and a lot of different combinations but it doesn't work.

I don't know what is happening, because the name of the bibliography is in Spanish, so babel is working properly there.

This is the code I'm using:

\documentclass[11pt,aps,prd,preprintnumbers,nofootinbibn,onecolumn]{revtex4}
\usepackage{graphicx} 
\usepackage{dcolumn}  
\usepackage{bm}       
\usepackage{amssymb}   
\usepackage[utf8x]{inputenc}
\usepackage[spanish]{babel}
\usepackage{shapepar}
\usepackage{amsmath}
\usepackage{array}
\usepackage{fancybox}
\usepackage{multirow}
\usepackage{appendix}
\usepackage{epsfig}
\usepackage{subfigure}
\usepackage{caption}
\usepackage{float}
\usepackage{braket}
\usepackage{amsfonts}
\usepackage{mathrsfs,amsmath}
\usepackage{chemmacros}
\usepackage{bbold}
\usepackage{framed}
\usepackage[usestackEOL]{stackengine}
\usepackage{lipsum}
\usepackage{blindtext}
\usepackage{soul}
\newcommand*\dif{\mathop{}\!\mathrm{d}}
\newcommand*\Dif[1]{\mathop{}\!\mathrm{d^#1}}
\hyphenation{ALPGEN}
\hyphenation{EVTGEN}
\hyphenation{PYTHIA}
\addtolength{\textwidth}{0cm}
\addtolength{\hoffset}{0cm}
\addtolength{\textheight}{1.6cm}
\addtolength{\voffset}{0cm}
\DeclareMathOperator{\Tr}{Tr}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\usepackage{geometry}\geometry{a4paper, total={160mm,247mm}, left=25mm, top=25mm, }
\usepackage{setspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\title{\huge{Título}\\[0.4cm]}
\thispagestyle{empty}

\begin{abstract}
\begin{center}
\today\\
\vspace{1cm}

\hspace{1em}{\bf Autor:}\\
\vspace{0.1cm}
\hspace{1em}NAME $^\ddagger$\\
\vspace{0.8cm}
{\it Universidad}\vspace{2em}
\end{center}
\hline\vspace{1em}
{\bf Abstract:} \vspace{-0.5em}
\singlespacing
\small{...}\vspace{2em}\hline \vspace{1em}
\scriptsize{$^\ddagger$  E-mail: \texttt{...}
\end{abstract}

\clearpage
\maketitle

\newpage
\thispagestyle{empty}
\spacing{2}
\begin{quotation}
\tableofcontents
\end{quotation}

\section{Introducción}
\setcounter{page}{1} 

\begin{thebibliography}{99}
\bibitem{1}
...

\end{thebibliography}
\end{document}

Thank you.

7
  • I've already tried that, but it doesn't work, no variation of \renewcommand{\contentsname} seems to change the name in my document. – TsuKi Jan 8 '17 at 10:16
  • Alright, I've a look. Please wrap that long lines with \usepackage{...} at the beginning, that's awful.... You're loading some packages, epsfig is outdated and why manipulating layout parameters whereas you use geometry already? – user31729 Jan 8 '17 at 10:16
  • Sorry, I'm new here ... How do I wrap lines? – TsuKi Jan 8 '17 at 10:19
  • 1
    Using the newline 'enter' key on your keyboard? – user31729 Jan 8 '17 at 10:20
  • 2
    note size change commands like \small and huge do not take an argument so \small ... not \small{...} commands \bf and \it are deprecated and don't load epsfig unless you need to emulate a document using a package from 1990. – David Carlisle Jan 8 '17 at 10:25
3

The name of the ToC is stored in \tocname.

Use

\addto\captionsspanish{\renewcommand{\tocname}{Índice}}

instead of \renewcommand{\contentsname}{Índice}}

\documentclass[11pt,aps,prd,preprintnumbers,nofootinbibn,onecolumn]{revtex4}

\usepackage[utf8]{inputenc} 
\usepackage[spanish]{babel} 
\addto\captionsspanish{\renewcommand{\tocname}{Índice}}
\begin{document}
\tableofcontents
\section{Introducción}

\end{document}

I kicked all unnecessary (and wrong content) out of the preamble

enter image description here

5
  • Ok, it is working now! The name apperas properly adding that command line. Thank you very much! @Christian Hupfer Do I need to erase all the other packages? Some of them are needed for math equations... – TsuKi Jan 8 '17 at 10:28
  • @TsuKi: Just for shortness. Your document was not compilable at all. – user31729 Jan 8 '17 at 10:29
  • 1
    @TsuKi but only put back the packages that you actually use. It makes no sense at all to have lipsum, blindtext, epsfig in a current math paper and probably not shapepar, stackengine, better to use utf8 than utf8x and only load chemmacros if you are using that chemistry package, etc. – David Carlisle Jan 8 '17 at 11:33
  • 1
    Belated congratulations on passing the 100k rep mark!! – Mico Jan 10 '17 at 15:21
  • Please consider to accept this answer since it was the solution – user31729 Jan 15 '17 at 18:11

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.