Seeking alternative to Xindy for Indic Text Indexing

Hi Typst Community,

I’m currently working on a project that involves creating an index for a document containing Devanagari (Hindi/Sanskrit) text. Traditionally, tools like Xindy are used for handling complex sorting and indexing in multilingual documents, especially for Indic scripts. However, I’m exploring alternatives that might integrate more seamlessly with Typst.

Could anyone recommend a workflow or tool for generating indexes for Indic scripts like Devanagari? Specifically, I’m looking for something that can:

  1. Handle Devanagari sorting rules (e.g., क, ख, ग, घ instead of Latin alphabetical order).
  2. Support multi-level indexing (e.g., main entries and sub-entries).

I’m aware of the in-dexter package it primarily focuses on Latin text and doesn’t fully address the complexities of Devanagari sorting and indexing.

For context, here’s an example of how a Devanagari index is typically formatted:

(क)
कर्म (karma)  
   - धार्मिक अर्थ (religious meaning), 45  
   - दार्शनिक अर्थ (philosophical meaning), 67  
(ग)
गीता (Gita)  
   - अध्याय २ (Chapter 2), 12  
   - अध्याय १८ (Chapter 18), 89  

If anyone has experience with this or can point me to relevant resources, I’d greatly appreciate it!

Thanks in advance!

I think the in-dexter package is the perfect candidate for this actually. It does support multi-level indexing. A quick MWE would give me

#import "@preview/in-dexter:0.7.0": *

= Sample Text

#index[कर्म (karma)][धार्मिक अर्थ (religious meaning)]
#index[कर्म (karma)][दार्शनिक अर्थ (philosophical meaning)]
#index[गीता (Gita)][अध्याय २]
#index[गीता (Gita)][अध्याय १८]

= Index

#make-index(title: none)

This doesn’t give what you would expect for a Devanagari index, but I think it’s still a solid foundation.

I think the way to go would be to adapt the in-dexter package for your use case specifically. I don’t think enough customization is exposed from the look of it, so you’ll have to modify the internals. But it’s definitely looking possible without too much of a hassle.

A few hints:

  • sorting can be done by codepoints if it respects the order you want (the table is here)
  • in-dexter has a Apache 2.0 License, so it’s definitely possible to reuse the code, but maybe the main author would like to collaborate with you on this? You can create an issue on GitHub · Where software is built
1 Like