2

I'd like to translate a picture dictionary into ancient Greek. Can the index have the section and list-item numbers instead of the page numbers? The current example (below) produces an index like this:

βάθρον, τό, 1
κεφαλή, ἡ, 1
σκέλος , εος, τό, 1
συμμαθητής, οῦ, ὁ, 1

Instead I would like to have an index like this

βάθρον, τό, 2, 1
κεφαλή, ἡ, 1, 1
σκέλος , εος, τό, 1, 2
συμμαθητής, οῦ, ὁ, 2, 2

Thanks!

\documentclass{book}
\usepackage[margin=0.5in, paperwidth=6in, paperheight=9in]{geometry}


 \usepackage{times}
\usepackage{polyglossia}
\setmainlanguage[variant=ancient]{greek}

\usepackage{makeidx}

 \setromanfont{FreeSerif}
\setsansfont{FreeSans}
\setmonofont{FreeMono}
\setmainfont{DejaVuSerif}

%
\usepackage{chngcntr}
\counterwithout{section}{chapter}

\makeindex
\begin{document}

\renewcommand\indexname{εὑρετήριον}
\section{τὸ σῶμα}
\begin{enumerate}
\item  κεφαλή, ἡ \index{κεφαλή, ἡ}
\item σκέλος, εος, τό \index{σκέλος, εος, τό}
\end{enumerate}
\section{τὸ γυμνάσιον}
\begin{enumerate}
\item  βάθρον, τό \index{βάθρον, τό}
\item συμμαθητής, οῦ, ὁ  \index{συμμαθητής, οῦ, ὁ}
\end{enumerate}
\printindex

\end{document}
3
  • Just to clarify, do you mean that you want it to be something like "[title]...[section number (possibly including subsection number)]" on each line? Jan 20 '18 at 4:29
  • 1
    List - item numbers are not unique. makeindex is not well defined to sort anything other than plain numbers
    – user31729
    Jan 20 '18 at 9:24
  • Yes, for example: σκέλος , εος, τό, 1, 2 means that σκέλος is in section 1 and at the second position in the list in section 1. Maybe it would be better to avoid lists and have subsection for each entry? That would make the unique, but it seems cumbersome. Also I forgot to add (sorry!) the sometimes the same list item may contain more than one voice, that is synonyms. For example, for eye you can say ὄμμα or ὀφθαλμός. So I would like to have that in the index ὄμμα and ὀφθαλμός point to the same section and list=item (subsection?) numbers.
    – bedwere
    Jan 21 '18 at 0:30
1

Using information found on this great site Index by section.subsection and this http://www.xindy.org/doc/tutorial-3.html I found a solution. First, I switched to subsection instead of enumerate to avoid problems (thank you for the tips, Walter and Christian!)

\documentclass{book}
\usepackage[margin=0.5in, paperwidth=6in, paperheight=9in]{geometry}


 \usepackage{times}
\usepackage{polyglossia}
\setmainlanguage[variant=ancient]{greek}

\usepackage{makeidx}
\makeatletter
  \def\@wrindex#1{%
    \protected@write\@indexfile{}%
      {\string\indexentry{#1}{\thesubsection}}
    \endgroup
  \@esphack}


 \setromanfont{FreeSerif}
\setsansfont{FreeSans}
\setmonofont{FreeMono}
\setmainfont{DejaVuSerif}

%
\usepackage{chngcntr}
\counterwithout{section}{chapter}

% \makeindex[columns=1,options=-M texindy -L greek -C utf8]
\makeindex






\begin{document}

\renewcommand\indexname{εὑρετήριον}
\section{τὸ σῶμα}
\subsection{}  κεφαλή, ἡ % \index{κεφαλή, ἡ} 
 \index{κεφαλή, ἡ}
\subsection{} σκέλος, εος, τό \index{σκέλος, εος, τό}
\subsection{} ὀφθαλμός, ὁ   \index{ὀφθαλμός, ὁ}  \\
ὄμμα, τό   \index{ὄμμα, τό@ὄμμα, τό}


\section{τὸ γυμνάσιον}
\subsection{}  βάθρον, τό \index{βάθρον, τό}
\subsection{} συμμαθητής, οῦ, ὁ  \index{συμμαθητής, οῦ, ὁ}
\printindex

\end{document}

After doing xelatex lexicon, I do xindy -C utf8 -M texindy -M page-ranges -M RL_module.xdy -I latex lexicon.idx

My RL_module.xdy has this line

(define-location-class "subsections" ("arabic-numbers" :sep "." "arabic-numbers"))

and all the sort rules for polytonic Greek, which I don't think I need to post. In this way, I get an index like this:

βάθρον, τό, 2.1

κεφαλή, ἡ, 1.1

ὄμμα, τό, 1.3

ὀφθαλμός, ὁ, 1.3

σκέλος, εος, τό, 1.2

συμμαθητής, οῦ, ὁ, 2.2

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.