在同一页的 1 列文档中创建 2 列索引

在同一页的 1 列文档中创建 2 列索引

我有一份文档,我使用这个makeidx包来创建索引。我需要做的是将索引设为 2 列,而我的文档为 1 列,并将其与参考书目放在同一页上。

如何制作没有分页符的索引,我发现这个问题但没有关于如何在 1 列文档中使其成为 2 列的内容。

另外,我想确保索引中的所有条目始终在左列和右列之间分成两半,以尽可能减少占用的空间。

\documentclass[a4paper, slovak, twwoside]{article}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[letterpaper, portrait, margin=3cm]{geometry}

% Index
\usepackage{makeidx}
\makeindex

% Redefine theindex enviroment so it won't place index on new page
% This also makes the index 1 columns, which I don't want
\makeatletter
\renewenvironment{theindex}
               {\section*{\indexname}%
                \@mkboth{\MakeUppercase\indexname}%
                        {\MakeUppercase\indexname}%
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \columnseprule \z@
                \columnsep 35\p@
                \let\item\@idxitem}
               {}
\makeatother

\begin{document}
Some one\index{one} column\index{column} block\index{block} of text...

% 2 column index on the same page
\printindex

One column bibliography...
\end{document}

因此从这个例子中,我想在和同一页面上获得 2 行、2 列的Some text...索引One column bibliography...

统一行距: 在此处输入图片描述

答案1

尝试以下建议:

\documentclass[a4paper, slovak, twwoside]{article}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[letterpaper, portrait, margin=3cm]{geometry}

% Index
\usepackage{multicol,makeidx}
\makeindex

% Redefine theindex enviroment so it won't place index on new page
% This also makes the index 1 columns, which I don't want
\makeatletter
\renewenvironment{theindex}
               {\section*{\indexname}\begin{multicols}{2}%
                \@mkboth{\MakeUppercase\indexname}%
                        {\MakeUppercase\indexname}%
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \columnseprule \z@
                \columnsep 35\p@
                \let\item\@idxitem}
               {\end{multicols}}
\makeatother

\begin{document}
Some one\index{one} column\index{column} block\index{block} of
text...

% 2 column index on the same page
\printindex

One column bibliography...
\end{document}

相关内容