Page Numbers change after 9 to 01 - 11 -21 - 31 and so on.
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
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.
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
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
___________________________________________________________________________________
Mohammad Hossein Bateni
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]}]
Ibn Saeed mailto:ibnsaeed@gmail.com 19. Januar 2016 um 04:54 Mohammad Hossein Bateni
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
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
19. Januar 2016 um 04:54 Mohammad Hossein Bateni
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
___________________________________________________________________________________
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
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
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
___________________________________________________________________________________
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 -----------------------------------------------------------------
participants (4)
-
Hans Hagen
-
Ibn Saeed
-
Mohammad Hossein Bateni
-
Wolfgang Schuster