.ist 文件索引中的语言

.ist 文件索引中的语言

我一直在用该imakeidx包对 latex 进行索引。为此,我使用了以下带有文件.ist样式的代码。

代码

\documentclass[letterpaper,12pt,oneside]{book}
\usepackage{imakeidx}            
\usepackage{hyperref}
\usepackage{color}               % Requerido para colores específicos
\usepackage{colortbl}  
\usepackage[latin1]{inputenc}    % Teclado en español
\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.


\addcontentsline{toc}{chapter}{Índice alfabético}
\printindex
\end{document}

StyleInd.ist:

delim_0 "\\dotfill\ "
delim_1 "\\dotfill\ "
headings_flag 1
heading_prefix "\\nopagebreak\n\\tikz\\node at (0pt,0pt) [draw=none,line width=1pt,inner sep=5pt]{\\parbox{\\linewidth-2\\fboxsep-2\\fboxrule-2pt}{\\centering\\large\\sffamily\\bfseries\\textcolor{white}{" heading_suffix "}}};\\vspace*{0.2cm}\\nopagebreak\n"

但是,索引部分的名称显示为英文,而我需要的是西班牙语。由于索引的其他部分显示为字母,我只需要将部分名称的语言更改为“符号”和“数字”。

谢谢,抱歉我的英语不好

答案1

名称“Symbols”和“Numbers”由 Makeindex 样式变量symhead_positive和定义symhead_negative。将它们添加到.ist文件中:

symhead_positive "S\\'imbolos"
numhead_positive "N\\'umeros"

另外,问题的代码示例在白色的默认背景上打印了白色的标题。也许内容heading_prefix需要更新或代码示例不完整。

完整示例,包含一些猜测和一些修正。此外,删除了对包tikz和的依赖calc,并使用 e-TeX 的 执行计算\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\ "
headings_flag 1
heading_prefix "
  \\begingroup
    \\setlength{\\fboxsep}{5pt}%
    \\colorbox{blue}{%
      \\color{white}\\large\\sffamily\\bfseries
      \\hbox to \\dimexpr\\linewidth-2\\fboxsep{%
        \\hfill "
heading_suffix "\\hfill
      }%
    }%
    \\nopagebreak\\vspace{2mm}%
  \\endgroup\n"
symhead_positive "S\\'imbolos"
numhead_positive "N\\'umeros"
\end{filecontents*}


\documentclass[letterpaper,12pt,oneside]{book}
\usepackage{imakeidx}
\usepackage{color}               % Requerido para colores específicos
\usepackage[utf8]{inputenc}    % Teclado en español
\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
\addcontentsline{toc}{chapter}{Índice alfabético}
\printindex
\end{document}

索引页:

第 3 页

相关内容