
Document Classes ⇒ makeindex making indexes in more than two columns?
makeindex making indexes in more than two columns?
When you use makeindex to make an index at the end of your document (via \printindex), it automatically makes a two-column index. -Is there any way to make this another number of columns, like only one, or three? 

Last edited by Bozack on Sat Jun 06, 2009 9:22 am, edited 1 time in total.
OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
makeindex making indexes in more than two columns?
You could try to use the multicol package and put the index into a multicols environment.
I don't know if it works, because I didn't test it.
Best regards
Thorsten¹
Code: Select all
\begin{multicols}{3}
\printindex
\end{multicols}
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
makeindex making indexes in more than two columns?
Nopes, it doesn't do the right thing.. It just ends up with sending the section-header to the end of the document and putting the columns in weird ways..:localghost wrote:You could try to use the multicol package
Code: Select all
\addcontentsline{toc}{section}{Indeks}
\begin{multicols}{3}
{\normalsize{ \printindex }}
\end{multicols}

There must be some problem with the multicols package coorporating with the makeindex package, since the makeindex normally makes two-column output?
OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
makeindex making indexes in more than two columns?
I remember a discussion we had a few days ago in our german forum about a very similar topic. Herbert Voss (the author and maintainer of many additional PSTricks package and "Math mode") offered a solution that also uses the multicol package. I hope he doesn't mind me providing this solution here.
Put this new definition of the theindex environment in your preamble. Don't ask me what this code exactly does. Beside usual LaTeX commands it uses some internal registers to get a proper formatting. According to some reports it works fine. Perhaps you can report here about success.
Code: Select all
\makeatletter
\renewenvironment{theindex}{%
\columnseprule \z@
\columnsep 35\p@
\idx@heading%
\index@preamble\par\nobreak
\thispagestyle{\indexpagestyle}\parindent\z@
\setlength{\parskip}{\z@ \@plus .3\p@}%
\setlength{\parfillskip}{\z@ \@plus 1fil}%
\begin{multicols}{2}%
\let\item\@idxitem
}{\end{multicols}\clearpage}
\makeatother
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
makeindex making indexes in more than two columns?
I just would like to remark that the solution provided by localghost will work with the Koma-script classes (scrartcl, scrbook...), not with the standard ones (article, book...) or with memoir. Bozack, if you are using the standard ones, ask again.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
makeindex making indexes in more than two columns?
Oh, that's something I didn't take into account. Perhaps it works when replacing \indexpagestyle (a macro from KOMA Script) by plain in the above given code.Juanjo wrote:I just would like to remark that the solution provided by localghost will work with the Koma-script classes (scrartcl, scrbook...), not with the standard ones (article, book...) or with memoir. [...]
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: makeindex making indexes in more than two columns?
Unfortunately I'm using the article class, so that won't be the solution..
I'll try later today after lectures anyway though
I'll try later today after lectures anyway though

OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit
makeindex making indexes in more than two columns?
The following code may work with the article class:
It will generate an index with three columns. Change the mandatory argument of the multicols environment to set a different number of columns. You may also want to reduce the space between columns: modify the value assigned to \columnsep. If you find that indentation of the index entries are too big, you may also want to adapt the lengths in the following lines which appear in article.cls:
Copy the corresponding line between \makeatletter and \makeatother, change the length and replace \newcommand by \renewcommand.
Code: Select all
\usepackage{multicol}
\makeatletter
\renewenvironment{theindex}
{\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\setlength{\columnseprule}{0pt}
\setlength{\columnsep}{35pt}
\begin{multicols}{3}[\section*{\indexname}]
\markboth{\MakeUppercase\indexname}%
{\MakeUppercase\indexname}%
\thispagestyle{plain}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt plus 0.3pt}
\relax
\let\item\@idxitem}%
{\end{multicols}\if@restonecol\onecolumn\else\clearpage\fi}
\makeatother
Code: Select all
\newcommand\@idxitem{\par\hangindent 40\p@}
\newcommand\subitem{\@idxitem \hspace*{20\p@}}
\newcommand\subsubitem{\@idxitem \hspace*{30\p@}}
\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
makeindex making indexes in more than two columns?
That turned out just as I was hoping for, thank you so muchJuanjo wrote:The following code may work with the article class

OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit
-
- Posts: 1
- Joined: Sat Jan 16, 2010 12:41 pm
makeindex making indexes in more than two columns?
Hey, this post above was a life-saver for me! I've registered just to reply!
I'm using book class, and only wanted two columns, so what I did was:
Furthermore, though I didn't need to adjust the spacing, I did want the top level entries to be in bold. For that I did this:
And to help people find this, allow me to put in some keywords for search engines: I was searching for ways to alter the display of the index in latex, or to make space above the index chapter head. Latex index is impossible to find. Let's get some Hits!
If anyone has the knowledge or the drive, I think that this could be built into a package to address a sore vacancy!
I'm using book class, and only wanted two columns, so what I did was:
Code: Select all
\usepackage{multicol}
\makeatletter
\renewenvironment{theindex}
{\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\setlength{\columnseprule}{0pt}
\setlength{\columnsep}{35pt}
\begin{multicols}{2}[\chapter*{\indexname}] %Adjust the 2 for more columns
\markboth{\MakeUppercase\indexname}%
{\MakeUppercase\indexname}%
\thispagestyle{plain}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt plus 0.3pt}
\relax
\let\item\@idxitem}%
{\end{multicols}\if@restonecol\onecolumn\else\clearpage\fi}
\makeatother
Code: Select all
\makeatletter
\renewcommand\@idxitem{\scriptsize\bfseries\par\hangindent 40\p@} %Makes all the index entries small, bold
\renewcommand\subitem{\scriptsize\@idxitem \normalfont\hspace*{20\p@}} %Makes subitems small, normal
\renewcommand\subsubitem{\scriptsize\@idxitem \normalfont\hspace*{30\p@}} %Makes subsubitems small, normal
\makeatother
If anyone has the knowledge or the drive, I think that this could be built into a package to address a sore vacancy!