0

Consider the following MWE (thanks to this nice article from Maïeul Rouquette (in French)) that makes possible to have both:

  • indices built with (tex)xindy,
  • hyperlinked page numbers and "see",

(named, say, test.tex):

\begin{filecontents*}{\jobname.xdy}
(markup-keyword-list :open "\targetindexentry{" :close "}" )
(markup-crossref-list :class "see" :open "\seelink{" :sep "; " :close "}{}")

(define-crossref-class "hyperindexformat")
(markup-crossref-list :class "hyperindexformat" :open
      "\hyperindexformat{" :sep "; " :close "}{}")

(markup-locref :open "\hyperpage{" :close "}")
(markup-locref :open "\hyperpage{" :close "}" :attr "hyperpage")
\end{filecontents*}

\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
\pdftex_if_engine:TF
  {
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
  }{
    \usepackage{fontspec}
  }
\ExplSyntaxOff
\usepackage[xindy]{imakeidx}
\usepackage[hyperindex=false]{hyperref}%
%
\newcommand{\targetindexentry}[1]{\hypertarget{index:#1}{#1}}
\newcommand{\seelink}[1]{\see{\hyperlink{index:#1}{#1}}}
%
\makeindex[options=-M \jobname.xdy]
%
\begin{document}
Foo%
\index{café!bar}%
\index{bar}%
%
\printindex
%
\end{document}

If it is compiled with:

  1. pdflatex test (or lualatex test or xelatex test),
  2. texindy -M test.xdy test.idx
  3. pdflatex test (or lualatex test or xelatex test),

we notice 3 different behaviors:

  • with pdflatex, there is a warning (which is not really informative but seems to be serious):

    pdfTeX warning (ext4): destination with the same identifier (name{index:bar}) has been already used, duplicate ignored \AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi l.39 \end{document}

  • with lualatex, there is a warning:

    warning (pdf backend): ignoring duplicate destination with the name 'index:bar '

  • with xelatex, everything's okay.

I guess the warning with pdflatex comes from the LICR in the .ind file:

\begin{theindex}
  \providecommand*\lettergroupDefault[1]{}
  \providecommand*\lettergroup[1]{%
      \par\textbf{#1}\par
      \nopagebreak
  }

  \lettergroup{B}
  \item \targetindexentry{bar}, \hyperpage{1}

  \indexspace

  \lettergroup{C}
  \item \targetindexentry{caf\IeC {\'e}}
    \subitem \targetindexentry{bar}, \hyperpage{1}

\end{theindex}

Here is my question(s):

How to get rid of the warning in pdflatex (and also in lualatex) case? (And how do you explain the differences between xelatex and lualatex while the .ind file is the same in both cases?)

  • 1
    The warning is correct: There are two link targets with the same name index:bar under letter B and C. Therefore, the item for the subitems should be included in the target name, because the subitem name is not unique. – Heiko Oberdiek Oct 8 '16 at 19:01
  • @HeikoOberdiek Okay, I'll try to figure out how to include the item as well. Can we consider as a bug the fact xelatex doesn't tell anything about this? – Denis Bitouzé Oct 8 '16 at 21:36
  • Call it bug, missing feature or whatever. As long as nobody invests time to implement the warning in XeTeX, nothing will change. – Heiko Oberdiek Oct 8 '16 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.