缩进并自定义 \printidex

缩进并自定义 \printidex
\newenvironment{theindex}{}{}
\usepackage{imakeidx}

\renewenvironment{theindex}{%
    \let\item\par  % definitions for subitem etc
    \let\subitem\par
    \let\subsubitem\par
}
\makeatletter
\def\@idxitem{\par}

\def\imki@firstpagestyle{empty}
\makeatother
\newcommand\indexspace{}
\makeindex

我需要在幻灯片左侧和子项之间进行缩进,并对子子项进行缩进,例如:

algorithm - item
   search - subitem
      depth first , -subsubitem
      breadth fist), -subsubitem

我需要做的是,子项和子子项不要进入新框架,例如新框架以项目开始

例子:

\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{imakeidx}
\renewenvironment{theindex}{%
    \let\item\par   % definitions for subitem etc
    \let\subitem\par
    \let\subsubitem\par
}
\makeatletter
\def\@idxitem{\par}

\def\imki@firstpagestyle{empty}
\makeatother
\newcommand\indexspace{}
\makeindex

\begin{document} 
\begin{frame}
\index{apple}
\end{frame}
\begin{frame}
\index{Algorithm}
\end{frame}
\begin{frame}[allowframebreaks]
\frametitle{\indexname}
\let\clearpage\relax % avoid empty frames
\printindex
\end{frame}
\end{document}

请帮忙

答案1

正确定义\subitem\subsubitem

请仔细检查我所做的更改。

  1. utf8x不推荐;使用utf8(或者,如果您使用最新的 TeX 发行版,则根本不要使用)。
  2. latexsym软件包仅用于向后兼容
  3. 无需加载epstopdf
  4. 你错过{}\renewenvironment{theindex}
\documentclass[mathserif,12pt,aspectratio=169]{beamer}
\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage[scaled=0.95]{PTSans}
\usepackage{graphicx}
%\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{amssymb,amsthm}

\usepackage{multicol}

\newenvironment{theindex}{}{}
\usepackage{imakeidx}
\renewenvironment{theindex}{%
  \setlength{\parindent}{0pt}%
  \let\item\par   % definitions for subitem etc
  \def\subitem{\par\nobreak\hspace*{2em}\ignorespaces}%
  \def\subsubitem{\par\nobreak\hspace*{4em}\ignorespaces}%
  \def\indexspace{}%
}{}
\makeindex

\begin{document} 

\begin{frame}
\index{apple}\index{apple!a}\index{apple!a!b}
\index{Algorithm}\index{Algorithm!a}\index{Algorithm!a!b}
\index{aa}\index{aaa}\index{aaaa}\index{aaaaa}\index{aaaaaa}
\index{aaaaaaa}\index{aaaaaaaa}\index{aaaaaaaaa}
\index{aaaaaaaaaa}\index{aaaaaaaaaaa}
\end{frame}

\begin{frame}[allowframebreaks]
\frametitle{\indexname}
\let\clearpage\relax % avoid empty frames
\printindex
\end{frame}
\end{document}

在此处输入图片描述

相关内容