ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
@ 2016-01-18 18:07 Ibn Saeed
  2016-01-18 18:14 ` Ibn Saeed
  0 siblings, 1 reply; 9+ messages in thread
From: Ibn Saeed @ 2016-01-18 18:07 UTC (permalink / raw)
  To: ntg-context

Hello

I am trying to typeset a book in arabic in ConTeXt. I have stumbled upon 
this issue

Page Numbers change after 9 
to 01 for page 10
21 for page 12
31 for page 13
41 for page 14
and so on

Here is the snapshot of the page number issue:
https://i.imgsafe.org/a5f34fb.jpg



Here is my ConTeXt Code:

\mainlanguage[arabic]

\setupdirections[bidi=global]

\definefontfeature
  [arabic]
  [mode=node,language=dflt,script=arab,
    init=yes,medi=yes,fina=yes,isol=yes,
    liga=yes,dlig=yes,rlig=yes,tlig=yes,
    calt=yes,trep=yes,clig=yes,
    mark=yes,mkmk=yes,kern=yes,curs=yes]


\starttypescript [serif] [arabic]
  \definefontsynonym [Arabic-Regular] [file:ScheherazadeRegOT.ttf] 
[features=arabic]
  \definefontsynonym [Arabic-Bold] [file:ScheherazadeRegOT.ttf] 
[features=arabic]
\stoptypescript

\starttypescript [serif] [arabic] [name]
 \usetypescript[serif][fallback]
 \definefontsynonym [Serif]     [Arabic-Regular] [features=arabic]
 \definefontsynonym [SerifBold] [Arabic-Bold]    [features=arabic]
\stoptypescript

\starttypescript [Arabic]
  \definetypeface [Arabic] [rm] [serif] [arabic] [default] 
\stoptypescript 
  


\setupmargindata[margintext]
	[align=r2l]
	
\setupalign[r2l]  


\setuppapersize[A4]


\setuplayout[
  grid=min,
  backspace=46.666mm, width=140mm,
  topspace=33.000mm, height=198mm,
  header=12.9mm,footer=9mm,
  ]
  
  
%% Double sided document
\setuppagenumbering[
  alternative=doublesided,
  state=none,
  location={header,marginedge},
%  conversion=romannumerals, left={--~}, right={~--},
]


\setupbodyfont[Arabic,18pt]
\setupinterlinespace[line=42pt]

 
\setupheads[number=no]
\setuphead[chapter]
[style=\bfd,before=,after=\blank,alternative=middle,grid=both]
\setuphead[section][style=\bfc,before=\blank,after=,grid=both]

\setupbackgrounds[text][text][frame=off, topframe=on]

\setupheader[style=\righttoleft, state=normal]     

\setupheadertexts
        [{\getmarking[chapter]}]    [{\pagenumber}]
        [{\pagenumber}]        [{\getmarking[chapter]}]



\starttext
\chapter{شرح الآجرومية}
الحمد لله رب العالمين، وصلى الله وسلم وبارك على عبده ورسوله نبينا محمد وعلى 
آله وصحبه أجمعين، أما بعد:\\
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re:  Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-18 18:07 Page Numbers change after 9 to 01 - 11 -21 - 31 and so on Ibn Saeed
@ 2016-01-18 18:14 ` Ibn Saeed
  2016-01-18 18:28   ` Mohammad Hossein Bateni
  2016-01-18 21:43   ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Ibn Saeed @ 2016-01-18 18:14 UTC (permalink / raw)
  To: ntg-context

It seems to be the issue with 

    \setupheader[style=\righttoleft, state=normal]     

The style is righttoleft to accomodate the proper direction for arabic text. 
But it messes up the page number direction.

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-18 18:14 ` Ibn Saeed
@ 2016-01-18 18:28   ` Mohammad Hossein Bateni
  2016-01-19  3:54     ` Ibn Saeed
  2016-01-18 21:43   ` Hans Hagen
  1 sibling, 1 reply; 9+ messages in thread
From: Mohammad Hossein Bateni @ 2016-01-18 18:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1151 bytes --]

One hacky way to fix it is the following:

\setupheadertexts
        [{\getmarking[chapter]}]    [{\lefttoright\pagenumber}]
        [{\lefttoright\pagenumber}]        [{\getmarking[chapter]}]

Ideally \setupdirections[bidi] or something like that should be used, as I
mentioned in the other thread; that'll fix a bunch of other problems, as
well.


On Mon, Jan 18, 2016 at 1:14 PM, Ibn Saeed <ibnsaeed@gmail.com> wrote:

> It seems to be the issue with
>
>     \setupheader[style=\righttoleft, state=normal]
>
> The style is righttoleft to accomodate the proper direction for arabic
> text.
> But it messes up the page number direction.
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 2411 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-18 18:14 ` Ibn Saeed
  2016-01-18 18:28   ` Mohammad Hossein Bateni
@ 2016-01-18 21:43   ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2016-01-18 21:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 1/18/2016 7:14 PM, Ibn Saeed wrote:
> It seems to be the issue with
>
>      \setupheader[style=\righttoleft, state=normal]
>
> The style is righttoleft to accomodate the proper direction for arabic text.
> But it messes up the page number direction.

you can try leftstyle instead (there's also rightstyle)


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-18 18:28   ` Mohammad Hossein Bateni
@ 2016-01-19  3:54     ` Ibn Saeed
  2016-01-19 10:20       ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Ibn Saeed @ 2016-01-19  3:54 UTC (permalink / raw)
  To: ntg-context

Mohammad Hossein Bateni <bateni <at> gmail.com> writes:

> 
> 
> One hacky way to fix it is the following:
> 
> \setupheadertexts        [{\getmarking[chapter]}]    
[{\lefttoright\pagenumber}]        [{\lefttoright\pagenumber}]        
[{\getmarking[chapter]}]
> 
> 
> Ideally \setupdirections[bidi] or something like that should be used, as I 
mentioned in the other thread; that'll fix a bunch of other problems, as 
well

I did enable \setupdirections[bidi=global] and it did not help.

Here is how it was solved. I could not use your solution as it would move 
the position of the page number of the even page on top of the chapter name.

So here is the solution derived from your answer, which works for my 
scenario.

\setupheader[margin][
	style=\righttoleft, 
	state=normal
	]     

\setupheadertexts
        [{\righttoleft\getmarking[chapter]}]    [{\pagenumber}]
        [{\pagenumber}]        [{\righttoleft\getmarking[chapter]}]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-19  3:54     ` Ibn Saeed
@ 2016-01-19 10:20       ` Wolfgang Schuster
  2016-01-19 11:16         ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2016-01-19 10:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1364 bytes --]

> Ibn Saeed <mailto:ibnsaeed@gmail.com>
> 19. Januar 2016 um 04:54
> Mohammad Hossein Bateni<bateni<at>  gmail.com>  writes:
>
>> One hacky way to fix it is the following:
>>
>> \setupheadertexts        [{\getmarking[chapter]}]
> [{\lefttoright\pagenumber}]        [{\lefttoright\pagenumber}]       
> [{\getmarking[chapter]}]
>> Ideally \setupdirections[bidi] or something like that should be used, as I
> mentioned in the other thread; that'll fix a bunch of other problems, as
> well
>
> I did enable \setupdirections[bidi=global] and it did not help.
>
> Here is how it was solved. I could not use your solution as it would move
> the position of the page number of the even page on top of the chapter name.
>
> So here is the solution derived from your answer, which works for my
> scenario.
>
> \setupheader[margin][
> 	style=\righttoleft,
> 	state=normal
> 	]
>
> \setupheadertexts
>          [{\righttoleft\getmarking[chapter]}]    [{\pagenumber}]
>          [{\pagenumber}]        [{\righttoleft\getmarking[chapter]}]
>
As Hans told you you can change the style for the header text in the 
left side only:

\setupheader[leftstyle=\righttoleft]

\setupheadertexts
   [chapter]    [pagenumber]
   [pagenumber] [chapter]

\setuppagenumbering[alternative=doublesided]

\starttext
\dorecurse{10}{\expanded{\chapter{Chapter \recurselevel}}}
\stoptext

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2604 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-19 10:20       ` Wolfgang Schuster
@ 2016-01-19 11:16         ` Mohammad Hossein Bateni
  2016-01-19 11:30           ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Mohammad Hossein Bateni @ 2016-01-19 11:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2572 bytes --]

That should work for Ibn Saeed, but it's not a complete solution.  For
example it does not work if one wants to write "page x of y" instead, with
"page" and "y" written in Arabic/Persian.  Then the text of the header is
partly LTR and part RTL.

This is still simple and I can use my hacky solution and mix \lefttoright
and \righttoleft to get it right.  But is it possible to extend the
\setupdirections[bidi=on] to apply to parts other than the main text?  I
just noticed this does not apply to footnotes either.  Having numbers in
the TRL footnote text produces incorrect typesetting.

On Tue, Jan 19, 2016 at 5:20 AM, Wolfgang Schuster <
schuster.wolfgang@gmail.com> wrote:

> Ibn Saeed <ibnsaeed@gmail.com>
> 19. Januar 2016 um 04:54
>
> Mohammad Hossein Bateni <bateni <at> gmail.com> writes:
>
>
> One hacky way to fix it is the following:
>
> \setupheadertexts        [{\getmarking[chapter]}]
>
> [{\lefttoright\pagenumber}]        [{\lefttoright\pagenumber}]
> [{\getmarking[chapter]}]
>
> Ideally \setupdirections[bidi] or something like that should be used, as I
>
> mentioned in the other thread; that'll fix a bunch of other problems, as
> well
>
> I did enable \setupdirections[bidi=global] and it did not help.
>
> Here is how it was solved. I could not use your solution as it would move
> the position of the page number of the even page on top of the chapter name.
>
> So here is the solution derived from your answer, which works for my
> scenario.
>
> \setupheader[margin][
> 	style=\righttoleft,
> 	state=normal
> 	]
>
> \setupheadertexts
>         [{\righttoleft\getmarking[chapter]}]    [{\pagenumber}]
>         [{\pagenumber}]        [{\righttoleft\getmarking[chapter]}]
>
>
> As Hans told you you can change the style for the header text in the left
> side only:
>
> \setupheader[leftstyle=\righttoleft]
>
> \setupheadertexts
>   [chapter]    [pagenumber]
>   [pagenumber] [chapter]
>
> \setuppagenumbering[alternative=doublesided]
>
> \starttext
> \dorecurse{10}{\expanded{\chapter{Chapter \recurselevel}}}
> \stoptext
>
> Wolfgang
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 4457 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-19 11:16         ` Mohammad Hossein Bateni
@ 2016-01-19 11:30           ` Wolfgang Schuster
  2016-01-19 17:29             ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2016-01-19 11:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1010 bytes --]

> Mohammad Hossein Bateni <mailto:bateni@gmail.com>
> 19. Januar 2016 um 12:16
> That should work for Ibn Saeed, but it's not a complete solution.  For 
> example it does not work if one wants to write "page x of y" instead, 
> with "page" and "y" written in Arabic/Persian.  Then the text of the 
> header is partly LTR and part RTL.
>
> This is still simple and I can use my hacky solution and mix 
> \lefttoright and \righttoleft to get it right.  But is it possible to 
> extend the \setupdirections[bidi=on] to apply to parts other than the 
> main text?  I just noticed this does not apply to footnotes either.  
> Having numbers in the TRL footnote text produces incorrect typesetting.
ConTeXt resets many settings for headers, footers, footnotes etc. and 
have to set them again for these elements.

To apply the bidi setting to footnotes you have to add

\startsetups[bidi:footnotes]
   \setupdirection[bidi=on]
\stopsetups

\setupnotes[footnote][setups=bidi:footnotes]

to your document.

Wolfgang



[-- Attachment #1.2: Type: text/html, Size: 2120 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
  2016-01-19 11:30           ` Wolfgang Schuster
@ 2016-01-19 17:29             ` Mohammad Hossein Bateni
  0 siblings, 0 replies; 9+ messages in thread
From: Mohammad Hossein Bateni @ 2016-01-19 17:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2061 bytes --]

Thanks, Wolfgang!  This does work indeed.  I had actually tried it before
but made a mistake which made it useless.

What commands accept this kind of setup?  Do the headers and footers accept
such a thing?  How much overhead does this cause?

Is it possible to run the bidi code on a small string? Is there a macro
like \applybidi{some-text-to-apply-bidi-algorithm-on}?

—MHB

On Tue, Jan 19, 2016 at 6:30 AM, Wolfgang Schuster <
schuster.wolfgang@gmail.com> wrote:

> Mohammad Hossein Bateni <bateni@gmail.com>
> 19. Januar 2016 um 12:16
> That should work for Ibn Saeed, but it's not a complete solution.  For
> example it does not work if one wants to write "page x of y" instead, with
> "page" and "y" written in Arabic/Persian.  Then the text of the header is
> partly LTR and part RTL.
>
> This is still simple and I can use my hacky solution and mix \lefttoright
> and \righttoleft to get it right.  But is it possible to extend the
> \setupdirections[bidi=on] to apply to parts other than the main text?  I
> just noticed this does not apply to footnotes either.  Having numbers in
> the TRL footnote text produces incorrect typesetting.
>
> ConTeXt resets many settings for headers, footers, footnotes etc. and have
> to set them again for these elements.
>
> To apply the bidi setting to footnotes you have to add
>
> \startsetups[bidi:footnotes]
>   \setupdirection[bidi=on]
> \stopsetups
>
> \setupnotes[footnote][setups=bidi:footnotes]
>
> to your document.
>
> Wolfgang
>
>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3784 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-01-19 17:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-18 18:07 Page Numbers change after 9 to 01 - 11 -21 - 31 and so on Ibn Saeed
2016-01-18 18:14 ` Ibn Saeed
2016-01-18 18:28   ` Mohammad Hossein Bateni
2016-01-19  3:54     ` Ibn Saeed
2016-01-19 10:20       ` Wolfgang Schuster
2016-01-19 11:16         ` Mohammad Hossein Bateni
2016-01-19 11:30           ` Wolfgang Schuster
2016-01-19 17:29             ` Mohammad Hossein Bateni
2016-01-18 21:43   ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).