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 want the entries in the TOC for the indices to align with the Chapter entries. I can do this with \addcontents. \printindex also puts an entry in the TOC but it is aligned with the section entries.

So I want to:

  1. change how printindex makes its entry into the TOC or
  2. to eliminate printindex entry.

MWE:

\documentclass{book}
\usepackage{multind}        % create the indices
\makeindex{names}           
\makeindex{subject}
\newcommand{\Ndx}[1] { \index{names}{#1} }     % define the type of entry
\newcommand{\Sdx}[1] { \index{subject}{#1} }   % to the indices
\usepackage[headings]{fullpage}         % 8-1/2, 11 page with 1" margins
\usepackage{fancyhdr}
\pagestyle{fancy}
\begin{document}
\fancyhead{}
\fancyfoot{}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhead[LE,RO]{\rightmark}
\fancyhead[RE,LO]{\thepage}
\tableofcontents        % put table of contents here

\chapter{\bf Logic, Plausibility, and Probability}
\label{Ch:Logic}
\section{Logical Arguments and Reasoning }
It is obvious that logical arguments are essential to the judicial system. The logic must be able to treat syllogisms\Sdx{syllogism} that range from deductive\Sdx{syllogism!deductive} to abductive\Sdx{syllogism!abductive}, that is from strong to weak syllogisms \Sdx{syllogism!weak}\Sdx{syllogism!strong} as illustrated in the table taken from Author \Ndx{Author}
\Ndx{Cohen}
\Sdx{Cohen on probability}
\clearpage
\addcontentsline{toc}{chapter}{Subject Index}
\printindex{subject}{Subject Index}
\addcontentsline{toc}{chapter}{Name Index}
\printindex{names}{Name Index}
\end{document}
share|improve this question

2 Answers 2

You can patch \printindex so the entries are typeset as chapter entries instead of the default (as secion entries):

\documentclass{book}
\usepackage{multind}  
\usepackage{etoolbox}  

\patchcmd{\printindex}
  {section}
  {chapter}
  {}
  {}
      % create the indices
\makeindex{names}           
\makeindex{subject}
\newcommand{\Ndx}[1] { \index{names}{#1} }     % define the type of entry
\newcommand{\Sdx}[1] { \index{subject}{#1} }   % to the indices
\usepackage[headings]{fullpage}         % 8-1/2, 11 page with 1" margins
\usepackage{fancyhdr}
\pagestyle{fancy}
\begin{document}
\fancyhead{}
\fancyfoot{}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhead[LE,RO]{\rightmark}
\fancyhead[RE,LO]{\thepage}
\tableofcontents        % put table of contents here

\chapter{\bf Logic, Plausibility, and Probability}
\label{Ch:Logic}
\section{Logical Arguments and Reasoning }
It is obvious that logical arguments are essential to the judicial system. The logic must be able to treat syllogisms\Sdx{syllogism} that range from deductive\Sdx{syllogism!deductive} to abductive\Sdx{syllogism!abductive}, that is from strong to weak syllogisms \Sdx{syllogism!weak}\Sdx{syllogism!strong} as illustrated in the table taken from Author \Ndx{Author}
\Ndx{Cohen}
\Sdx{Cohen on probability}
\clearpage
\printindex{subject}{Subject Index}
\printindex{names}{Name Index}
\end{document}

enter image description here

By the way, \bf is an old TeX command which shouldn't be used anymore in modern LaTeX documents; use \bfseries instead. Additionally, using \bf (or \bfseries) inside the argument for \chapter makes no difference since in the book class chapter headings are already boldfaced; to change the formatting for sectional unit headings, you can use a dedicated package such as sectsty or titlesec.

Using the imakeidx package, there's no need to patch commands:

\documentclass{book}
\usepackage{imakeidx}  

\makeindex[name=names,title=Name Index,intoc=true]          
\makeindex[name=subject,title=Subject Index,intoc=true]

\begin{document}

\tableofcontents

\chapter{Logic, Plausibility, and Probability}
\section{Logical Arguments and Reasoning }

\index[names]{Cohen}
\index[subject]{Cohen on probability}
\printindex[subject]
\printindex[names]

\end{document}

enter image description here

share|improve this answer
    
Or use imakeidx, of course. –  egreg Feb 28 at 23:38
    
@egreg I'll add an option with imakeidx to my answer in some minutes (unless you're planning to write an answer yourself) :-) –  Gonzalo Medina Feb 28 at 23:39
    
@GonzaloMedina Please, go forth. –  egreg Feb 28 at 23:40
    
@egreg option added. –  Gonzalo Medina Feb 28 at 23:53
    
@lockstep yes, I was just editing to delete that line. –  Gonzalo Medina Feb 28 at 23:55

In case the etoolbox package isn't available to you, or this is the only reason you're loading the package, you can actually get away without it.

The relevant part of the code from mutlind.sty can be modified to

\makeatletter
\def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
  \columnseprule \z@ \columnsep 35pt
  \newpage \twocolumn[{\Large\bf #2 \vskip4ex}]
  \markright{\uppercase{#2}}
  \addcontentsline{toc}{chapter}{#2}%   <---- NEW BIT
  \@input{#1.ind}}

All you have to do is change section to chapter.

Here's a complete MWE to play with- note that I have included the arara directives so that you simply have to run

arara myfile

and you'll get a complete pdf.

% arara: pdflatex
% arara: makeindex: {files: [names]}
% arara: makeindex: {files: [subject]}
% arara: pdflatex
% arara: pdflatex
\documentclass{book}
\usepackage{multind}        % create the indices
\makeindex{names}           
\makeindex{subject}
\newcommand{\Ndx}[1] { \index{names}{#1} }     % define the type of entry
\newcommand{\Sdx}[1] { \index{subject}{#1} }   % to the indices

\makeatletter
\def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
  \columnseprule \z@ \columnsep 35pt
  \newpage \twocolumn[{\Large\bf #2 \vskip4ex}]
  \markright{\uppercase{#2}}
  \addcontentsline{toc}{chapter}{#2}
  \@input{#1.ind}}

\begin{document}
\tableofcontents        % put table of contents here

\chapter{Logic, Plausibility, and Probability}\label{Ch:Logic}
\section{Logical Arguments and Reasoning }
It is obvious that logical arguments are essential to the judicial system. The logic must be able to treat syllogisms\Sdx{syllogism} that range from deductive\Sdx{syllogism!deductive} to abductive\Sdx{syllogism!abductive}, that is from strong to weak syllogisms \Sdx{syllogism!weak}\Sdx{syllogism!strong} as illustrated in the table taken from Author \Ndx{Author}
\Ndx{Cohen}
\Sdx{Cohen on probability}
\clearpage
\printindex{subject}{Subject Index}
\printindex{names}{Name Index}
\end{document}
share|improve this answer
    
The worst part about multind is not the fixed ToC entry, but the formatting of the index heading itself. –  lockstep Mar 1 at 0:03
    
I use PcTex6 and imakeidx and etools are incompatible in that they abort since they are not running under e-tex. The change to multind did exactly what I wanted. –  ashley Mar 1 at 0:23

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.