# [NTG-context] reverse page order and reverse page numbering in one part of a book

Idris Samawi Hamid ادريس سماوي حامد Idris.Hamid at colostate.edu
Wed Jul 22 13:58:04 CEST 2015

```Dear Talal,
Salaam. See below:

On Wed, 22 Jul 2015 03:49:29 -0600, talazem at fastmail.fm
<talazem at fastmail.fm> wrote:

> Dear all,
>
> I am producing a book that is divided into two sections. The book is
> published in English, and thus it runs left to right. Part one is an
> academic study in English. Part two is a critical edition of an Arabic
> text. The book is exactly 100 pages long, with fifty pages going to the
> English study, and fifty pages to the Arabic edition.
>
> In Part One (which includes all the front matter of the book, such as
> pagination runs from 1 to 50, and the page numbers should be printed in
> Arabic numerals.
>
> However, in Part Two (the Arabic text): the page ordering should run
> right-to-left, the page numbers should run in “reverse” pagination (in
> which “page 1" of the critical edition begins at the “back” of the
> book), and the page numbers should be printed in Hindi numerals.
>
> In other words, the structure of the book’s pages would be as follows
> (ellipses used to jump):
>
> 1
> 2
> 3
> …
> 48
> 49
> 50
> ٥٠
> ٤٩
> ٤٨
> …
> ٣
> ٢
> ١
>
>
> Forward . . . . . . v
> English Study . . . 1
> Arabic Edition. . . ١
> Index of names. . . ٥٠
>
> So my question is: is this currently possible in ConTeXt, to produce a
> single PDF, with such a TOC, from one file? Or am I bringing on too much
> of a headache upon myself, and it is easier to produce two separate
> files — but if so, how would one produce a TOC that includes the parts
> and page numbers of both documents?

For getting the Arabic pages to go the other way, I would leave that to
the printer and/or post-pdf processing. After all, ConTeXt doesn't care
about whether the book itself reads RTL or LTR. OTOH, you may have to
reverse some of the \setuplayout parameters (such as margin and backspace)
for the Arabic portion of the book.

I'm sure you've seen Arthur Jeffery, Materials for the History of the Text
of the Quran, for a nicely typeset example of what you are trying to do.
Or even Revelation and Falsification edited by Kohlberg [a very misleading
and sensationalist title by the way]. If you want to have two books in
one, you *may* want to rethink this: Just have an Arabic TOC in the Arabic
section (entirely RTL of course) and an English TOC in the English
section. The English TOC need only point to the fact that the Arabic
edition comes afterwards, and the Arabic TOC could do the same.

That said: You could typeset both books as distinct products or components
within a single project file - see page 20 of cont-eni.pdf (I once did two
books this way). Then you can do cross-references between both books. IIRC
you can then take the TOC in one product or component and place it in the
other. So in the English book you can place the Arabic TOC and vice versa.
Of course you will want to define a separate TOC control sequence for
each. So you can get, e.g.

\start \LATINFONTOPTIONS
\placeENGLISHcontent
\stop
\start \ARABICFONTOPTIONS
\placeARABICcontent
\stop
\stoptitle

which gives you exactly what you want. After all is said and done, the
printer can reverse the order of the Arabic pages but that will not affect

Note that your example has English section names mapped to Arabic/Hindi
page numerals (again, I would prefer a purely Arabic TOC). But your
section titles in the Edition will not be in English. ConTeXt allows you
to use dummy names for section title that will end up in your TOC, and
this is documented in the manual I'm sure.

Tangent: We need to start looking at the needs of Arabic indices in
ConTeXt. Alan Braslau and Hans Hagen are already working on a new
bibliography module that will eventually support RTL needs as well.

Best wishes
Idris
--
Idris Samawi Hamid
Professor of Philosophy