jschrod / xindy.ctan

xindy source distribution, as released via CTAN
GNU General Public License v2.0
3 stars 3 forks source link

marked-up index entries fail with hyperref #9

Open kberry opened 3 years ago

kberry commented 3 years ago

An index entry with added markup, plus hyperref being used, is misparsed by xindy. Originally discovered by Alexander Krumeich.

Before Juergen's changes in May 2020 to support hyperindexformat cross-reference-class, such entries were completely omitted from the .ind (e.g., in TL2020-original). With the changes (e.g., in TL 2021 and TL2020-final), the entries are a mishmash with the markup command.

Example file below (named, arbitrarily, ih.tex) that makes two index entries: a "defining" one (markup with \textbf), and a normal one. The defining one gets messed up in the ind. Originally from Alexander; I cut it down to use only the basic {makeidx} package and added comments about the various cases.

\listfiles
\documentclass{article}

\usepackage{makeidx}\makeindex
\usepackage{hyperref}

% with hyperref enabled, and using current texindy ih.idx,
% the .ind is broken, containing (missing the page number 1):
%   \item example, \hyperpage{2}, \hyperindexformat{\textbf}{}

% until the 2020-05-28 changes from spitz, get:
%   WARNING: unknown cross-reference-class `hyperindexformat'! (ignored)
% and the page 1 ("defining") entry is missing:
%   \item example, \hyperpage{2}

% if comment out hyperref, using texindy, the .ind is fine, containing:
%   \item example, \textbf{1}, 2

% if leave hyperref enabled, and use makeindex, the .ind is also ok:
%   \item example, \hyperpage{2}
%   \item example, \hyperindexformat{\textbf}{1}

\newcommand{\definingindexentry}[1]{\index{#1@#1|textbf}#1}

\begin{document}
First page, a defining \definingindexentry{example}.

% If comment out the marked-up index entry and just have regular
% entries, all cases are fine (not surprisingly):
%First page, a defining \index{example}.

\clearpage{}
Second page, a normal \index{example}.
\printindex

\end{document}

Just for possible convenience, the ChangeLog entry for Juergen's changes which I installed last year, with more references:

2020-05-28  J\"urgen Spitzm\"uller  <spitz@lyx.org>

        These patches from:
        https://tug.org/pipermail/tex-live/2020-May/045760.html

        * xindy-src/src/markup.lsp: support giving attributes to the
        markup of separator with :attr.
        * doc/manual-3.html: document this.
        https://sourceforge.net/p/xindy/bugs/1/

        * xindy-src/modules/base/makeindex.xdy
        (define-crossref-class, markup-crossref-list): handle
        \see and \seealso added by hyperref.
        * xindy-src/user-commands/texindy.in,
        * xindy-src/user-commands/xindy.in: corresponding doc updates.
        https://sourceforge.net/p/xindy/bugs/62/

        * xindy-src/doc/faq-4.html,
        * xindy-src/doc/manual-3.html: document workaround for
        :min-range-length none being broken.
        https://github.com/jschrod/xindy.ctan/issues/3
jspitz commented 3 years ago

Alas I think fixing this requires fundamental changes in xindy (beyond my lisp abilities). The problem is that we do not seem to have a way to handle the page number as a second argument and thus close with an empty second argument. This is also the reason why \seealso does not work properly in xindy (it's just an alias for \see).

kberry commented 3 years ago

Fair enough. Thanks for looking at it, J\"urgen.

I guess it will have to await Joachim's copious spare time to ever be fixed. It's not something I'm going to tackle. --best, karl.