TransWikia.com

texindy equivalence to makeindex settings

TeX - LaTeX Asked on March 2, 2021

I’m currently using makeindex to generate an index and was advised by @egreg to use xindy instead to properly manage accents in French. However, I can’t find how to reproduce my current settings:

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

I then use themeindex in my text.

thematique.ist contains:

% Dotfill style
headings_flag 1
heading_prefix "hfill{dayheadfontlargetextbf- "
heading_suffix " -}hfillnopagebreakvspace{0.5baselineskip}"
delim_0 "dotfill "
delim_1 "dotfill "
delim_2 "dotfill "
item_0 "n itemraggedright "
item_1 "n subitemraggedleft "

How can I achieve the same with xindy?

One Answer

It was quite difficult to accomplish this task without a full MWE or a preview of index at hand. I tried that anyway and this is an example of an index with French words. I run these commands:

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

If we change usepackage{luatextra} to inputenc (for pdflatex) or to fontspec (for xelatex), this example will be displaying letters with diacritics in those formats.

%! 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}
fontdayheadfont=cmr10 %at 12pt
defmyheadingstart{%defindexspace{}%justifyhfil
  centeringbegingroupdayheadfontlargebfseries-- }
defmyheadingend{ --endgroupnopagebreakvspace{0.5baselineskip}parraggedright}
defmyown#1{textit{#1}}
defmallettergroup#1{myheadingstart#1myheadingend}
defmalindex#1{myown{hyperpage{#1}}}

begin{document}
ifxrelax
% 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 itemraggedright "
item_1 "n subitemraggedleft "
end{filecontents*}
fi

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

(markup-letter-group :open-head "~nmallettergroup{" :close-head "}%")
(markup-letter-group-list :sep "~n~nindexspace~n")

(markup-indexentry :open "~nitem " :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.
defindexname{Index thématique}%
defthispagestyle#1{}%
printindex
endgroup
My first paragraphldots
end{document}

mwe

Answered by Malipivo on March 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP