3

I'm writing a book in Persian. In its index there is a problem. Words are using Arabic order! So it causes a problem as in Arabic language they don't have four letters 'پ p (in pen)', 'چ ch (in cheese)', 'گ g (in gas)' and 'ژ zh or s (in usual)'. So these 4 letters are deleted from their main places and these are appeared after all letters but it's wrong, for example 'پ p' should be after 'ب b' and before 'ت t'. I would to see can I define order between letters of an alphabet myself. So I'm not only seeking a solution for the above problem and my question is the generalized form of it (the general case may be useful sometimes).

As some may need an example I wrote one (this is just an example).

\documentclass[12pt,a4paper]{article}
\usepackage[next]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage[left=2.00cm, right=2.00cm, top=2.00cm, bottom=1.50cm]{geometry}
\usepackage{xepersian}
\settextfont{XB Niloofar}
\author{A.H. SadeghiManesh}
\makeindex
\begin{document}
نمونه
\index{بالارونده}
\index{پائین‌رونده}
\index{تعمیم قضیه}
\printindex
\end{document}

The result is as the image. but the third word should be between two others and not the last one! enter image description here

  • 2
    Are you using xindy? An MWE would really help here. Please give three example index entries and mark the one, which is set to the wrong place. I do not speak Persian and do not want to set up this problem for you. Information about your index packages and the language packages as well as the documentclass are mandatory here. Thanks. – LaRiFaRi Nov 14 '14 at 16:15
  • @LaRiFaRi Is the example I added what you need? – AmirHosein SadeghiManesh Nov 14 '14 at 16:57
5

Judging from the output, I guess you use xelatex file.tex, then makeindex file.idx, and finally xelatex file.tex again. This won’t work, as makeindex isn’t so language-aware.

You can use xindy () for the middle step instead, with the support for Persian being provided by xindy-persian. The easiest way would be downloading xindy-persian to the sub-directory below the one your .tex file is in, and using texindy -M xindy-persian/variant1-utf8-test.xdy file.idx (you can also use variant2, which is slightly different (see README), or change -test with -lang).

Here is the output; I hope this is what you were expecting.

Persian indexing using <code>xindy</code>

  • Yes it corrected the problem of Persian index and I downloaded xindy-persian but I couldn't understand how to use it. – AmirHosein SadeghiManesh Dec 7 '14 at 6:56
  • * Step 1: download and unzip this file into the same directory you’ve placed your .tex file in. * Step 2: compile your file using XeLaTeX: xelatex file.tex. * Step 3: process the index using xindy: texindy -M xindy-persian/variant1-utf8-test.xdy file.idx. * Step 4: recompile it with the processed index: xelatex file.tex. Of course you can place xindy-persian in other directories. Placing it under the same directory of the .tex files is simple, yet not flexible (say, when you want to use it for several projects). – Júda Ronén Dec 8 '14 at 9:49
  • It seems one cannot break lines in comments here. Meh… – Júda Ronén Dec 8 '14 at 9:51
  • 1
    That’s OK ☺. The process I wrote is to be done via command line. If you use TeXstudio, maybe this SE QA will help: tex.stackexchange.com/questions/118857/…. – Júda Ronén Dec 10 '14 at 13:42
  • 1
    FWIW, on my machine I could only get this to work by specifying the full location of the persian xdy file: texindy -M "D:\Program Files (x86)\MiKTeX 2.9\xindy\modules\lang\persian\variant1-utf8-test.xdy" test.idx – adam.baker Apr 20 '16 at 5:21

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.