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.

I am not an expert at all with LaTeX; I used it for the very first time some month ago to compose a conference proceedings volume modifying an already available script.

I am trying to refine the final aspect of the this year edition of the proceedings using personalized authors and affiliations indexes.

I make use of the imakeidx package with LaTeX and I would like to know if it is possible to: 1) substitute the default comma separating the index entry from the first page number in the index with a colon; as an example I would like to have

Einstein Albert: 1, 2, 3

instead of the predefined

Einstein Albert, 1, 2, 3

2) control the indentation of lines following the first in the index; with predefined settings I obtain something like

Einstein Albert, 1, 2, 3, 4, 5,
       6, 7, 8

Any hint?

share|improve this question
add comment

1 Answer

For getting the colon you need to define a new MakeIndex style; it's really simple: just prepare the following 31083.ist file in the same folder as your main document, with the single line

delim_0 ": "

because delim_0 is the container of the tokens inserted between an index entry and the first page number (if any). Then you have to instruct imakeidx to use the newly defined style.

For controlling the indentation of the following lines, you have to modify the definition of \@idxitem; something like

\makeatletter
\renewcommand{\@idxitem}{\par\hangindent=20pt }
\makeatother

will use 20pt instead of the default 40pt.

Complete example.

\documentclass{book}
\usepackage{imakeidx}
\makeindex[name=people,title=Index of People,options=-s 31083.ist -r]

\makeatletter
\renewcommand{\@idxitem}{\par\hangindent=20pt }
\makeatother

\begin{document}
\mainmatter
\chapter{Relativity}

Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\newpage
Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\newpage
Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\newpage
Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\newpage
Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\newpage
Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\newpage
Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\newpage
Einstein\index[people]{Einstein, Albert}
Zorro\index[people]{Zorro}

\printindex[people]

\end{document}

I have used also the option -r to disable implicit range formation, otherwise the example would have shown "1–8" so not going to the second line. You'll probably want to remove it.

enter image description here

share|improve this answer
    
Dear egreg, thank you very much for your answer and clear example; I just used your hints in my script and it works great. Regards. Francesco –  user31083 May 23 '13 at 13:03
    
@user31083 Please, when you have time, have a look at the site's FAQ, particularly tex.stackexchange.com/faq#reputation –  egreg May 23 '13 at 13:06
add comment

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.