Document Classes ⇒ makeindex making indexes in more than two columns?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
makeindex making indexes in more than two columns?
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
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
makeindex making indexes in more than two columns?
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