1

I get an unwanted space after every index keyword when using the manyind package.

I don't understand what am I doing wrong since when I try to compile the manyind documentation, the index turns out fine.

MWE (replace manyind by makeidx to see propper behaviour):

\documentclass{book}
\usepackage{lipsum}

\usepackage{manyind}
%\usepackage{makeidx}
\makeindex

\begin{document}
\lipsum[1]\index{abc}
\printindex
\end{document}

See the extra space after the term abc, before comma below.

current behaviour

4
  • I can confirm this -- the white space is within \indexentry of the .idx file.
    – user31729
    Commented Jan 6, 2019 at 19:06
  • 1
    In my opinion, you should use imakeidx rather than this weird package (sorry!)
    – user31729
    Commented Jan 6, 2019 at 19:31
  • @ChristianHupfer I am using manyind to separate terms into multiple indices. Is this possible using imakeidxtoo?
    – Ondrian
    Commented Jan 6, 2019 at 22:28
  • Yes, that's why I mentioned that package
    – user31729
    Commented Jan 7, 2019 at 8:36

1 Answer 1

1

There is a typo in manyind.sty, basically right at the start within \AtBeginDocument{...}:

 \protected@write
    \@indexfile {}{\string \indexentry
    {\ind@nr#1 }{\thepage}}%
  \endgroup

must be changed to

\protected@write
   \@indexfile {}{\string \indexentry
  {\ind@nr #1}{\thepage}}%
  \endgroup

i.e. the space between \ind@nr and #1 does matter here.

Following code fixes this.

\documentclass{book}
\usepackage{blindtext}

\usepackage{manyind}

\makeatletter

\AtBeginDocument{\def\ind@nr#1{\string\indnr\mindchoice d\gr@bltr#1-\relax b #1}%
\ifx\@@wrindex\undefined
\def\@wrindex#1{\@bsphack 
\protected@write
    \@indexfile {}{\string \indexentry
    {\ind@nr #1}{\thepage}}%
  \endgroup
\@esphack}%
\else
\def\@wrindex#1{\@@wrindex\ind@nr#1||\\}%
\fi
\setindex{main}}%

\makeatother
%\usepackage{makeidx}
\makeindex



\begin{document}
\blindtext[1]\index{abc} \index{cdef}
\printindex
\end{document}
3
  • @Ondrian: The package author(s) should informed about the bug
    – user31729
    Commented Jan 7, 2019 at 8:39
  • 1
    Yes, I informed him right after I saw your answer.
    – Ondrian
    Commented Jan 7, 2019 at 18:24
  • Thank you all for helping me maintain my weird package. Commented Jan 8, 2019 at 9:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .