The correct way is indeed to use index=totoc, but why? Let's take a look at the internals.
Flowing down the levels of implementation
How is theindex environment defined in book and scrbook?
book.cls
\newenvironment{theindex}
{\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\twocolumn[\@makeschapterhead{\indexname}]%
\@mkboth{\MakeUppercase\indexname}%
{\MakeUppercase\indexname}%
\thispagestyle{plain}\parindent\z@
\parskip\z@ \@plus .3\p@\relax
\columnseprule \z@
\columnsep 35\p@
\let\item\@idxitem}
{\if@restonecol\onecolumn\else\clearpage\fi}
scrbook.cls
\newenvironment{theindex}{%
\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\columnseprule \z@
\columnsep 35\p@
\setchapterpreamble{\index@preamble}%
\idx@heading%
\thispagestyle{\indexpagestyle}\parindent\z@
\setlength{\parskip}{\z@ \@plus .3\p@}%
\setlength{\parfillskip}{\z@ \@plus 1fil}%
\let\item\@idxitem
}{%
\if@restonecol\onecolumn\else\clearpage\fi
}
As you can see, both do basically the same. Checking for
one/two-columnmode, setting the headers, changing the parskip and
-indent. What standard book does was explained by Heiko before:
[It] suffers from a side effect of the optional argument of
\twocolumn. The title in the optional argument is put at the top
of page in one-column mode, but the current contents of the page
(anchor setting) is stalled and is added after the title in
two-column mode.
KOMA on the other hand does \idx@heading which is defined as:
\if@openright\cleardoublepage\else\clearpage\fi%
\twocolumn[%
\@chaptertolistsfalse
\idx@@heading{\indexname}]%
\@mkboth{\MakeMarkcase{\indexname}}{\MakeMarkcase{\indexname}}%
It does the usual check and issues either one page or a double
page. It uses \twocolumn with the optional argument as the
standard class does and sets the headers. \@chaptertolostsfalse
prevents the chapter heading from going to the list of figures
and list of tables. The next line leads us to this code
\KOMA@key{index}{%
\KOMA@set@ncmdkey{index}{@tempa}{%
{notoc}{0},{nottotoc}{0},{default}{0},{plainheading}{0},%
{totoc}{1},{toc}{1},{notnumbered}{1}%
}{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\ifcase \@tempa\relax
\renewcommand*{\idx@@heading}{%
\chapter*
}%
\or
\renewcommand*{\idx@@heading}{%
\addchap
}%
\fi
\fi
}
If no value was given to index, scrbook uses \chapter* just
like the standard book (and also if notoc and similar values
were given). If you explicitely decided that the index should go
to the toc, addchap is used. addchap calls \@addchap which
calls \addchaptertocentry calling addtocentrydefault
calling tocbasic@addxcontentsline which finally calls the
ususal \addcontentsline in tocbasic.sty. All this still
happens within the optional argument of twocolumn.
As you can see, Markus Kohm accounted for nearly every possible
situation. Everything is designed in a way, that one change leads
to a constant change in the whole document. All mechanisms are
shared by the commands.
To sum it up, having a look into the KOMA-script documentation once
in a while can save you some trouble searching for a hack.
\documentclass[oneside
,index=totoc
]{scrbook}
\usepackage{makeidx}
\usepackage{hyperref}
\makeindex
\newcommand{\nist}{%
NIST%
\index{National Institute of Standards and
Technology}
}
\begin{document}
\tableofcontents
\chapter{Introduction}
Lorem ipsum \nist.
%\cleardoublepage
%\phantomsection
%\addcontentsline{toc}{chapter}{\indexname}
\printindex
\end{document}
index=totoc. This option (global) should replace those three helper lines (clearpage, phantomsection, toc-line). – Johannes_B Oct 22 '14 at 16:47phantomsectionis treated like the first content in the environment (after the heading). – Johannes_B Oct 22 '14 at 16:56addchapfor the index heading. Usually a good idea to useaddchapfor unnumbered stuff that shall appear in the TOC. – Johannes_B Oct 22 '14 at 16:59