# [OS X TeX] Chapter Index

Ross Moore ross at ics.mq.edu.au
Mon Dec 28 23:02:30 EST 2009

On 29/12/2009, at 2:19 PM, Alain Schremmer wrote:

>
> On Dec 28, 2009, at 9:14 PM, Herbert Schulz wrote:
>
>>
>> On Dec 28, 2009, at 6:33 PM, Alain Schremmer wrote:
>>
>>> For each chapter of a book, I would like to have an index at the
>>> end of the chapter.
>>>
>>> The various ChapterNtext.tex of the book are included in a source
>>> file, BookRoot.tex.
>>> But, in order to work on individual chapters, I also have
>>> individual root files, ChapterNroot.tex .
>>>
>>> So, by having \printindex in each ChapterNroot.tex, I have an
>>> index at the end of the chapter when I typeset it with
>>> ChapterNroot.tex.

This shouldn't be hard to achieve, so long as the  .idx  file
for each chapter has a unique name; e.g.  chapterN.idx .
Then the  makeindex  command is called on each index,
creating   chapterN.ind .

To get a combined index, simply do:

cat chapter*.idx > fullindex.idx

then call  makeindex  on this file  fullindex.idx .

On the next run, each  \printindex  command includes
the appropriate .ind  file.
This will mean that the value of \indexname  must change
at appropriate places throughout the processing, but
there is no need for more than just a single \write  channel.

>>>
>>> What I would like, though, is to have these chapter indexes also
>>> when I typeset with BookRoot.tex
>>>
>>> In other words, something similar to what I get with titletoc (a
>>> companion to the titlesec package), namely both chapter tocs and
>>> a book toc.
>>>
>>> I could not find anything like titledoc for indexes.
>>>
>>> Hopeful regards
>>> --schremmer
>>
>> Howdy,
>>
>> Don't know if this will do the job you want but take a look at the
>> multind package.
>
> I don't know either but I don't think I am going to find out
> anytime soon as CTAN says that No Documentation, on or off, is known.
>
> But then CTAN has a couple more:
>
> --- splitidx which, with "a small program, splitindex" can produce
> several indexes. But it seems to me that these indexes must be at
> the end of the book. The doc, though, explains that

I don't see why this should be so.
Splitting the index may occur at the end of the document,
but this is just preparing the  .ind  files for the next run.

What is needed is to make sure that \printindex  reads the
correct .ind  file, at whatever point these occur in your document.

Read the documentation again, to see whether it handles this
appropriately.

>
> Most packages, which allows more than one index, open more than one
> raw
> index file. Each of these files costs a write file handle. TEX has
> only 16 of these.
> LATEX itself needs some of these for e.g. .aux, .toc, .lot, .lof
> and maybe other
> more or less temporary files, depends on what you are doing.
>
> ---index which "supports multiple indexes in a single document"
> but, sure enough, "In the current implementation, index.sty uses
> one output stream for each index.

This is very wasteful and should be quite unnecessary.

> Since there are a limited number of output indexes, this means that
> there is a limit on the number of indexes you can have in a
> document. See the description of \disableindex for a fuller
> discussion of this problem and one way around it."

> As for myself, I think that I am totally out of luck.
>
> Still, it is an "interesting problem"
>
> Best regards
> --schremmer

Hope this helps,

Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------