1

In my book I have a page with index. The content of it exceeds one page only with two items, so I would like to decrease some vertical spaces on this page to hold the whole index on this page.

By default the layout of the first index page is set with \indexsetup{level=\chapter*}, and then the index looks as follows:

When I change the index layout with \indexsetup{level=\section*} then all index records fall into a single page (what I want), but the title word "Index" is too small:

I tried to find the solution in idxlayout package manual - without any effect. I found something that seems to be connected with the problem, but I don't know how to use it: \renewcommand*{\indexstheadcase}{\Huge} (?). A bit similar question is here (without answer).

My code:

\documentclass{book}
\usepackage[
paperwidth=8cm,paperheight=8cm,
top=10mm,bottom=10mm,left=10mm,right=10mm,
headsep=3mm,footskip=6mm
]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{imakeidx}

% header and footer contetnt adjustment
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}    % page header emptying
\renewcommand{\headrulewidth}{0pt}

% title page layout adjustment
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-5pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{15pt}{\Huge}

\indexsetup{level=\section*}
\makeindex[columnsep=8mm]

\begin{document}

\tableofcontents

\chapter{Introduction}
The Roadrunner\index{Roadrunner} run on long distances.
The Coyotewill\index{Coyote} has lower continuous po\-wer.

Cookiemonster\index{Cookiemonster} can eat safe.

AAA\index{AAA} aaa\index{aaa} BBB\index{BBB} bbb\index{bbb}.

CCC\index{CCC} ccc\index{ccc} DDD\index{DDD} ddd\index{ddd}.
\clearpage

\chapter{Some section}
This is an exemplary text\index{text}
which serves to demonstration the problem with index layout\index{index}.

More text on the page\index{page}.

\printindex
\end{document}
  • 1
    Change \titlespacing for \chapter just before \printindex. – egreg Mar 21 '17 at 16:05
  • @egreg Thx. That solves my problem at all. But I wonder how to manage with the similar problem it which are few indexes along the book (not only on the last page)... – forrest Mar 21 '17 at 16:19
  • 1
    I see no reason for changing the chapter style. Anyway, what does prevent you from restoring the spacing afterwards? – egreg Mar 21 '17 at 16:21
  • @egreg OK. Thx. Your answer is very helpful for me. I understand... – forrest Mar 21 '17 at 16:24
1

I see no reason for changing the chapter style.

Anyway, you can change \titlespacing before \printindex and if necessary, restore it afterwards.

You can of course define a wrapper command:

\newcommand{\myprintindex}[1][]{%
  % change the spacing
  \titlespacing*{\chapter}{0pt}{-25pt}{10pt}% <-- adjust here
  \if\relax\detokenize{#1}\relax
    \printindex
  \else
    \printindex[#1]%
  \fi
  % restore
  \titlespacing*{\chapter}{0pt}{-5pt}{20pt}%
}
|improve this answer|||||
  • Thx. In MWE it works very well ...but now I am looking for a reason why it doesn't affect the index page layout in the book I am working with... – forrest Mar 21 '17 at 16:45
  • How to manage with the problem in which my code have commented the line with the \titleformat command? – forrest Mar 23 '17 at 9:23
  • @forrest Sorry, but I can't see your code. – egreg Mar 23 '17 at 9:26
  • I thought about the code which I put in my question. Why putting % before \titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{15pt}{\Huge} causes that method doesn't work? – forrest Mar 23 '17 at 12:21
  • 1
    If you don't use \titleformat, then titlesec does nothing to chapters – egreg Mar 23 '17 at 17:46

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.