MENDEX(1)
๐ MENDEX(1) ๐
MENDEX(1) from the General Commands Manual, bestie, and the star of this page is mendex ๐
โจ NAME โจ
mendex - Japanese index processor ๐ฏ๐ต
โจ SYNOPSIS โจ
mendex [-ilqrcgfEJSU] [-s sty] [-d dic] [-o ind] [-t log] [-p no] [-I
enc] [--help] [--] [ idx0 idx1 idx2 ...]
โจ DESCRIPTION โจ
okay so mendex is a general purpose hierarchical index generator ๐ง It takes one or more input files (.idx, which a text formatter like LaTeX usually whips up for you), sorts all the entries, and spits out an output file that's ready to be formatted. It's almost compatible with makeindex, and it also has an extra feature for handling the readings of kanji words, which is so iconic ๐
The input and output formats are set up in a style file. The readings of kanji words go in a dictionary file. Your index can nest up to three levels deep (0, 1, and 2) of subitems, so you can get really organized ๐ธ
โจ OPTIONS โจ
-iโ Reads from stdin even when you've given it index files. Main character energy ๐ฅ-lโ Switches to ยดsort by character orderยด. By default you get ยดsort by word orderยด instead, and I'll explain the difference below ๐ฆ-qโ Quiet mode ๐คซ It won't send any messages to stderr, except for error messages and warnings (those always get through, periodt)-rโ Turns off implicit page range formation. By default, three or more pages in a row get abbreviated into a range, like 1โ5 โจ-cโ Squishes runs of in-between blanks (spaces and/or tabs) into one space, and drops any blanks at the start and end. By default, the blanks in your index key stay exactly as they are ๐-gโ Makes the Japanese index head A-line (A, Ka, Sa, ...; 10 characters) from the gojuon table (the Japanese syllabary). By default, all 48 characters in the gojuon table get used ๐-fโ Forces kanji output even when they don't exist in the dictionaries. Bold choice ๐ฅ-s styโ Uses sty as the style file ๐-d dicโ Uses dic as the dictionary file. The dictionary is made of lists of<index_word reading>pairs ๐-o indโ Uses ind as the output index file. By default, the name comes from the base name of the first input file with the extensionindtacked on ๐-t logโ Uses log as the transcript file. By default, the name comes from the base name of the first input file with the extensionilgtacked on ๐-p noโ Sets the starting page number of the output index list to no. The argument can be a number, or one of these:any(the next page to the end of contents),odd(the next odd page to the end of contents), oreven(the next even page to the end of contents) ๐ฆ-Eโ Sets input/output character encoding to EUC-JP ๐-Jโ Sets input/output character encoding to JIS (ISO-2022-JP) ๐ธ-Sโ Sets input/output character encoding to Shift_JIS ๐-Uโ Sets input/output character encoding to UTF-8 ๐ซถ-I encโ Sets the internal character encoding to enc. The argument can beeuc(EUC-JP) orutf8(UTF-8). It defaults toutf8, so you're set unless you say otherwise ๐--helpโ Shows a summary of the options ๐ง--โ Anything after--won't be treated as an option. This is a lifesaver when your input file name starts with-๐
โจ STYLE FILE โจ
okay this part is the blueprint bestie ๐ The style file tells mendex what the .idx input files look like, and what the final output file should look like. The format is upper compatible with makeindex's, so if you know that one you're halfway there โจ The file is a list of <specifier attribute> pairs. There are two kinds of specifiers, input and output, and the pairs can show up in any order you like. A line that starts with ยด%ยด is a comment, so you can leave yourself notes ๐ฌ
โจ Input file style parameter โจ
keyword<string>(default"\\indexentry") โ The command with an argument that holds the index entry being processed ๐ฎarg_open<char>(defaultยด{ยด) โ The opening delimiter that marks where an index entry starts ๐arg_close<char>(defaultยด}ยด) โ The closing delimiter that marks where an index entry ends ๐range_open<char>(defaultยด(ยด) โ The opening delimiter that marks where a page range starts ๐ฆrange_close<char>(defaultยด)ยด) โ The closing delimiter that marks where a page range ends ๐ฆlevel<char>(defaultยด!ยด) โ The delimiter that marks a lower level ๐ชactual<char>(defaultยด@ยด) โ The symbol saying the next sequence should show up as the index strings in the output file ๐encap<char>(defaultยด|ยด) โ The symbol saying the next sequence is a command name to attach to the page number โจpage_compositor<string>(default"-") โ The separator between page levels, for styles that have multi-level page numbers ๐page_precedence<string>(default"rnaRA") โ The priority order for expressing page numbers.Randrmean Roman,nmeans arabic numeral, andAandamean Latin alphabet ๐ฅquote<char>(defaultยด"ยด) โ The escape character for mendex parameters ๐ซงescape<char>(defaultยด\\ยด) โ The escape character for general scripts ๐
โจ Output file style parameter โจ
preamble<string>(default"\\begin{theindex}\n") โ The preamble of the output file ๐ธpostamble<string>(default"\n\n\\end{theindex}\n") โ The postamble of the output file ๐ซถsetpage_prefix<string>(default"\n \\setcounter{page}{") โ The prefix for the page number when a start page is set ๐setpage_suffix<string>(default"}\n") โ The suffix for the page number when a start page is set ๐group_skip<string>(default"\n\n \\indexspace\n") โ The strings that add vertical space before a new section of the index ๐lethead_prefix<string>(default"") โ The prefix for the heading of a newly appearing heading letter ๐heading_prefix<string>(default"") โ Same aslethead_prefix, kept around for makeindex compatibility ๐lethead_suffix<string>(default"") โ The suffix for the heading of a newly appearing heading letter ๐heading_suffix<string>(default"") โ Same aslethead_suffix, kept around for makeindex compatibility ๐lethead_flag<number>(default0) โ The flag that controls whether heading letters get output.0means no output,1means uppercase, and-1means lowercase ๐heading_flag<number>(default0) โ Same aslethead_flag. Heads up: makeindex calls this oneheadings_flaginstead ๐item_0<string>(default"\n \\item ") โ The command sequence inserted between primary level entries ๐งitem_1<string>(default"\n \\subitem ") โ The command sequence inserted between sub level entries ๐งitem_2<string>(default"\n \\subsubitem ") โ The command sequence inserted between subsub level entries ๐งitem_01<string>(default"\n \\subitem ") โ The command sequence inserted between primary and sub level entries ๐งitem_x1<string>(default"\n \\subitem ") โ The command sequence inserted between primary and sub level entries when the main entry doesn't have a page number ๐ฅบitem_12<string>(default"\n \\subsubitem ") โ The command sequence inserted between sub and subsub level entries ๐งitem_x2<string>(default"\n \\subsubitem ") โ The command sequence inserted between sub and subsub level entries when the sub level entry doesn't have a page number ๐ฅบencap_prefix<string>(default"\\") โ the little prefix that goes in front of an encapsulating command when it gets stuck onto the page number ๐encap_infix<string>(default"{") โ the bit that sits right before the page number when the encapsulating command is added ๐encap_suffix<string>(default"}") โ the closing bit that comes after the page number when the encapsulating command is added โจline_max<number>(default72) โ the max length of one line ๐ If a line goes past this number, it gets folded ๐ฆindent_space<string>(default"") โ the space used to indent the top of a folded line ๐ซถindent_length<number>(default16) โ how long that indent space is when it's inserted at the top of a folded line ๐ธsymhead_positive<string>(default"Symbols") โ the heading letter for numbers and symbols whenlethead_flagorheading_flagis a positive number ๐symhead_negative<string>(default"symbols") โ the heading letter for numbers and symbols whenlethead_flagorheading_flagis a negative number ๐ฅsymbol<string>(default"") โ the heading letter for numbers and symbols whensymbol_flagis non zero ๐ฅ If you set this, it takes priority oversymhead_positiveandsymhead_negative. (Extended by mendex)symbol_flag<number>(default1) โ the flag for outputting symbols ๐ If it's0, nothing gets output. (Extended by mendex)letter_head<number>(default1) โ the flag for the heading letter for Japanese Kana ๐ฏ๐ต1uses Katakana,2uses Hiragana. (Extended by mendex)priority<number>(default0) โ the flag for how index words made of Japanese and non-Japanese text (ex. Latin scripts) get sorted ๐ If it's non zero, one space (U+20) gets inserted between a Japanese sequence and a non-Japanese sequence during sorting. (Extended by mendex)character_order<string>(default"SNEJ") โ the order of scripts and symbols ๐S,N,EandJstand for symbol, numbers, English and Japanese. (Extended by mendex) > Make sureSandNare right next to each other, because mendex treats numbers as part of the symbol group. Don't skip this one bestie ๐ญ
โจ ABOUT JAPANESE PROCESSING โจ
okay so mendex has an extra feature that makes Japanese indexes way easier to handle than with makeindex ๐ You don't have to manually type out a reading for every single kanji word. Lowkey iconic, no cap.
Japanese kanji words usually get sorted by the syllables of their readings (ยดYomiยด), and those readings can be written with kana (Hiragana or Katakana) ๐ธ mendex can accept index words written straight in kana in your input file, and it can also convert index words into kana by checking Japanese dictionaries ๐
Here are some examples of how syllables get simplified internally ๐
ใใถใใใใใใ ใใตใใใใใใ
ใใใญใณใใใทใฅ ใพใคใใใจใคใใ
ใฏใผใใญ ใใใตใ
The dictionary file is a list of <ยดindex_wordยด ยดreadingยด> pairs ๐ฆ The index word can be in any script (kanji, kana, etc), but the reading has to be in Hiragana or Katakana. The thing separating the index word and its reading is one or more tab(s) or space(s). Here's an example dictionary ๐ง
ๆผขๅญ ใใใ
่ชญใฟ ใใฟ
็ฐๅข ใใใใใ
ฮฑ ใขใซใใก
Here's the tea โ each index word can only have one Yomi in the dictionary. Some kanji words (ex. ใ่กจใ) can have more than one Yomi (ex. ใใฒใใใ and ใใใใฆใ), but only one of them can be registered ๐ If you need a different Yomi, you have to write it out explicitly in kana on the input file, like \index{ใฒใใ@่กจ} or \index{ใใใฆ@่กจ} ๐
Also, a dictionary file gets read automatically if you set its file name in the environment variable INDEXDEFAULTDICTIONARY โจ The dictionary set by that environment variable can be used together with the file(s) you pass with the -d option ๐ซถ
โจ ABOUT SORTING PROCEDURE โจ
by default mendex sorts indexes as is (ยดsort by word orderยด) ๐ If you set the -l option, spaces between words in an index get truncated before the sorting happens (ยดsort by character orderยด) ๐ Even when sorting by character order, the index in the output keeps its original sequence, without the truncation. Main character energy ๐โโ๏ธ
Here's an example ๐
sort by word order sort by character order
X Window Xlib
Xlib XView
XView X Window
There are also two sorting methods for indexes that mix Japanese kana with other scripts (e.g. Latin script) ๐ฏ๐ต In a style file, setting priority to 0 (the default) or 1 controls whether a space gets inserted between Japanese Kana and other scripts before the sorting happens. priority=0 inserts the space, and priority=1 does not ๐ฆ Here's how that looks โจ
priority=0 priority=1
index sort indใใกใคใซ
indใใกใคใซ index sort
โจ ENVIRONMENT VARIABLES โจ
mendex checks these environment variables ๐
INDEXSTYLEโ the directory where index style files live ๐INDEXDEFAULTSTYLEโ the index style file that gets used as the default ๐INDEXDICTIONARYโ the directory where dictionary files live ๐INDEXDEFAULTDICTIONARYโ the dictionary file that gets read automatically ๐ซถ
โจ DETAIL โจ
the detailed specification is compatible with makeindex ๐ง So if you already know makeindex, you're basically already a pro ๐
โจ KNOWN ISSUES โจ
โ ๏ธ bestie, heads up: when you use a plural page number expression, you should specify the .idx files along with the order of the page numbers. If you don't, wrong page numbers might get output ๐ญ
โจ SEE ALSO โจ
tex(1), latex(1), makeindex(1) ๐ธ
โจ AUTHOR โจ
This manual page was written by Japanese TeX Development Community ๐
Okay that's the whole page, you made it bestie ๐ฅน๐ซถ MENDEX(1) forever, periodt ๐ โจ
๐ฆ where this page comes from
- alpine 3.24: texmf-dist-langjapanese-doc 2026.0-r0 ยท LPPL-1.0 AND LPPL-1.1 AND LPPL-1.2 AND LPPL-1.3a AND LPPL-1.3c AND GPL-2.0-only
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms