Document Classesmakeindex making indexes in more than two columns?

Information and discussion about specific document classes and how to create your own document classes.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

makeindex making indexes in more than two columns?

Post by localghost »

In the meantime the new package idxlayout has been released. It simplifies the format setup of the index.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

swiper
Posts: 4
Joined: Thu Apr 22, 2010 11:48 pm

makeindex making indexes in more than two columns?

Post by swiper »

I too made an account so I could respond to this post and hopefully help out the next chap that comes along.
I altered the code slightly for my use.
I wanted the Index to show up in my table of contents using the article document type.
Using \section*{} prevents the table of contents from showing the listing and \section{} produces an unwanted preceding number in the table of contents.
To show the index without a number in the table of contents and produce a bookmark in the correct location I altered the \begin{multicols} line of code to include phantomsection and addcontentsline.

Altered code:

Code: Select all

\usepackage{multicol}
\makeatletter
\renewenvironment{theindex}
  {\if@twocolumn
      \@restonecolfalse
   \else
      \@restonecoltrue
   \fi
   \newpage
   \setlength{\columnseprule}{0pt}
   \setlength{\columnsep}{35pt}
   \begin{multicols}{3}[\phantomsection\addcontentsline{toc}{section}{\indexname}\section*{\indexname}]
   \markboth{\MakeUppercase\indexname}%
            {\MakeUppercase\indexname}%
%   \thispagestyle{plain}  % I don't want the first page of the index to be plain
   \setlength{\parindent}{0pt}
   \setlength{\parskip}{0pt plus 0.3pt}
   \relax
   \let\item\@idxitem}%
  {\end{multicols}\if@restonecol\onecolumn\else\clearpage\fi}
\makeatother
Thanks for the help and I hope this is useful to someone.
Post Reply