0
\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

I need to do indents between left side of slide and subitems ,and do it with subsubitems,like :

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

And I need to do that subitem and subsubitem don`t go to the new frame, e.g. New frame begin by the item

Example:

\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}

Please help

1

Define properly \subitem and \subsubitem.

Please, also check carefully the changes I made.

  1. utf8x is not recommended; use utf8 (or nothing at all if you use a recent TeX distribution).
  2. the latexsym package exists only for back compatibility
  3. there's no need to load epstopdf
  4. you miss {} at the end of \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}

enter image description here

  • Thanks very much , but when I use \nobreak \printindex doesn`t show some indexes ,for example when I have \item and many \subitems ,it will be the last frame when I use \nobreak ,what can I do with it ? – re1nex Apr 15 at 16:06
  • @re1nex If you have too many subitems, they can't go in one frame, can they? – egreg Apr 15 at 16:11
  • and early I do two cols like \renewenvironment{theindex}{% \let\item\par % definitions for subitem etc \let\subitem\par \let\subsubitem\par \begin{multicols}{2} }{\end{multicols}} \makeatletter ,how can I do it now ? – re1nex Apr 15 at 16:11
  • No , they can`t,I think maybe do two cols for they – re1nex Apr 15 at 16:12
  • What do \setlength{\parindent}{0pt}% ? – re1nex Apr 15 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.