\documentclass{book}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage[gen]{eurosym}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{titleps}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\usepackage{float}
% use hidelinks to remove boxes around links to be similar to Texinfo TeX
\usepackage[hidelinks]{hyperref}

\makeatletter
\newcommand{\Texinfosettitle}{No Title}%

% no index headers
\indexsetup{level=\relax,toclevel=section}%
\makeindex[name=cp,title=]%
\makeindex[name=fn,title=]%

% redefine the \mainmatter command such that it does not clear page
% as if in double page
\renewcommand\mainmatter{\clearpage\@mainmattertrue\pagenumbering{arabic}}
\newenvironment{Texinfopreformatted}{%
  \par\GNUTobeylines\obeyspaces\frenchspacing\parskip=\z@\parindent=\z@}{}
{\catcode`\^^M=13 \gdef\GNUTobeylines{\catcode`\^^M=13 \def^^M{\null\par}}}
\newenvironment{Texinfoindented}{\begin{list}{}{}\item\relax}{\end{list}}

% used for substitutions in commands
\newcommand{\Texinfoplaceholder}[1]{}

\newpagestyle{single}{\sethead[\chaptername{} \thechapter{} \chaptertitle{}][][\thepage]
                              {\chaptername{} \thechapter{} \chaptertitle{}}{}{\thepage}}

% allow line breaking at underscore
\let\Texinfounderscore\_
\renewcommand{\_}{\Texinfounderscore\discretionary{}{}{}}
\renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}

\makeatother
% set default for @setchapternewpage
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{\Texinfoplaceholder{setchapternewpage placeholder}\clearpage}{}{}
\makeatother
\pagestyle{single}%


\begin{document}
\label{anchor:Top}%
\chapter{{Index}}
\label{anchor:chapter}%

\index[cp]{ä ö@"\""{a} "\""{o}}%
\index[cp]{AA@AA}%
\index[cp]{aa@aa}%
\index[cp]{i@i}%
\index[cp]{Z@Z}%
\index[cp]{î@\^{i}}%

\index[cp]{a"!"""@b """!"@ ä ö@$a"!"""@b$ """!"@ "\""{a} "\""{o}!a"!"""@b@sub$a"!"""@b$ sub """!"@ "\""{a} "\""{o}|seealso{$a!"@b$ "!@ \"{a} \"{o}}}%
\index[cp]{cmd@\textbackslash{}cmd}%
\index[cp]{\textbackslash{}cmd@totocmd}%


\index[cp]{\textbackslash{}some\textbackslash{}command for file@\textbackslash{}some\textbackslash{}command for \texttt{file}}%

\index[fn]{the person index aa@\texttt{the \textnormal{person}\ index \texttt{aa}}}%

\printindex[cp]

\printindex[fn]
\end{document}
