5

I am trying to make two separate indexes for my PhD dissertation, the author index and the subject index. Creating the author index is quit easy, I just use the \usepackage{makeidx} and \printindex command and LaTeX creates a beautiful author index for me. What if I want to add the subject index before the author index? I have read the responses to the similar question on StackExchange: How can I have two or more distinct indexes? but it is not a viable solution for me, because it requires me to manually index both authors and subjects. Currently, I do not have to index the authors and latex creates the index for me automatically. Is there any way to only index the subjects manually ( I mean to use \index{key} for every subject of interest) and have the authors index automatically? The \authorindex package does not work with \natbib

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Apr 30 '14 at 04:16
  • With author index you mean the bibliography? –  Apr 30 '14 at 04:17
  • How should LaTeX know that a specific Word is an author? You will need to tag them somehow if you want a real index and not just a bibliography. What you can do (using the linked answer) is to create a command, e.g. \authorindex{} that encapsules the \index{authors}{Author} line. – Uwe Ziegenhagen Apr 30 '14 at 04:20
  • 2
    No, with author index I mean a list of authors and the page numbers which they have been cited in. It is completely different from the bibliography. – user50822 Apr 30 '14 at 04:37
  • 1
    The nice thing about \authorindex package is that I do not have to index the authors manually! It creates the author index automatically. please see here for an example: http://tex.stackexchange.com/questions/24332/bibtex-and-index-of-authors – user50822 Apr 30 '14 at 04:40
  • @user50822: Well, you did not mention authorindex and \printauthorindex at all! If that package generates it for you -- it's nice. It obtains the information from the list of cited authors. The other (subject) index has to be done manually. How should TeX know which subject is important for you? Say \index{subject} and it should appear. –  Apr 30 '14 at 04:50
  • Sorry for the confusion, I should have been more specific. When I do as you said, the subject index will appear exactly after the author index. I want to have two separate indexes and control the place where they appear in the document. – user50822 Apr 30 '14 at 05:18
  • @user50822: Perhaps you should edit your original question and explicitly state, that you are using the authorindex package. –  May 01 '14 at 06:22

1 Answers1

5

The authorindex and natbib packages collide at first glance, but in section 7.2.3 of the manual (http://mirrors.ctan.org/indexing/authorindex/authorindex.pdf) a solution is provided by using a local natbib.cfg, which I just copy from the manual, I have not developed that material:

Content of natbib.cfg:

\AtBeginDocument{%
\@ifpackageloaded{authorindex}{%
\ifNAT@numbers
\let\org@@citex\NAT@citexnum
\else
\let\org@@citex\NAT@citex
\fi
\def\@citex[#1][#2]#3{%
\typeout{indexing: [#1][#2]{#3}}%
\org@@citex[#1][#2]{#3}%
\@aicitey{#3}}%
\renewcommand\NAT@wrout[5]{%
\if@filesw{%
\let\protect\noexpand\let~\relax
\immediate\write\@auxout{\string\aibibcite{#5}{#1}}%
\immediate\write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}%
\fi}}{}}
\endinput

Place this file (exactly with this name!) in the folder where your document source is stored.

The next step is to replace all \aicite commands with 'traditional' \cite (otherwise it does not work. Why???? I have no clue, but I did not look into the package files either)

I added the rather simple command \listofauthors, which includes the authorindex, further formatting is not done, however.

\documentclass[12pt]{book}

\usepackage{natbib}
\usepackage{blindtext}

\usepackage{makeidx}
\usepackage[pdftex,plainpages=false]{hyperref}
\RequirePackage{authorindex}

% Use this, if you want hyperlinks back from list of author entry to page
% where the citation was placed
\def\theaipage{\string\hyperpage{\thepage}} 

\newcommand{\listofauthorsname}{List of Authors}%

\newcommand{\listofauthors}{%
\chapter*{\listofauthorsname}%
\phantomsection%
\addcontentsline{toc}{chapter}{\listofauthorsname}%
\noindent%
\printauthorindex%
}%

\makeindex
\begin{document}

\tableofcontents

\chapter{Introduction}

Einstein showed that  \[ E = m \cdot c^2,\]
i.e. the equivalence\index{Equivalence} of mass\index{Mass} and energy\index{Energy}.\par

In their books \cite{GSM97} or \cite{Lam94} show how to typeset those equation ;-)

\blindtext

\printindex

\bibliographystyle{alpha}
\bibliography{biblio}

\listofauthors


\end{document}

Workflow on foo.tex

  1. pdflatex foo.tex
  2. makeindex foo
  3. bibtex foo
  4. authorindex foo
  5. pdflatex foo

enter image description here

  • 2
    You can use of of the existing bib files in your tex distribution. They are under $TEXMF/bibtex/bib/ –  Apr 30 '14 at 06:10
  • @Herbert: Good to know, I never looked into that. –  Apr 30 '14 at 06:21
  • @Christian: Thank you very much for the useful help. What if I want to use the \natbib package? When I do so, right after the \begig{document} I use \citeindextrue and the index of authors will appear with \printindex but \printauthorindex does not work! here it says that I have to use perl. http://tex.loria.fr/bibdex/authorindex.pdf what is your idea? – user50822 Apr 30 '14 at 13:25
  • 1
    @ChristianHupfer again to clarify, with \natbib package, \printauthorindex is not producing anything. to get the index of authors, I should use \citeindexture and \printindex together. the problem is that in doing so, the index of authors and subjects get mixed together! – user50822 Apr 30 '14 at 13:30
  • @user50822: I'll look after later on. –  Apr 30 '14 at 16:44
  • @ChristianHupfer Thanks, I really appreciate your help in advance – user50822 Apr 30 '14 at 19:45
  • @user50822: Well, there are incompatibilities with natbib, as stated in the manual also obtainable from http://www.ctan.org/pkg/authorindex, but it can be solved (see section 7.2.3 of authorindex.pdf) with a special natbib.cfg file and replacing \aicite with cite. Nevertheless, the perl script authorindex has to be used. –  May 01 '14 at 06:04
  • @user50822: Does it work now? –  May 02 '14 at 07:39