打印索引和对齐索引的名称

打印索引和对齐索引的名称

我在 beamer 中有索引列表,但幻灯片名称前没有缩进。当我输入 \hspace 时,它​​会进行非常大的缩进。

    \usepackage{multicol}
\newenvironment{theindex}{}{}
\usepackage[xindy]{imakeidx}

\renewenvironment{theindex}{%

    \setlength{\parindent}{0pt}%
    {{{\hspace{+4pt}\begin{center}\color{blue}\large{\indexname}\end{center}}}}
    \let\item\par   % definitions for subitem etc
    \def\subitem{\par\nobreak\hspace*{1em}\ignorespaces}%
    \def\subsubitem{\par\nobreak\hspace*{2em}\ignorespaces}%
    \def\indexspace{}%
    \begin{multicols}{2}
    }{\end{multicols}   }
\makeindex[options=-L russian -C utf8]

我需要正确执行子项。就像这样

在此处输入图片描述

但我有这个

在此处输入图片描述

请帮忙。

例子 :

\documentclass[mathserif,12pt,aspectratio=169]{beamer}


\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[scaled=0.95]{PTSans}
\usepackage{graphicx}
%\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{epstopdf}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{latexsym,amssymb,amsthm}




\usepackage{multicol}
    \newenvironment{theindex}{}{}
    \usepackage[xindy]{imakeidx}

    \renewenvironment{theindex}{%

        \setlength{\parindent}{0pt}%
        {{{\hspace{+4pt}\begin{center}\color{blue}\large{\indexname}\end{center}}}}
        \let\item\par   % definitions for subitem etc
        \def\subitem{\par\nobreak\hspace*{1em}\ignorespaces}%
        \def\subsubitem{\par\nobreak\hspace*{2em}\ignorespaces}%
        \def\indexspace{}%
        \begin{multicols}{2}
        }{\end{multicols}   }
    \makeindex[options=-L russian -C utf8]

\begin{document} 
\begin{frame}
\index{apple}
\end{frame}
\begin{frame}
\index{Algorithm}
\end{frame}
\printindex
\end{document}

答案1

\documentclass[mathserif,12pt,aspectratio=169]{beamer}
\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage[scaled=0.95]{PTSans}
\usepackage{graphicx}
%\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{epstopdf}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{latexsym,amssymb,amsthm}

\newenvironment{theindex}{}{}
\usepackage{multicol}
\usepackage[xindy]{imakeidx}

\renewenvironment{theindex}
{\vspace*{-15pt}\begin{center}\Large Index\end{center}%
 \def\item{\par\hangindent 10pt\parindent0pt}%
  \begin{multicols}{2}
}{\end{multicols}}
\newcommand\subitem{\par\hangindent10pt\parindent10pt}
\newcommand\subsubitem{\par\hangindent20pt\parindent20pt}
\def\indexspace{}%

\makeindex[options=-L russian -C utf8]

\begin{document} 
\begin{frame}
\index{apple}\index{ABC}\index{ABC!abc!123}
foo\index{Algorithm}
\index{apple!Algorithm!This text as subsubitem which is very very long}
\index{apple!Algorithm as subitem}

\end{frame}
\begin{frame}
\index{apple!Algorithm as subitem which is very very very extraordinary long}
foo
\index{short}\index{long}\index{very!long!As subsubitem this is a very very long subindex entry of long}
bar
\end{frame}
\printindex
\end{document}

在此处输入图片描述

相关内容