0

I am using makeidx package, when use \printindex command, it will be start in new page,

Is there one way to let "Index" name as chapter style, just like "Chapter 1 Index".

I want to change the index definition, but I can't find it.

Is there anybody could help me.

\documentclass[]{book}

\usepackage{makeidx} 
\makeindex


\begin{document}

test test test test\index{AAA} test test test test\index{BBB} test test test test test\index{CCC} test test test test test test test test test test test test test test test test test test test\index{DDD} test test test test test test 


\printindex

\end{document}
2

Solution 1:

\documentclass[]{book}

\usepackage{makeidx} 
\makeindex
\renewcommand{\indexname}{\chaptername\ \thechapter\ Index}


\begin{document}

\chapter{First}
test test test test\index{AAA} test test test test\index{BBB} test test test test test\index{CCC} test test test test test test test test test test test test test test test test test test test\index{DDD} test test test test test test 

\stepcounter{chapter}
\printindex

\end{document}

Produces:enter image description here

Solution 2

(with redefinition of index environment):

\documentclass[openany]{book}
\usepackage{makeidx}

\makeatletter
\renewenvironment{theindex}
               {\if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                %\twocolumn[\@makeschapterhead{\indexname}]%NO PAGEBREAK BEFORE INDEX
                \@mkboth{\MakeUppercase\indexname}%
                        {\MakeUppercase\indexname}%
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \columnseprule \z@
                \columnsep 35\p@
                \let\item\@idxitem}
                %{\if@restonecol\onecolumn\else\clearpage\fi} %NO CLEARPAGE AFTER INDEX
\makeatother

\makeindex

\begin{document}

\chapter{First Chapter}
A\index{A}B\index{B}

\chapter{Index}
\printindex

\chapter{Other chapter}

\end{document}

Produces:

enter image description here

  • Thanks, but I want to add chapter number as normal chapter. Do you have any method? – zongxian Aug 23 '18 at 4:42
  • Can you provide an example of how the ouput shall look like? – andc Aug 23 '18 at 4:49
  • The normal chapter is “chapter 1 title”, so I want to index title will be just like it “chapter 2 Index”. – zongxian Aug 23 '18 at 4:52
  • I have checked the book.cls and want to find the definition of index environment, but I don’t know how to change the definition. – zongxian Aug 23 '18 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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