创建两个索引,一个是默认索引,另一个是用户定义索引

创建两个索引,一个是默认索引,另一个是用户定义索引

以下脚本在第 2 页生成默认索引,其中包含条目“names 1”,在第 3 页生成单行“namestitle=Names”,在第 3 页生成第 2 页的重复索引。文件names.ind未创建。如何获取两个索引?

\documentclass{book}
\usepackage{index}
\makeindex
\newindex{names}{idx}{ind}{Name Index}
\begin{document}
this is a test of using multi indices
\index{1st entry into default index=Book 1}
\index{names}{1st entry into names index=Author 1}
\index{2nd entry into default index=Book}
\index{names}{2nd entry into names index=Author 2}
\printindex{names}{title=Names}
\printindex
\end{document}

日志文件是

This is pdfeTeXk, Version 3.141592-1.20a-2.2 (Web2c 7.5.3) (format=LATEX 2014.1.7)  26 JAN 2014 21:29
 Source specials enabled.
 %&-line parsing enabled.
**&latex Mult_IndexGNY.tex
(./Mult_IndexGNY.tex
LaTeX2e <2005/12/01>
(c:/Program Files (x86)/PCTeX/PCTeXv6/texmf-dist/tex/latex/base/book.cls
Document Class: book 2005/09/16 v1.4f Standard LaTeX document class
(c:/Program Files (x86)/PCTeX/PCTeXv6/texmf-dist/tex/latex/base/bk10.clo
File: bk10.clo 2005/09/16 v1.4f Standard LaTeX file (size option)
)
\c@part=\count79
\c@chapter=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(c:/Program Files (x86)/PCTeX/PCTeXv6/texmf-dist/tex/latex/index/index.sty
Package: index 2004/01/20 v4.2beta Improved index support (dmj)
\@indexbox=\insert233
\indexproofstyle=\toks14
)
\idxtitle@default=\toks15
\tf@default=\write3
\openout3 = `Mult_IndexGNY.idx'.

Package index Info: Writing index file Mult_IndexGNY.idx on input line 5.
\idxtitle@names=\toks16
\tf@names=\write4
\openout4 = `Mult_IndexGNY.idx'.

Package index Info: Writing index file Mult_IndexGNY.idx on input line 6.

(./Mult_IndexGNY.aux)
\openout1 = `Mult_IndexGNY.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
 (./Mult_IndexGNY.ind [1

] [2


]) (./Mult_IndexGNY.ind
[3

] [4


]) (./Mult_IndexGNY.aux) ) 
Here is how much of TeX's memory you used:
 308 strings out of 95374
 3662 string characters out of 1187507
 1046293 words of memory out of 2500000
 3357 multiletter control sequences out of 10000+50000
 4599 words of font info for 17 fonts, out of 1000000 for 2000
 14 hyphenation exceptions out of 8191
 23i,4n,17p,152b,222s stack positions out of 5000i,500n,1000p,200000b,5000s
 0 PDF objects out of 300000
 0 named destinations out of 131072
 1 words of extra memory for PDF output out of 65536

Output written on Mult_IndexGNY.dvi (4 pages, 1384 bytes).

答案1

您正在加载index,但使用 的语法multind。以下是正确的index样式:

\documentclass{book}
\usepackage{index}
\makeindex
\newindex{names}{idn}{inn}{Name Index}
\begin{document}
this is a test of using multi indices
\index{1st entry into default index=Book 1}
\index[names]{1st entry into names index=Author 1}
\index{2nd entry into default index=Book}
\index[names]{2nd entry into names index=Author 2}
\printindex[names]
\printindex
\end{document}

您必须makeindex在两个文件<filename>.idx和上运行<filename>.idn。如果主文件是thesis.tex,则调用应该是

makeindex thesis
makeindex -o thesis.inn thesis.idn

您应该考虑imakeidx:语法非常相似:

\documentclass{book}
\usepackage{imakeidx}
\makeindex
\makeindex[name=names,title=Name Index]
\begin{document}
this is a test of using multi indices
\index{1st entry into default index=Book 1}
\index[names]{1st entry into names index=Author 1}
\index{2nd entry into default index=Book}
\index[names]{2nd entry into names index=Author 2}
\printindex[names]
\printindex
\end{document}

你呢没有运行 MakeIndex

相关内容