如何在回忆录类中获取三列索引?

如何在回忆录类中获取三列索引?

我的 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}

相关内容