
Document Classes ⇒ makeindex making indexes in more than two columns?
makeindex making indexes in more than two columns?

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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
makeindex making indexes in more than two columns?
Code: Select all
\begin{multicols}{3}
\printindex
\end{multicols}
Best regards
Thorsten¹
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?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
makeindex making indexes in more than two columns?
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
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
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?
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. [...]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: makeindex making indexes in more than two columns?
I'll try later today after lectures anyway though

makeindex making indexes in more than two columns?
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}
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

-
- Posts: 1
- Joined: Sat Jan 16, 2010 12:41 pm
makeindex making indexes in more than two columns?
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!