1

This is a bit of a contrived example, as the real one depends on specific fonts I can't post here. MWE:

\documentclass{scrbook}
\usepackage{makeidx}
\usepackage[unbalanced,columns=3,justific=RaggedRight,columnsep=70pt]{idxlayout}
\usepackage[colorlinks=true]{hyperref}
\makeindex
\begin{document}
text\index{this-should-break}
\index{thisss-should-break}
\index{this-one-does-break}
\printindex
\end{document}

Output:

enter image description here

I'd like:

enter image description here

IDX-File:

\indexentry{this-should-break|hyperpage}{1}
\indexentry{thisss-should-break|hyperpage}{1}
\indexentry{this-one-does-break|hyperpage}{1}

IND-File:

\begin{theindex}

  \item this-one-does-break, \hyperpage{1}
  \item this-should-break, \hyperpage{1}
  \item thisss-should-break, \hyperpage{1}

\end{theindex}

I'd like to avoid the line break before the page number for the second entry. I don't know if that's possible at all. I assume I'm looking for a solution that produces something like \item this-should-break,~\hyperpage{1}, but then again, \hyperpage might internally do something to still make it break.

EDIT

As I now not only found a regular but also a xindy solution, I retagged this accordingly.

1

Seems it's actually pretty easy to achieve, if you know how. The key points are:

  • usage of package imakeidx instead of makeidx
  • creation of a style file that redefines delim_0

test.ist:

delim_0 ",~"

test.tex:

\documentclass{scrbook}
\usepackage{imakeidx}
\usepackage[unbalanced,columns=3,justific=RaggedRight,columnsep=70pt]{idxlayout}
\usepackage[colorlinks=true]{hyperref}
\makeindex[options=-s test.ist]
\begin{document}
text\index{this-should-break}
\index{thisss-should-break}
\index{this-one-does-break}
\printindex
\end{document}

Resulting ind-File:

\begin{theindex}

  \item this-one-does-break,~\hyperpage{1}
  \item this-should-break,~\hyperpage{1}
  \item thisss-should-break,~\hyperpage{1}

\end{theindex}

Output:

enter image description here

Here's how to do it for xindy:

\documentclass{scrbook}
\usepackage[xindy]{imakeidx}
\usepackage[unbalanced,columns=3,justific=RaggedRight,columnsep=70pt]{idxlayout}
\usepackage[colorlinks=true]{hyperref}
\makeindex[options=-M test.xdy]
\begin{document}
text\index{this-should-break}
\index{thisss-should-break}
\index{this-one-does-break}
\printindex
\end{document}

test.xdy:

(markup-locclass-list :open ",~~")

Output:

enter image description here

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.