Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Apart from the general document layout, the layout and formatting of indexes depend on two things:

  • The parameters of .ist (index style) files that are used by makeindex when transforming raw index data into .ind files (which contain a theindex environment). These parameters control, e.g., the presence of letter headings to each index group.

  • The definition of the theindex environment which is part of document classes and may be changed by packages like imakeidx and idxlayout. This definition controls, e.g., the number of index columns.

It is possible (although often not sensible from a typographic point of view) to change the definition of the theindex environment mid-document (e.g., "typeset[ting] a general index in two columns and then switch[ing] to three columns for an index of names", idxlayout manual, p. 4). But is it possible to change .ist (index style) file parameters mid-document (e.g., adding letter headings for groups in some, but not in all indexes)?

EDIT: To clarify: My aim is not to switch .ist parameters within a single theindex environment, but to use different parameters (or achieve a different formatting) for several indexes within the same document.

EDIT 2: I take Martin Schröder's answer as a hint that it is possible to run makeindex "by hand" several times and to choose different .ist files each time. On the other hand, Leo Liu states in a comment that one "can add TeX boolean switches in the .ist format and modify \index to make it work", i.e., control the formatting through LaTeX macros. I'd be interested in a concrete example of a boolean switch within an .ist file.

share|improve this question
    
I don't think so. But you can add TeX boolean switches in the .ist format and modify \index to make it work, I think. Can you explain more about what you want? –  Leo Liu Dec 26 '11 at 17:27
1  
And I think it might be useless: index entries are sorted by makeindex or xindy. Then where is the point the format changes? –  Leo Liu Dec 26 '11 at 17:29
    
@LeoLiu I added an example (adding letter headings for groups only in some indexes). –  lockstep Dec 26 '11 at 17:29
    
@LeoLiu Can you add an answer that elaborates on TeX boolean switches within an .ist file (possibly regarding the presence of letter heads)? –  lockstep Dec 26 '11 at 17:53
    
Well, then you should use imakeidx to generate multiple indexes with different options. imakeidx supports \write18 feature to run makeindex automatically. –  Leo Liu Dec 26 '11 at 17:59

3 Answers 3

up vote 7 down vote accepted

You are mixing two different problems. An .ist file doesn't influence the final appearance of the index, apart from enabling grouping, for instance. It doesn't have anything to do with the number of columns, which is LaTeX's duty to determine via the definition of theindex (that imakeidx modifies to have, for instance, a different number of columns than two).

Say you want a main index, typeset in two columns, using the main.ist style, and a name index, typeset in three columns, using the names.ist style. Then the following declarations will do:

\usepackage{imakeidx}
\makeindex[title=Main Index,columns=2,options=-s main]
\makeindex[name=names,title=Index of Names,colums=3,options=-s names]

An entry for the main index will be defined by \index{tetrapiloctomy}, while an entry for the name index will be defined by \index[names]{Doe, John}.

In general, the options key tells makeindex or xindy what command line options to use (the input and output file names are determined by the package).

In case you have many indices, it's wise to use the splitindex option to imakeidx (\usepackage[splitindex]{imakeidx}), but this requires running LaTeX with the -shell-escape option or to run separately makeindex.

share|improve this answer
    
Many thanks! I knew that .ist files don't influence the number of index columns (and had stated so in my question), but I was not aware of imakeidxs option key and the possibility to choose .ist files this way. –  lockstep Dec 26 '11 at 18:11
    
An .ist file controls the final appearance, not only the index grouping, but also the headings, the items, the page number delimiters etc. –  Leo Liu Dec 26 '11 at 18:18

It is not true that TeX macros can control the input format which a .ist file specifies. It is possible to control some of the output formats by TeX macros. However, it makes no sence in one index.

For multiple indexes, here is an example to use different .ist formats:

\documentclass{book}
\usepackage{imakeidx}
\makeindex[
  name=persons,
  title={Names},
  columns=2,
  program=makeindex, % or xindy, texindy
  options={-s mkind.ist},
  noautomatic=false
]
\makeindex[
  name=colors,
  title={Colors},
  columns=1,
  program=makeindex, % or xindy, texindy
  options={-s icase.ist},
  noautomatic=false
]

\begin{document}
Alice\index[persons]{Alice}
Red\index[colors]{Red}
\newpage

Bob\index[persons]{Bob}
Yellow\index[colors]{Yellow}
\newpage

John\index[persons]{John}
Gray\index[colors]{Gray}

\printindex[persons]
\printindex[colors]
\end{document}
share|improve this answer

You can create multiple indexes (e.g. with the index package) and use different makeindex parameters (and different ist files) for each.

See also How can I have 2 or more distinct indexes in LaTeX?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.