3

In the shown MWE, I cannot determine why the index is not generated, although the code is very simple, no room for any conflicts, I am using LUALATEX to compile the file

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[nil,bidi=basic-r,layout=counters.lists]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}
\babelfont[arabic]{rm}{Amiri}
\babelfont{rm}{Times New Roman}
\usepackage{imakeidx}
\makeindex

\begin{document}
\chapter{سسسييسسييس}
\section{ مقدمة}
\section{مقدمة عن تاريخ الكتابة المصرية القديمة}
\section{مقدمة عن تاريخ الكتابة المصرية القديمة}
\clearpage
\section{مقدمة عن تاريخ الكتابة المصرية القديمة}
. حيث حُذِفَت علامة الرفع (وس) وايضاً حُذِفَت الحركة الأولى (أي) والتي ظنها العرب استهلال يتبقى اسم قبط
\index{شبيسبسي}
\index{سيبسيبسي}
وهى مأخوذة من "حام" بن نوح
سيبيسبيسبسيب
سيبيسبيسبسيب
بيلبيلبيلبيلبيلبيل 
\newpage
\printindex
\end{document}
  • You might be able to get help faster if you only used fonts that are available with LaTeX it self. I don't have times new roman. But it compiles without it. Did you look in the log of the compilation, mine says Scanning input file imf.idx...done (0 entries accepted, 2 rejected). meaning that makeindex rejected the two arabic entries, which is expected as it does not know utf8. – daleif Aug 30 '19 at 15:34
  • babel inject something in the idx that makeindex doesn't like. But even if one correct this: I don't see how an 8bit application like makeindex should be able to sort arabic indexentries. You should better check alternatives like bib2gls, xindex or xindy (but I have no idea if they can handle RTL. Or add sortkeys manually. – Ulrike Fischer Aug 30 '19 at 15:36
  • @Ulrike, I tried xindy and it did not work – Silva Aug 30 '19 at 15:37
  • @daleif actually makeindex doesn't stumble over the arabic but over the format of the number (babel injects something there). – Ulrike Fischer Aug 30 '19 at 15:38
  • xindy is only my third suggestion - I would try bib2gls first. As it is java based it contains some unicode libraries for sorting. – Ulrike Fischer Aug 30 '19 at 15:41
4

An example of creating index on arabic document with context, it is availible on texlive so if you are using miktex you need to change it to texlive.

The first run of context will take a while, you can use texworks which provides option for context compilation

More about indexing on context https://wiki.contextgarden.net/Registers

\setuppapersize[A4]
\mainlanguage[ar] 
\setupdirections[bidi=global,method=one]
\setupalign[r2l] 

\definefontfamily [myfont][serif][Amiri]   [features=arabic]
\setupbodyfont [myfont]

\setupmixedcolumns[register][direction=reverse]

\starttext

اللُّغَة العَرَبِيّة هي أكثر اللغات تحدثاً ونطقاً ضمن مجموعة اللغات السامية، وإحدى أكثر 
اللغات انتشاراً في العالم، يتحدثها أكثر من 467 مليون نسمة، ويتوزع متحدثوها في 
الوطن العربي،
 \index{بسم }
 بسم 
\index{نص}
 نص
 \index{أبجد} 
 أبجد
 \index{جسد} 
 جسد

\completeindex

\stoptext

enter image description here

| improve this answer | |
  • Well, I currently cannot change the main aspects of my code, do you happen to have a solution for my case where I am using babel package and biblatex where I compile the file with LUALATEX – Silva Aug 30 '19 at 19:10
  • No I have no solution with babel (lualatex), there is xindy-persian but I never used it. – Salim Bou Aug 30 '19 at 19:23
3

both biber and bib2gls can sort arabic. I can't read the script, so I have no idea if the sorting is done correctly.

Example for bib2gls

Compile with

  lualatex file
  bib2gls file
  lualatex file

\documentclass{article}

%\usepackage{filecontents} %uncomment to oeverwrite the bib

\begin{filecontents}{arabindex.bib}
% Encoding: UTF-8
@entry{A,
  name = {أبجد},
  description = {Alphabetize}}

@entry{B,
  name = {بسملسامية},
  description = {nonsense}}

@entry{X,
  name = {سملسامية},
  description = {nonsense2}}  
@entry{I,
  name = {بسم},
  description = {In nomine Domini}}        
\end{filecontents}

\usepackage[bidi=basic-r,layout=counters.lists]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}
\babelfont[arabic]{rm}{Amiri}

\usepackage[record=only]{glossaries-extra}

\GlsXtrLoadResources[selection={all},%
            src={arabindex},%
            sort={ar},
            sort-field={name},
            charset=UTF-8,%
            ]
\begin{document}

\gls{B}, \gls{I} \gls{A} \gls{X}

\printunsrtglossaries 

\end{document}

enter image description here

Example for biber

Compile with

  lualatex file
  biber file
  lualatex file

This shows only the principle, to be usable as index one would have to add some more entry types and fields and adapt the drivers.

\documentclass{article}

\begin{filecontents}{arabbiblatex.bib}
% Encoding: UTF-8
@article{A,
  author = {أبجد},
  title = {Alphabetize}}

@article{B,
  author = {بسملسامية},
  title = {nonsense}}

@article{X,
  author = {سملسامية},
  title = {nonsense2}}
@article{I,
  author = {بسم},
  title = {In nomine Domini}}
\end{filecontents}


\usepackage[bidi=basic-r,layout=counters.lists]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}
\babelfont[arabic]{rm}{Amiri}

\usepackage[style=authortitle]{biblatex}
\addbibresource{arabbiblatex.bib}

\begin{document}
\nocite{*}
\printbibliography

\end{document}

enter image description here

| improve this answer | |
  • @ Ulrike, i still get the error : Undefined control sequence : \ForEachTrackedDialec – Silva Aug 31 '19 at 16:46
  • is your tex system up-to-date? – Ulrike Fischer Aug 31 '19 at 16:59
  • 1
    then upload the log-file of my example somewhere. then I can compare. – Ulrike Fischer Aug 31 '19 at 17:56
  • 1
    Open a command line and run "bib2gls name-of-your-file". You can fake with biber an index - there are lots of similarities between index and bibliography - but imho bib2gls and glossaries would be less work. I only tried with biber as I wanted to see how well it sorts such a script. – Ulrike Fischer Sep 1 '19 at 10:46
  • 1
    THX, ISSUE FINALLY RESOLVED – Silva Sep 1 '19 at 11:01

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.