# Language in index by .ist file

I've been indexing latex with the imakeidx package. For this I have used the following code with a file .ist style.

Code

\documentclass[letterpaper,12pt,oneside]{book}
\usepackage{imakeidx}
\usepackage{hyperref}
\usepackage{color}               % Requerido para colores específicos
\usepackage{colortbl}
\usepackage[spanish]{babel}      % Idioma del documento
\usepackage{calc}                     % espaciado en el index
\makeindex[options=-s StyleInd.ist]

\begin{document}

the symbol \#\index{\#} should be in the the section "Símbolos".
And the number 9\index{9} should be in the sectiion "números"
Other index like tex\index{tex} was fine.

\printindex
\end{document}


StyleInd.ist:

delim_0 "\\dotfill\ "
delim_1 "\\dotfill\ "


However, the name of the sections of the indexes appears in English and I need them in Spanish. As the other sections of the index appear with letters, I only need to change the language for the section name "symbols" and "numbers".

Thanks, and sorry for my english

• Welcome to TeX.SE. By the way, the package hyperref had to be loaded lat in preamble (exceptional in some rare circumstances, which are not in your case). – Zarko Feb 13 '17 at 2:48
• You example does not compile. – user31729 Feb 13 '17 at 6:58
• By the way, I don't see sections, but try to load babel before imakeidx – user31729 Feb 13 '17 at 13:00

The names "Symbols" and "Numbers" are defined by the Makeindex style variables symhead_positive and symhead_negative. Add them to the .ist file:

symhead_positive "S\\'imbolos"


Also, the code sample of the question prints the headings with color white on the white default background. Maybe the contents of heading_prefix needs an update or the code sample is not complete.

Full example with some guessing and some fixes. In addition, the dependencies on packages tikz and calc are removed, and the calculation is performed using e-TeX's \dimexpr.

% The default definition of environment "filecontents" does not
% overwrite an existing file.
% package "filecontents" redefines the environment in a way that it
% always writes the file.

% \RequirePackage{filecontents}

\begin{filecontents*}{StyleInd.ist}
delim_0 "\\dotfill\ "
delim_1 "\\dotfill\ "
\\begingroup
\\setlength{\\fboxsep}{5pt}%
\\colorbox{blue}{%
\\color{white}\\large\\sffamily\\bfseries
\\hbox to \\dimexpr\\linewidth-2\\fboxsep{%
\\hfill "
}%
}%
\\nopagebreak\\vspace{2mm}%
\\endgroup\n"
\end{filecontents*}

\documentclass[letterpaper,12pt,oneside]{book}
\usepackage{imakeidx}
\usepackage{color}               % Requerido para colores específicos
\usepackage[spanish]{babel}      % Idioma del documento
\usepackage{csquotes}
\usepackage{calc}                     % espaciado en el index
\makeindex[options=-s StyleInd.ist]
\usepackage{hyperref}

\begin{document}

\tableofcontents
\newpage

The symbol \#\index{\#} should be in the the section \enquote{Símbolos}
and the number 9\index{9} should be in the sectiion \enquote{números}.
Other index like tex\index{tex} was fine.

\clearpage
\phantomsection
\printindex
\end{document}


The index page:

• How do you change the \colorboxes to rounded corner? – xxx--- May 30 '17 at 3:38
• @pushpen.paul In short, packages like tcolorbox or TikZ help. – Heiko Oberdiek May 30 '17 at 5:52