3

Please save your time and energy on this task. It's partly solved.

Step by step I am trying to solve this question xindy for ancient Egyptian transliteration. There are some interesting side problems, this is the first one. How to use Xindy as a sorting engine only? So my task is to get similar results as from the Linux program sort.

We run any LaTeX engine, e.g.

lualatex toxindy-question.tex
xindy -M texindy -L czech -C utf8 toxindy-question.idx
lualatex toxindy-question.tex

Let this be an MWE:

% run: *latex toxindy-question.tex
\documentclass[a4paper]{article}
\usepackage{makeidx}
\makeindex
\usepackage{filecontents}
\begin{document}
Text before.
\index{first}\index{první}
\index{bread}\index{chléb}
\index{beer}\index{pivo}
\index{cibule}\index{mrkev}\index{řeřicha}\index{čmuchal}
\index{lenost}
\index{lenost}
\index{6@six}
\index{testv}
\index{testD!testE}
\index{testA!testB!testC}
\index{levelw}
\newpage
\index{lenostem}
\index{mark|textit}
\printindex
\end{document}

Requested output in toxindy-question.ind should be:

six
beer
bread
cibule
čmuchal
first
chléb
lenost
lenostem
levelw
mark
mrkev
pivo
první
řeřicha
testA testB testC
testD testE
testv

The actual output is this (toxindy-question.ind):

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

  \lettergroupDefault{default}
  \item six, 1

  \indexspace

  \lettergroup{B}
  \item beer, 1
  \item bread, 1

  \indexspace

  \lettergroup{C}
  \item cibule, 1

  \indexspace

  \lettergroup{Č}
  \item čmuchal, 1

  \indexspace

  \lettergroup{F}
  \item first, 1

  \indexspace

  \lettergroup{Ch}
  \item chléb, 1

  \indexspace

  \lettergroup{L}
  \item lenost, 1
  \item levelw, 1

  \indexspace

  \lettergroup{M}
  \item mrkev, 1

  \indexspace

  \lettergroup{P}
  \item pivo, 1
  \item první, 1

  \indexspace

  \lettergroup{Ř}
  \item řeřicha, 1

  \indexspace

  \lettergroup{T}
  \item testA
    \subitem testB
      \subsubitem testC, 1
  \item testD
    \subitem testE, 1
  \item testv, 1

\end{theindex}

1 Answer 1

3

One of the problems is that sorting in Czech is not 100 % valid in sort (letter/digraph ch is not considered) to my best knowledge. We cannot use merge rules and setting up a new language isn't a typical task there either. Therefore Xindy is still choice number 1.

My primary task is to typeset Czech plus Ancient Egyptian hieroglyphs plus British phonetics dictionary/index and I need index entries sorted and grouped but without any tags for later use in Lua. I am enclosing my try, I am quite close to have this task fully solved, well, I am still unable to get lost of index page numbers. It can be done at a TeX level easily (wrapping index page numbers by a TeX command and using something like \def\getmelost#1{}), or, we could delete a part including and after the percent sign in Lua, e.g. by string.gsub. I am wondering if we could do that at a Xindy level.

I have prepared an additional file, clearme.xdy, so we could easily switch from Czech to another language. In this example we run any LaTeX engine, e.g.:

lualatex toxindy.tex
xindy -M texindy -L czech -C utf8 -M clearme toxindy.idx
lualatex toxindy.tex

I enclose a minimal working example:

% run: *latex toxindy.tex
\documentclass[a4paper]{article}
\usepackage{makeidx}
\makeindex
%\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents*}{clearme.xdy}
(define-letter-groups (""))
(markup-index :open  "" :close "" :tree)
(markup-letter-group-list :sep "")
(markup-letter-group :open-head "" :close-head "")
(markup-letter-group :open-head "" :close-head "" :group "default")
(markup-indexentry :open "" :close "~n" :depth 0)
(markup-indexentry :open " " :close "" :depth 1)
(markup-indexentry :open " " :close "" :depth 2)
(markup-locclass-list :open "" :sep "") 
(markup-locref-list :sep "")
(markup-range :sep "")
(markup-crossref-list :open "" :close "" :class "see")
;(markup-locref :class "page-numbers" :open "pivo" :close "nepivo")
(markup-locref :open "% " :close "" :attr "default")
(markup-locref :open "% " :close "" :attr "textbf")
(markup-locref :open "% " :close "" :attr "textit")
(markup-locref :open "% " :close "" :attr "hyperpage")
;(define-location-class "page-numbers" ("arabic-numbers"))
; :minimum-range-length 3
; (markup-attribute-group :open "<group0>" :close "</group0>" :group 0)
; (markup-trace :open "%%" :close "~n")
;(define-location-class-order (""))
;(define-attributes ("see"))
\end{filecontents*}

\begin{document}
Text before.
\index{first}\index{první}
\index{bread}\index{chléb}
\index{beer}\index{pivo}
\index{cibule}\index{mrkev}\index{řeřicha}\index{čmuchal}
\index{lenost}
\index{lenost}
\index{6@six}
\index{testv}
\index{testD!testE}
\index{testA!testB!testC}
\index{levelw}
\newpage
\index{lenostem}
\index{mark|textit}
\printindex
\end{document}

This is the result of my efforts (toxindy.ind). This result can be used but it isn't perfect.

six% 1 
beer% 1 
bread% 1 
cibule% 1 
čmuchal% 1 
first% 1 
chléb% 1 
lenost% 1 
lenostem% 2 
levelw% 1 
mark% 2 
mrkev% 1 
pivo% 1 
první% 1 
řeřicha% 1 
testA testB testC% 1 
testD testE% 1 
testv% 1 

You must log in to answer this question.

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