zhmakeindex命令的简单用法如下:
$ zhmakeindex 用法: zhmakeindex [-c] [-i] [-o <ind>] [-q] [-r] [-s <sty>] [-t <log>] [-enc <enc>] [-senc <senc>] [-strict] [-z <sort>] [<输入文件1> <输入文件2> ...] 中文索引处理程序 选项 默认值 说明 -c false 忽略条目首尾空格 -enc utf-8 读写索引文件的编码 -i false 从标准输入读取 -o 无 输出文件 -q false 静默模式,不输出错误信息 -r false 禁用自动生成页码区间 -s 无 格式文件名 -senc utf-8 格式文件的编码 -strict false 严格区分不同 encapsulated 命令的页码 -t 无 日志文件名 -z pinyin 中文分组排序方式,可以使用 pinyin (reading)、bihua (stroke) 或 bushou (radical)
那么具体使用如下:
$ zhmakeindex youridxfile.idx %%using default .ist file $ 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
下面我用宏包定制一下索引的显示样式:
\usepackage[noautomatic]{imakeidx}
\makeindex[name=ec,title=英漢索引,intoc,columns=5,columnseprule=true,columnsep=5pt,options={-s ec.ist}]
\makeindex[name=th,title=類詞索引,intoc,columns=5,columnseprule=true,columnsep=5pt,options={-s th.ist}]
\makeindex[name=zb,title=字辨索引,intoc,columns=5,columnseprule=true,columnsep=5pt,options={-s zb.ist}]
\makeindex[name=gy,title=國音索引,intoc,columns=5,columnseprule=true,columnsep=5pt,options={-s gy.ist}]
\makeindex[name=yy,title=粵音索引,intoc,columns=5,columnseprule=true,columnsep=5pt,options={-s yy.ist}]
\makeindex[name=bh,title=總畫索引,intoc,columns=6,columnseprule=true,columnsep=5pt,options={-M bh.xdy}]
\makeindex[name=cj,title=倉頡索引,intoc,columns=6,columnseprule=true,columnsep=5pt,options={-M cj.xdy}]导言区可以修正一下间隔
\makeatletter
%%define index items layout
\def\@idxitem{\par\addvspace{7\p@ \@plus 3\p@ \@minus 3\p@}\hangindent 17\p@}
%%define index subitems layout
\def\subitem{\par\hangindent 0\p@ \hspace*{0\p@}}
%%define index subsubitems layout
\def\subsubitem{\par\hangindent 0\p@ \hspace*{0\p@}}
%%define vspace above lettergroup name
\def\indexspace{\par\addvspace{12\p@ \@plus 2\p@ \@minus 2\p@}}
\patchcmd\theindex{\indexname}{\indexname\vspace{5pt}}{}{}
\makeatother那么打印索引如下:
......
\phantomsection
\addcontentsline{toc}{part}{辭典檢索}
\backmatter
\onecolumn
\pagestyle{mipage}
\printindex[zb] % zhmakeindex -s zb.ist -z pinyin ec.idx
\printindex[ec] % zhmakeindex -s ec.ist -z pinyin ec.idx
\printindex[th] % zhmakeindex -s th.ist -z pinyin th.idx
\printindex[bh] % texindy -M bh.xdy bh.idx
\printindex[cj] % texindy -M cj.xdy cj.idx
\printindex[yy] % zhmakeindex -s yy.ist -z bihua yy.idx
\printindex[gy] % zhmakeindex -s gy.ist -z bihua gy.idx
\end{document}使用titleps宏包定义扩展页眉样式:
\newcommand{\indexmark}[1]{\sectionmark{#1}#1}
\newpagestyle{mipage}{ %%index chapter
\setheadrule{0.7pt}
\sethead[{\toptitlemarks\sectiontitle}---{\bottitlemarks\sectiontitle}]
[\linfontb\thepage]
[{\profonta Appendices—\chaptertitle}]%even head
{{\profonta Appendices—\chaptertitle}}
{\linfontb\thepage}
{{\toptitlemarks\sectiontitle}---{\bottitlemarks\sectiontitle}}%odd head
\setfoot[][][] %even foot
{}{}{} %odd foot
}效果如图:
那么我们也可以扩展:
%人名地名書名索引 \printindex[isn] % zhmakeindex -s isn.ist isn.idx %作者索引 \printindex[ian] % zhmakeindex -s ian.ist ian.idx %篇目索引 \printindex[ibn] % zhmakeindex -s ibn.ist ibn.idx
效果如下:
选自:http://mengxianjun.org/2016/12/11/TangPoem/
http://mengxianjun.org/2016/10/15/zhmakeindex/
扩展阅读:https://www.ctan.org/pkg/zhmakeindex (宏包下载安装)


发表评论 取消回复