TransWikia.com

Can the comma in the index be replaced by another character?

TeX - LaTeX Asked on March 18, 2021

I am looking for a simple solution to change index entries so that I get honey • 24 instead of honey, 24. I looked through a couple of articles on influencing the index style (idxlayout customized delimiters, Is there an easy way to hide comma (,) from the end of the indexed words?) but it seems that I am not advanced enough to make use of those ideas.

EDIT: I am looking explicitly for a xindy solution, i.e. how to make or change a (which?) *.xdy file.

Here’s an MWE with all the preamble stuff (I left more or less everything important):

documentclass[10pt,twoside,titlepage,headsepline,headings=small,BCOR=17mm]{scrbook}
usepackage{scrlayer-scrpage} % scrpage2
usepackage{cmap}
usepackage{ulem}
usepackage[utf8]{inputenc}
usepackage[vietnamese=nohyphenation]{hyphsubst}
usepackage[vietnamese,polish]{babel}
usepackage[T5,T1]{fontenc}
usepackage{longtable}
usepackage{lmodern}
usepackage{makeidx}
usepackage[columns=2,itemlayout=abshang,initsep=1.8em plus 0.2em minus 0.2em]{idxlayout}
usepackage{mathtools}
usepackage{graphicx}
usepackage{etoolbox}

newcommand{rawindex}[1]{expandafterindexexpandafter{detokenize{#1}}}

makeindex

begin{document}
mainmatter

Some text rawindex{text} is written rawindex{text!more text} here. What rawindex{hello} do you think of me?

backmatter
    cleardoublepage
    addcontentsline{toc}{chapter}{INDEKS}
    ihead[]{}
    sffamily
setindexprenote{Hello!}
printindex
end{document}

Does anyone have an idea of a simple solution for the needed change?

EDIT: I removed irrelevant parts in the example above.

One Answer

With a more MWE…

documentclass{scrbook}

usepackage{makeidx}
usepackage[columns=2,itemlayout=abshang,initsep=1.8em plus 0.2em minus 0.2em]{idxlayout}

makeindex

begin{filecontents}{jobname.mst}
delim_0 " $cdot$  "
delim_1 " $cdot$  "
delim_2 " $cdot$  "
delim_n ", "
end{filecontents}

begin{document}
    mainmatter
    
    Some text index{text} is written index{text!more text} here. What index{hello} do you think of me?
    
    clearpage
    Textindex{text}
    
    backmatter
    cleardoublepage
    addcontentsline{toc}{chapter}{INDEKS}
    sffamily
    setindexprenote{Hello!}
    printindex
end{document}

Answered by NBur on March 18, 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