1

This is my code:

\documentclass[a4paper]{scrbook}
\usepackage{imakeidx}
\makeindex
\begin{document}
\renewcommand*\thepage{\thechapter---\arabic{page}}

text\index{test}

\printindex
\end{document}

This file has only two pages, and no index. When I comment out the line \renewcommand*\thepage{\thechapter---\arabic{page}}, the index is generated on the third page.

I followed the troubleshooting in, and took the MWE from, this question; and I took the modified page numbers from this one.

1

The default “page compositor” is a hyphen.

You can change it to --- by using a personal style. The simplest way is to generate an .ist file in the working directory.

\begin{filecontents*}{emdash.ist}
page_compositor "---"
\end{filecontents*}

\documentclass[a4paper]{scrbook}
\usepackage{imakeidx}

\makeindex[options=-s emdash]

\renewcommand*\thepage{\thechapter---\arabic{page}}

\begin{document}

\chapter{Title}

text\index{test}

\printindex

\end{document}

enter image description here

Source: http://texdoc.net/texmf-dist/doc/support/makeindex/ind.pdf

Available on your TeX Live system as texdoc ind.

Of course it's up to you to change the page number format before printing the index.

| improve this answer | |

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.