[OS X TeX] Chapter Index

Alain Schremmer schremmer.alain at gmail.com
Tue Dec 29 11:17:25 EST 2009


On Dec 28, 2009, at 11:02 PM, Ross Moore wrote:

>
> 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.

Forgive me but I am going to have to be like a serious but somewhat  
dumb student:

> This shouldn't be hard to achieve, so long as the  .idx  file
> for each chapter has a unique name; e.g.  chapterN.idx .

They do: along with each ChapterNroot.tex, I have ChapterNroot.idx.

> Then the  makeindex  command is called on each index,
> creating   chapterN.ind .

When I call MakeIndex from ChapterNRoot.tex it does create ChapterN.ind

> To get a combined index, simply do:
>
>   cat chapter*.idx > fullindex.idx

I understand that a new fille, Book.idx, has to be created. But:

---Is this something I should do "by hand", by typing the preceding  
line in the terminal? In which case, I would have to do this every  
time I want to typeset Book by way of BookRoot rather than just a  
single ChapterN by way of ChapterNroot.
That would be perfectly OK---other than having to talk to the  
terminal with which I am not on speaking terms---since I rarely  
typeset Book. I would just have to remember doing it when typesetting  
Book just before uploading.

---Or does that imply some tex code I should insert somewhere so  
that, every time I typeset the whole Book by way of BookRoot, the  
index would automatically be updated?
That would be great although, I expect, rather unlikely and, in any  
case and as I just said, of the order of the cream on the cake.

> then call  makeindex  on this file  fullindex.idx .

I assume this means to click on MakeIndex from BookRoot. There are  
indeed files Book.idx and Book.ind. But I have a feeling that  
MakeIndex creates Book.idx directly, that is by reading all the  
ChapterNtext.tex rather than conflating the ChapterN.idx files

> On the next run, each  \printindex  command includes
> the appropriate .ind  file.

This is what I don't understand: When I typeset the whole Book, I do  
it from BookRoot.tex so LaTeX will only see the single \printindex  
that is at the end of BookRoot.tex and so how can it print  
ChapterNIndex at the end of ChapterN for all N but only BookIndex at  
the end of Book.

I tried to insert a \printindex after each \include{ChapterNtext} and  
sure enough it printed BookIndex after each chapter.

==================

> 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.


>> --- 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.

 From what I understood, that is indeed the problem, namely that  
there is no such thing as \printindex{ChapterN}

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

Are you kidding? I wouldn't know an appropriate from an inappropriate  
even if they were both to bite me.

>> 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.

Well ... I think now you are talking to the wrong person, I only work  
here.

Very grateful regards
--schremmer




More information about the MacOSX-TeX mailing list