![如何在回忆录类中获取三列索引?](https://linux22.com/image/436861/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%9B%9E%E5%BF%86%E5%BD%95%E7%B1%BB%E4%B8%AD%E8%8E%B7%E5%8F%96%E4%B8%89%E5%88%97%E7%B4%A2%E5%BC%95%EF%BC%9F.png)
我的 MWE 太长了,但这是我多次尝试中的一次,但都没有成功。
\documentclass{memoir}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% try for 3 column index
\newif\ifthreecolindex
\newcommand{\threecolindex}{\threecolindextrue}
\usepackage{multicol}
\makeatletter
\renewenvironment{theindex}{%
\clearforchapter
\ifthreecolindex
\begin{multicols}{3}
% starting multocols 3
%
% threecolindex
\else
\ifonecolindex
\onecolumn
onecolindex
\else
\setlength{\columnseprule}{indexrule}%
\setlength{columnsep}{\indexcolsep}
\twocolumn{\@makeschapterhead{\indexname}
\preindexhook}%
.........
\threecolindex
\printindex
\end{document}
我认为最好将我的 GOM(脾气暴躁的老头)签名改为 GSIOM(脾气暴躁的半无能的老头)。
任何帮助都将不胜感激,谁知道呢,memoir
维护者(daleif)甚至可能将其添加到memoir
类别中,但不要抱太大希望。
国立卫生研究院
答案1
除非我遗漏了什么,否则这似乎很好用
\documentclass{memoir}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% try for 3 column index
\newif\ifthreecolindex
\newcommand{\threecolindex}{\threecolindextrue}
\usepackage{multicol}
\makeatletter
\renewenvironment{theindex}{%
\clearforchapter
\ifthreecolindex
\chapter*{\indexname}
\preindexhook
\else
\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\ifonecolindex
\onecolumn
\chapter*{\indexname}
\preindexhook
\else
\setlength{\columnseprule}{\indexrule}%
\setlength{\columnsep}{\indexcolsep}%
\twocolumn[\@makeschapterhead{\indexname}
\preindexhook]%
\fi
\fi
\indexmark
\ifnoindexintoc\else
\phantomsection
\addcontentsline{toc}{chapter}{\indexname}%
\fi
\ifthreecolindex
\begin{multicols}{3}
\fi
\thispagestyle{indextitlepagestyle}\parindent\z@
\parskip\z@ \@plus .3\p@\relax
\let\item\@idxitem}%
{
\ifthreecolindex
\end{multicols}
\else
\if@restonecol\onecolumn\else\twocolumn\fi
\fi
}
\makeatother
\makeindex
\begin{document}
test\index{A}\index{B}\index{C}
\threecolindex
\printindex
\end{document}