In some big documents, for example The Cangjie Chinese-English Dictionary, it is necessary both for authors and readers to create one or two keywords lists in book appendices. These lists can help to find information quite efficiently. In this article, I introduce the zhmakeindex program that aims to sort Chinese index entries.
Generating LaTeX Indices Separately
With the LaTeX index generator makeindex, an index can be produced. If you want to create multiple indices in a book, you should use the imakeidx package.
In The Cangjie Chinese-English Dictionary, there are six or seven indices in appendices, and the LaTeX package imakeidx was used. “The package enables the user to produce and typeset one or more indexes simultaneously with a document.”
This package is invoked as usual by means of a \usepackage command in preamble.tex:
The package option noautomatic disables the automatic splitting of the raw index files and running of the system programs. And then We can use the LaTeX index processor texindy and zhmakeindex simultaneously to make Chinese indices and Other Indices separately.
I do love our Great Country undoubtedly. But there is a wall named The Great Firewall of China, if you can’t climb over the GFW, to install these packages will make you go insane. You can build a door to reach the source pages, for exemple shadowsocks and goagent.
If you can’t climb over the Wall, here is a way to install these packages:
$ zhmakeindex -s youistfile.ist youridxfile.idx %%using your personal style file
$ zhmakeindex -s youistfile.ist -z bushou youridxfile.idx %%sorting index entries by chinese characters stroke order
The Layout of Index Entries
Package imakeidx can produce multiple indices and defines some others. For instance, the following commands may be used in preamble.tex file. For detailed information see the imakeidx package documentation.
Then we can run texindy in terminal with this style file:
texindy -M cj.xdy cj.idx
The output file will be like below:
Editing and Using .ist style files
For sorting Chinese characters in .idx file, we can run command zhmakeindex in terminal and in some cases we should edit personal .ist files. Below is an example of a .ist file. Here can find more detailed information about the usage of zhmkeindex.