0

enter image description here

My index jumps to the top of the page. I am currently using the following code.

\documentclass[a4paper,11.5pt,twoside, openleft]{book}
\usepackage{titlesec} 
\usepackage{imakeidx}
\usepackage{xcolor}
\newcommand{\boldindex}[1]{\textcolor{DarkPurple}{\textbf{#1}}\nouppercase{\index{#1}}}
\makeindex[intoc] 

\titleformat{\chapter}[display]{}{}{-2pt}{\hskip5.5cm\centering\Huge \bfseries \mbox}
\titlespacing{\chapter}{0pt}{-120pt}{27pt}

\definecolor{DarkPurple}{RGB}{63, 22, 59}

\begin{document}
\renewcommand\indexname{Begrippen Index}

\boldindex{Test}\\
\boldindex{tEst}\\
\boldindex{teSt}\\
\boldindex{tesT}

\printindex
\end{document}

Does anybody know how to fix this problem?

3
  • 1
    Please, make a compilable example that shows the issue.
    – egreg
    Jul 1 at 17:10
  • @egreg I've updated the code
    – superHenry
    Jul 1 at 18:43
  • 1
    ! Undefined control sequence. \boldindex ...rkPurple}{\textbf {#1}}\nouppercase Jul 1 at 19:14
0

Your posted code produces nurelated errors but in the book class the index heading is essentially set as

                \twocolumn[\@makeschapterhead{\indexname}]

so this forces a new page does a \chapter* style heading and then sets the index in two column. This is by design but you can define the theindex command in whatever way you want. Also imakeindex package forces a new page unless you use [nonewpage]

enter image description here

%\documentclass[a4paper,11.5pt,twoside, openleft]{book}
% there is no 11.5 or openleft option
\documentclass[a4paper,11pt,twoside, openany]{book}
\usepackage{titlesec} 
\usepackage[nonewpage]{imakeidx}
\usepackage{xcolor}
\newcommand{\boldindex}[1]{\textcolor{DarkPurple}{\textbf{#1}}{\index{#1}}}
\makeindex[intoc] 

\titleformat{\chapter}[display]{}{}{-2pt}{\hskip5.5cm\centering\Huge \bfseries \mbox}
\titlespacing{\chapter}{0pt}{-120pt}{27pt}

\makeatletter
\renewenvironment{theindex}
{\section*{index}%
\let\item\@idxitem}
{}
\makeatother

\definecolor{DarkPurple}{RGB}{63, 22, 59}

\begin{document}
\renewcommand\indexname{Begrippen Index}

\boldindex{Test}\\
\boldindex{tEst}\\
\boldindex{teSt}\\
\boldindex{tesT}

\printindex
\end{document}
4
  • it works, but the \renewcommand\indexname{Begrippen Index} does not work.
    – superHenry
    Jul 1 at 19:54
  • oh change \section*{index}%to \section*{\indexname}% @superHenry Jul 1 at 20:16
  • Is there a way to have a two row index? Just like in my first picture?
    – superHenry
    Jul 2 at 9:29
  • @superHenry switching to two column implies a page break and you asked for the page break to be removed. (but you could load multicol and have \begin{multicols}{2} and \end{multicols} in thet environment definition Jul 2 at 9:59
0

The problem was solved adding \titleformat{name=\chapter, numberless}[block]{}{}{0pt}{\filright \Huge \bfseries}[\vskip4.5pt] to the code.

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.