[XeTeX] arabic

Kamal Abdali k.abdali at acm.org
Mon Oct 25 00:18:07 CEST 2010


Hi Houda, Ross, and others,

In the previous message, I had mentioned Vahid Damanafshan's sample
mathematical document in Persian that uses makeindex with xepersian. With
some trivial improvisation, the TeX source ran successfully and almost
duplicated the original pdf. The index generation seems satisfactory.

Houda: This may be the kind of example code you were looking for. It
illustrates not just the index but a lot of other features of a scholarly
document. If you don't want to substitute any fonts, the ones needed can be
downloaded from http://wiki.irmug.org/index.php/X_Series_2. The order of
index entries is alphabetical, not abjadi. If you insist on the latter, then
some options and tables have to be changed.

Ross: The steps in TeXShop were exactly the same as needed with an English
document: TeX engine command twice; Makeindex command once; TeX engine
command once again. TeXShop has built-in keys and menus for both. MakeIndex
worked without any options, hints, additional collation tables, extra
scripts, etc. Perhaps xepersian provides the support that makeindex needs.

Kamal Abdali

On Sun, Oct 24, 2010 at 15:05, Kamal Abdali <k.abdali at acm.org> wrote:

> Thanks, Ross, for your effort to tame makeindex for the Arabic script.
>
> I also came across an interesting Persian sample that uses xepersian and
> makeindex. The pdf and tex source are at
>       http://www.parsilatex.com/joomla/attachments/vahid-seminar.pdf
>       http://www.parsilatex.com/joomla/attachments/vahid-seminar.tex
> Missing some of the source components, I couldn't reproduce the pdf
> exactly. But lo and behold, the index was generated without fuss and in the
> desired order of entries. I am still mystified why the letters are
> disconnected in the text, but that's another debugging chore.
>
> Kamal Abdali
>
> On Sat, Oct 23, 2010 at 18:30, Ross Moore <ross.moore at mq.edu.au> wrote:
>
>> Hi Vafa, Houda, Kamal, Ulrike and others,
>>
>>
>> On 23/10/2010, at 1:43 PM, Vafa Khalighi wrote:
>>
>> > I disagree. If makeindex was so perfect, why would someone spends lots
>> of time inventing a new system.
>>
>> Nobody said  makeindex  was perfect, just that it may be
>> sufficient for the job at hand.
>>
>> If the only problem is in representing the page-numbers using
>> other than western digits, then this is certainly achievable.
>> (See below for the kind of configuration that is needed.)
>>
>> On the other hand, Makeindex  would have difficulty sorting
>> the index entries automatically, according to rules
>> for non-latin scripts, unless there were extra sorting
>> tags provided with \index instances of the form
>>     \index{... at .....}
>>
>>
>> >
>> > For languages like Persian, Urdu, and other complex scripts, makeindex
>> is not suitable and you have got to use xindy.
>>
>> Until you have defined exactly what tasks are needed,
>> and how they need to fit with the workflow being employed,
>> how can you presume to say what is suitable and what is not?
>>
>> >
>> >
>> > --
>> > بسی رنج بردم در این سال سی         عَجَم زنده کردم بدین پارسی
>> >
>>
>> If the *only* problem is to deal with the page numbers
>> in the .ind  file, such as the OP gets using the defaults
>> for Makeindex; viz.
>>
>> >>> \begin{theindex}
>> >>>
>> >>>   \item test, 5
>> >>>
>> >>>   \indexspace
>> >>>
>> >>>   \item نمایه, 5
>> >>>
>> >>> \end{theindex}
>>
>> (Beware the RTL text may be confusing the appearance
>> of the actual byte order here.)
>>
>> You can configure to get the following instead:
>>
>> >>>  \begin{theindex}
>> >>>
>> >>>   \item test, \pagenumstyled 5
>> >>>
>> >>>   \indexspace
>> >>>
>> >>>   \item نمایه, \pagenumstyled 5
>> >>>
>> >>>  \end{theindex}
>>
>>
>> Now all that is needed is to define \pagenumstyled
>> appropriately, to "read ahead" and adjust how the
>> page number is to be displayed.
>> Here is example (La)TeX coding that does this:
>>
>> \RequirePackage{arabicnumbers}
>> \newcount\pageindcnt
>> \def\pagenumstyled{\afterassignment\dopagenumstyle\pageindcnt}
>> \def\dopagenumstyle{\arabicdigits{\number\pageindcnt}}
>>
>>
>>
>> So how is the configuration achieved?
>>
>> Use a customised .ist  file.
>> The following is minimal. It can be easily extended to cope
>> with nested entries and headings for letter-ranges, etc.
>>
>> >>> %%%%  start of file  myind.ist  %%%%%%%
>> >>> preamble
>> >>> "\\begin{theindex} \n "
>> >>> postamble
>> >>> "\n\n \\end{theindex}\n"
>> >>> delim_0   ", \\pagenumstyled "
>> >>> %%%%  end of  myind.ist  %%%%%%%
>>
>>
>> To use this the call to  Makeindex needs to be include
>> extra parameters; e.g.
>>
>>  makeindex -s ./myind.ist -o test-arabe1.ind test-arabe1.idx
>>
>> for a document named  test-arabe1.tex
>> This will load the customised .ist  file from
>> the same directory as the document source.
>>
>> Of course you could put it in another loaction that
>>  Makeindex will find, or you could adjust the TeXshop
>> command for Makeindex, or use a shell script, or ...
>>
>> Do whatever fits best with your workflow.
>>
>>
>> Here is a neat way, using \write18  that keeps all of
>> the coding together in your LaTeX document's preamble:
>>
>>
>> >>> \usepackage{makeidx}
>> >>> \RequirePackage{arabicnumbers}
>> >>> \newcount\pageindcnt
>> >>> \def\pagenumstyled{\afterassignment\dopagenumstyle\pageindcnt}
>> >>> \def\dopagenumstyle{\arabicdigits{\number\pageindcnt}}
>> >>> \immediate\write18{makeindex -s ./myind.ist -o test-arabe1.ind
>> test-arabe1.idx}
>> >>> \makeindex
>>
>>
>>
>> Note that the call to  'makeindex'  must come *before* the \makeindex ,
>> >
>>
>> so that it uses the  .idx  file from the previous LaTeX run.
>> This is because \makeindex  is going to reset  test-arabe1.idx  as
>> an output channel, to collect the index entries from the current run.
>>
>>
>> This example simply shows how to apply styles to the page numbers
>> in an index, generated using the  Makeindex  program.
>> There is no claim here that all possible problems with the use
>> of arabic digits and index entries are solved. For that, then
>> presumably Xindy has more appropriate methods.
>>
>>
>> Hope this helps,
>>
>>        Ross
>>
>>
>> ------------------------------------------------------------------------
>> Ross Moore                                       ross.moore at mq.edu.au
>> Mathematics Department                           office: E7A-419
>> Macquarie University                             tel: +61 (0)2 9850 8955
>> Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
>> ------------------------------------------------------------------------
>>
>>
>>
>>
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>>  http://tug.org/mailman/listinfo/xetex
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20101024/8c515a5c/attachment.html>


More information about the XeTeX mailing list