[XeTeX] arabic
Ross Moore
ross.moore at mq.edu.au
Sun Oct 24 00:30:47 CEST 2010
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
------------------------------------------------------------------------
More information about the XeTeX
mailing list