3

I'm using xindy for my index. And I would like to have cross-references inside. But when I do so, the page number associate to the entry with a cross-reference disappear.

Here is a MWE:

\documentclass[10pt,a4paper]{article}
\newcommand{\lang}{english}
\newcommand{\inputec}{utf8}
\usepackage[utf8]{inputenc}
\usepackage[\lang]{babel}
\usepackage[T1]{fontenc}

\usepackage[xindy]{imakeidx}
\usepackage[hyperindex=false]{hyperref}

\def\xindyopt{ -I latex -M style_index1 -L english -C utf8}
\makeindex[program=truexindy, options=\xindyopt, intoc]                     


\begin{document}
toto    \index{toto}  \newpage 
toti \index{toti|seealso{toto}} \newpage
ta\index{ta|see{toto, toti}} \newpage
tata\index{tata}

\printindex

\end{document}

and here is my index style file, sytle_index1 :

(define-location-class "arabic-page-numbers" ("arabic-numbers")             
                    :min-range-length 2)                            

(define-attributes (("definition" "usage" "default" "hyperpage")))


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

(define-crossref-class "seealso")
(markup-crossref-layer-list :sep ", ")
(markup-crossref-list :class "seealso" :open "\seealsolinkk{" :sep "; " :close "}{}")

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


(define-location-class-order (
              "arabic-page-numbers"
              "see"
              "seealso"))

(markup-index :open  "~n\begin{theindex}
                    \providecommand*\lettergroupDefault[1]{}
                    \providecommand*\lettergroup[1]{%
                        \par\textbf{#1}\par
                        \nopagebreak
                    }
                    \newcommand{\targetindexentryy}[1]{\hypertarget{index:#1}{#1}}
                    \newcommand{\seelinkk}[1]{\see{\hyperlink{index:#1}{#1}}}
                    \newcommand{\seealsolinkk}[1]{\seealso{\hyperlink{index:#1}{#1}}}
                ~n"     
    :close "~n~n\end{theindex}~n"
    :tree)


(markup-indexentry :open "~n \item "            :depth 0)
(markup-indexentry :open "~n    \subitem "      :depth 1)
(markup-indexentry :open "~n      \subsubitem " :depth 2)


(markup-locref-list :sep ", ")
(markup-locclass-list :open "\dotfill " :close "" ) ;; :sep ", "


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


(markup-keyword-list :open "\targetindexentryy{" :close "}" )
1

I found the solution to my problem.

I have to add another entry without cross-ref. Thus we should have in the .tex file:

 toti \index{toti|seealso{toto}} \index{toti} \newpage

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.