MENDEX(1)

๐Ÿ“ฆ
version 77830 ยท 2 versions
  • 77830 ยท alpine 3.24, arch rolling, debian bookworm, debian trixie, epel 10, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • epel 9
, in alpine 3.24, arch rolling, debian bookworm, debian trixie, epel 10, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

๐ŸŽ€ 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 extension ind tacked 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 extension ilg tacked 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), or even (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 be euc (EUC-JP) or utf8 (UTF-8). It defaults to utf8, 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. R and r mean Roman, n means arabic numeral, and A and a mean 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 as lethead_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 as lethead_suffix, kept around for makeindex compatibility ๐ŸŽ
  • lethead_flag <number> (default 0) โ€” The flag that controls whether heading letters get output. 0 means no output, 1 means uppercase, and -1 means lowercase ๐Ÿ” 
  • heading_flag <number> (default 0) โ€” Same as lethead_flag. Heads up: makeindex calls this one headings_flag instead ๐Ÿ‘€
  • 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> (default 72) โ€” 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> (default 16) โ€” 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 when lethead_flag or heading_flag is a positive number ๐Ÿ’œ
  • symhead_negative <string> (default "symbols") โ€” the heading letter for numbers and symbols when lethead_flag or heading_flag is a negative number ๐Ÿฅ€
  • symbol <string> (default "") โ€” the heading letter for numbers and symbols when symbol_flag is non zero ๐Ÿ”ฅ If you set this, it takes priority over symhead_positive and symhead_negative. (Extended by mendex)
  • symbol_flag <number> (default 1) โ€” the flag for outputting symbols ๐Ÿ™ˆ If it's 0, nothing gets output. (Extended by mendex)
  • letter_head <number> (default 1) โ€” the flag for the heading letter for Japanese Kana ๐Ÿ‡ฏ๐Ÿ‡ต 1 uses Katakana, 2 uses Hiragana. (Extended by mendex)
  • priority <number> (default 0) โ€” 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, E and J stand for symbol, numbers, English and Japanese. (Extended by mendex) > Make sure S and N are 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 ๐Ÿ’…โœจ