texindy 等同于 makeindex 设置

texindy 等同于 makeindex 设置

我目前正在使用 makeindex 生成索引,@egreg 建议我改用 xindy 来正确管理法语中的重音。但是,我找不到如何重现我当前的设置:

\makeindex[title={Index th\'ematique},intoc,options=-r -s thematique.ist,columns=2]
\newcommand{\themeindex}[1]{\index{#1|transform}}

\themeindex然后我在我的文本中使用。

thematique.ist包含:

% Dotfill style
headings_flag 1
heading_prefix "\\hfill\{\\dayheadfont\\large\\textbf- "
heading_suffix " -\}\\hfill\\nopagebreak\\vspace\{0.5\\baselineskip\}"
delim_0 "\\dotfill "
delim_1 "\\dotfill "
delim_2 "\\dotfill "
item_0 "\n \\item\\raggedright "
item_1 "\n \\subitem\\raggedleft "

我如何使用 xindy 实现同样的效果?

答案1

如果没有完整的 MWE 或索引预览,完成这项任务相当困难。无论如何,我尝试了,这是法语单词索引的示例。我运行以下命令:

lualatex mal-xindy-style.tex
xindy -M texindy -C utf8 -L french -M mal-makeindex-style mal-xindy-style.idx
lualatex mal-xindy-style.tex

如果我们将 改为\usepackage{luatextra}inputenc对于pdflatex)或改为fontspec(对于xelatex),此示例将以这些格式显示带有变音符号的字母。

%! lualatex mal-xindy-style.tex
\documentclass[a4paper]{article}
\usepackage{luatextra} % Use inputenc with pdflatex or fontspec with xelatex to achieve proper displaying of letters with diacritics.
\pagestyle{empty}\parindent=0pt
\usepackage[hyperindex=false, colorlinks]{hyperref}
\usepackage{makeidx}
\makeindex %[title={Index th\'ematique}, intoc, options=-r -s thematique.ist,columns=2]
\newcommand{\themeindex}[1]{\index{#1|malindex}}
\usepackage{filecontents}
\font\dayheadfont=cmr10 %at 12pt
\def\myheadingstart{%\def\indexspace{}%\justify\hfil
  \centering\begingroup\dayheadfont\large\bfseries-- }
\def\myheadingend{ --\endgroup\nopagebreak\vspace{0.5\baselineskip}\par\raggedright}
\def\myown#1{\textit{#1}}
\def\mallettergroup#1{\myheadingstart#1\myheadingend}
\def\malindex#1{\myown{\hyperpage{#1}}}

\begin{document}
\ifx\relax
% An original file for makeindex...
\begin{filecontents*}{thematique.ist} 
% Dotfill style
headings_flag 1
heading_prefix "\\myheadingstart "
heading_suffix " \\myheadingend "
delim_0 "\\dotfill "
delim_1 "\\dotfill "
delim_2 "\\dotfill "
item_0 "\n \\item\\raggedright "
item_1 "\n \\subitem\\raggedleft "
\end{filecontents*}
\fi

% A style file for xindy...
\begin{filecontents*}{mal-makeindex-style.xdy}
(markup-index :open  "\begin{theindex}~n"
    :close "~n~n\end{theindex}~n"
    :tree) 

(markup-letter-group :open-head "~n\mallettergroup{" :close-head "}%")
(markup-letter-group-list :sep "~n~n\indexspace~n")

(markup-indexentry :open "~n\item " :close "" :depth 0)
(markup-indexentry :open "~n  \subitem " :close "" :depth 1)
(markup-indexentry :open "~n    \subsubitem " :close "" :depth 2)
(markup-locclass-list :open "\dotfill " :sep ", " :close "")
(markup-locref-list   :sep ", ")

(define-attributes (("malindex")) )
(markup-locref :attr "malindex" :open "\malindex{" :close "}")
(markup-locref :attr "hyperpage" :open "\hyperpage{" :close "}")
(markup-locref :attr "default" :open "\hyperpage{" :close "}")
\end{filecontents*}

\index{premier niveau}
\index{niveau!1@premier}
\index{niveau!2@deuxième}
\index{niveau!1@premier!1@premier}
\index{niveau!1@premier!2@deuxième}
\themeindex{niveau!2@deuxième!1@premier}
\themeindex{niveau!2@deuxième!2@deuxième}
\index{étrangères}
\index{Ça va}
\index{À quelle}
\themeindex{éteindre}
\themeindex{surhomme}
\themeindex{œil}

\begingroup
% I wish not to have page number in index.
\def\indexname{Index thématique}%
\def\thispagestyle#1{}%
\printindex
\endgroup
My first paragraph\ldots
\end{document}

姆韦

相关内容