ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* RTL section heads
@ 2016-04-08 21:20 Mohammad Hossein Bateni
  2016-04-11  2:25 ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 13+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-08 21:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,

This is concerning an RTL text.  I have one chapter and 10 sections under
that.  My goal is to achieve the following.
1) The number 10 should appear correctly with '1' visually to the left of
'0'.
2) The chapter number should visually appear to the right of the section
number.
3) Chapter and section numbers should be separated with a dash.  (This is
ignored in this email and I will follow up about it in another thread.  To
get a minimal working example, I also do not try to change the numbers to
use Persian digits.)

In particular, the headings will be visually something like the following
(aligned to the right).
elpmas 1
txet 1-1
txet 2-1
txet 3-1
...
txet 10-1

Here's the first attempt.

%% Attempt 1
\setupalign[r2l]

\starttext
\placecontent

\chapter{sample}
\dorecurse{10}{\section{text}}
\stoptext

The result is:
elpmas 1
txet 1-1
...
txet 01-1


Then I add "\setupdirections[bidi=global,method=default]" to the beginning
and I get the most strange result (number right-aligned but texts
left-aligned):
sample                                    1
text                                       1.1
...
text                                     1.10


A third attempt gives almost what I want (without period as the separator).

%% Attempt 3
\setupalign[r2l]

\def\LTR#1{{\lefttoright#1}}
\def\leftnumbers#1{\LTR{\numbers{#1}}}
\defineconversion[leftnumbers][\leftnumbers]
\setuphead[chapter,title,section,subject] [conversion=leftnumbers]

\starttext
\placecontent

\chapter{sample}
\dorecurse{10}{\section{text}}
\stoptext


The big problem is that in my RTL documents, I always have the
setupdirections command, which messes things up here.  (This makes it
difficult to one section name with English title, which should still be
typeset on the right-hand side of the page.)  Note that in attempt 2 above,
there were two issues:
(1) Text and numbers appeared on the two far ends of the screen instead of
being close to each other.  This does not happen when I use Farsi text.
(2) Chapter number appears to the left of section number.


%% Attempt 5
\usemodule[simplefonts]
\setmainfont[ALM Fixed][features=arabic,range=arabic]

\setupdirections[bidi=global,method=default]
\setupalign[r2l]

\starttext
\placecontent

\chapter{نمونه}
\dorecurse{10}{\section{متن}}
\stoptext


Interestingly the table of contents looks fine if I put the number inside
an LTR macro; still in the main body, the section heads are typeset
incorrectly.

%% Attempt 6
\usemodule[simplefonts]
\setmainfont[ALM Fixed][features=arabic,range=arabic]

\setupdirections[bidi=global,method=default]
\setupalign[r2l]

\def\LTR#1{{\lefttoright#1}}
\def\leftnumbers#1{\LTR{\numbers{#1}}}
\defineconversion[leftnumbers][\leftnumbers]
\setuphead[chapter,title,section,subject] [conversion=leftnumbers]

\starttext
\placecontent

\chapter{نمونه}
\dorecurse{10}{\section{متن}}
\stoptext


I guess the solution is to get the entire section head number string (e.g.,
1.10) to have RTL direction, however, each individual number string inside
(say, 1 or 10) should be written LTR.  How can this be achieved?

The six TeX files (with corresponding PDF outputs) are attached.

BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt: 2016.4.7
int: english/english, running LuaTeX, Version beta-0.90.0 (TeX Live 2016)
on Mac OS X.

Thanks a lot,
—MHB

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

[-- Attachment #2: rtl-section-head-tests.tgz --]
[-- Type: application/x-gzip, Size: 20708 bytes --]

[-- Attachment #3: 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] 13+ messages in thread

* Re: RTL section heads
  2016-04-08 21:20 RTL section heads Mohammad Hossein Bateni
@ 2016-04-11  2:25 ` Mohammad Hossein Bateni
  2016-04-11 14:46   ` Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-11  2:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hans Hagen, Wolfgang Schuster


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

Hans & Wolfgang,

Do you have suggestions here?  How can I get the behavior I want for the
section head numbers?

In fact, the following may be quite relevant.

\usemodule[simplefonts]
\setmainfont[ALM Fixed][features=arabic,range=arabic]

\setupdirections[bidi=global,method=default]
\setupalign[r2l]

\starttext

اعداد ۱، ۲، ۳ و ۴ را در نظر بگیرید.

اعداد 1، 2، 3 و 4 را در نظر بگیرید.

اعداد 1, 2, 3 و 4 را در نظر بگیرید.

\stoptext


I expect the numbers 1, 2, 3 and 4 to appear in the same order from right
to left.  However, the visual order that I observe (regardless of whether I
use Persian digits or English digits, or whether I use Persian or English
commas) is 4, 1, 2, 3 (from left to right).  Is this a bug in the bidi
code?  If so, are there any workarounds?

Thanks,
Hossein

On Fri, Apr 8, 2016 at 5:20 PM, Mohammad Hossein Bateni <bateni@gmail.com>
wrote:

> Hi,
>
> This is concerning an RTL text.  I have one chapter and 10 sections under
> that.  My goal is to achieve the following.
> 1) The number 10 should appear correctly with '1' visually to the left of
> '0'.
> 2) The chapter number should visually appear to the right of the section
> number.
> 3) Chapter and section numbers should be separated with a dash.  (This is
> ignored in this email and I will follow up about it in another thread.  To
> get a minimal working example, I also do not try to change the numbers to
> use Persian digits.)
>
> In particular, the headings will be visually something like the following
> (aligned to the right).
> elpmas 1
> txet 1-1
> txet 2-1
> txet 3-1
> ...
> txet 10-1
>
> Here's the first attempt.
>
> %% Attempt 1
> \setupalign[r2l]
>
> \starttext
> \placecontent
>
> \chapter{sample}
> \dorecurse{10}{\section{text}}
> \stoptext
>
> The result is:
> elpmas 1
> txet 1-1
> ...
> txet 01-1
>
>
> Then I add "\setupdirections[bidi=global,method=default]" to the beginning
> and I get the most strange result (number right-aligned but texts
> left-aligned):
> sample                                    1
> text                                       1.1
> ...
> text                                     1.10
>
>
> A third attempt gives almost what I want (without period as the separator).
>
> %% Attempt 3
> \setupalign[r2l]
>
> \def\LTR#1{{\lefttoright#1}}
> \def\leftnumbers#1{\LTR{\numbers{#1}}}
> \defineconversion[leftnumbers][\leftnumbers]
> \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>
> \starttext
> \placecontent
>
> \chapter{sample}
> \dorecurse{10}{\section{text}}
> \stoptext
>
>
> The big problem is that in my RTL documents, I always have the
> setupdirections command, which messes things up here.  (This makes it
> difficult to one section name with English title, which should still be
> typeset on the right-hand side of the page.)  Note that in attempt 2 above,
> there were two issues:
> (1) Text and numbers appeared on the two far ends of the screen instead of
> being close to each other.  This does not happen when I use Farsi text.
> (2) Chapter number appears to the left of section number.
>
>
> %% Attempt 5
> \usemodule[simplefonts]
> \setmainfont[ALM Fixed][features=arabic,range=arabic]
>
> \setupdirections[bidi=global,method=default]
> \setupalign[r2l]
>
> \starttext
> \placecontent
>
> \chapter{نمونه}
> \dorecurse{10}{\section{متن}}
> \stoptext
>
>
> Interestingly the table of contents looks fine if I put the number inside
> an LTR macro; still in the main body, the section heads are typeset
> incorrectly.
>
> %% Attempt 6
> \usemodule[simplefonts]
> \setmainfont[ALM Fixed][features=arabic,range=arabic]
>
> \setupdirections[bidi=global,method=default]
> \setupalign[r2l]
>
> \def\LTR#1{{\lefttoright#1}}
> \def\leftnumbers#1{\LTR{\numbers{#1}}}
> \defineconversion[leftnumbers][\leftnumbers]
> \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>
> \starttext
> \placecontent
>
> \chapter{نمونه}
> \dorecurse{10}{\section{متن}}
> \stoptext
>
>
> I guess the solution is to get the entire section head number string
> (e.g., 1.10) to have RTL direction, however, each individual number string
> inside (say, 1 or 10) should be written LTR.  How can this be achieved?
>
> The six TeX files (with corresponding PDF outputs) are attached.
>
> BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt: 2016.4.7
> int: english/english, running LuaTeX, Version beta-0.90.0 (TeX Live 2016)
> on Mac OS X.
>
> Thanks a lot,
> —MHB
>

[-- Attachment #1.2: Type: text/html, Size: 5796 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] 13+ messages in thread

* Re: RTL section heads
  2016-04-11  2:25 ` Mohammad Hossein Bateni
@ 2016-04-11 14:46   ` Hans Hagen
  2016-04-11 15:47     ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2016-04-11 14:46 UTC (permalink / raw)
  To: Mohammad Hossein Bateni, mailing list for ConTeXt users,
	Wolfgang Schuster

On 4/11/2016 4:25 AM, Mohammad Hossein Bateni wrote:
> Hans & Wolfgang,
>
> Do you have suggestions here?  How can I get the behavior I want for the
> section head numbers?
>
> In fact, the following may be quite relevant.
>
> \usemodule[simplefonts]
> \setmainfont[ALM Fixed][features=arabic,range=arabic]
>
> \setupdirections[bidi=global,method=default]
> \setupalign[r2l]
>
> \starttext
>
> اعداد ۱، ۲، ۳ و ۴ را در نظر بگیرید.
>
> اعداد 1، 2، 3 و 4 را در نظر بگیرید.
>
> اعداد 1, 2, 3 و 4 را در نظر بگیرید.
>
> \stoptext
>
>
> I expect the numbers 1, 2, 3 and 4 to appear in the same order from
> right to left.  However, the visual order that I observe (regardless of
> whether I use Persian digits or English digits, or whether I use Persian
> or English commas) is 4, 1, 2, 3 (from left to right).  Is this a bug in
> the bidi code?  If so, are there any workarounds?

method=two

> Thanks,
> Hossein
>
> On Fri, Apr 8, 2016 at 5:20 PM, Mohammad Hossein Bateni
> <bateni@gmail.com <mailto:bateni@gmail.com>> wrote:
>
>     Hi,
>
>     This is concerning an RTL text.  I have one chapter and 10 sections
>     under that.  My goal is to achieve the following.
>     1) The number 10 should appear correctly with '1' visually to the
>     left of '0'.
>     2) The chapter number should visually appear to the right of the
>     section number.
>     3) Chapter and section numbers should be separated with a dash.
>       (This is ignored in this email and I will follow up about it in
>     another thread.  To get a minimal working example, I also do not try
>     to change the numbers to use Persian digits.)
>
>     In particular, the headings will be visually something like the
>     following (aligned to the right).
>     elpmas 1
>     txet 1-1
>     txet 2-1
>     txet 3-1
>     ...
>     txet 10-1
>
>     Here's the first attempt.
>
>     %% Attempt 1
>     \setupalign[r2l]
>
>     \starttext
>     \placecontent
>
>     \chapter{sample}
>     \dorecurse{10}{\section{text}}
>     \stoptext
>
>     The result is:
>     elpmas 1
>     txet 1-1
>     ...
>     txet 01-1
>
>
>     Then I add "\setupdirections[bidi=global,method=default]" to the
>     beginning and I get the most strange result (number right-aligned
>     but texts left-aligned):
>     sample                                    1
>     text                                       1.1
>     ...
>     text                                     1.10
>
>
>     A third attempt gives almost what I want (without period as the
>     separator).
>
>     %% Attempt 3
>     \setupalign[r2l]
>
>     \def\LTR#1{{\lefttoright#1}}
>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>     \defineconversion[leftnumbers][\leftnumbers]
>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>
>     \starttext
>     \placecontent
>
>     \chapter{sample}
>     \dorecurse{10}{\section{text}}
>     \stoptext
>
>
>     The big problem is that in my RTL documents, I always have the
>     setupdirections command, which messes things up here.  (This makes
>     it difficult to one section name with English title, which should
>     still be typeset on the right-hand side of the page.)  Note that in
>     attempt 2 above, there were two issues:
>     (1) Text and numbers appeared on the two far ends of the screen
>     instead of being close to each other.  This does not happen when I
>     use Farsi text.
>     (2) Chapter number appears to the left of section number.
>
>
>     %% Attempt 5
>     \usemodule[simplefonts]
>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
>
>     \setupdirections[bidi=global,method=default]
>     \setupalign[r2l]
>
>     \starttext
>     \placecontent
>
>     \chapter{نمونه}
>     \dorecurse{10}{\section{متن}}
>     \stoptext
>
>
>     Interestingly the table of contents looks fine if I put the number
>     inside an LTR macro; still in the main body, the section heads are
>     typeset incorrectly.
>
>     %% Attempt 6
>     \usemodule[simplefonts]
>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
>
>     \setupdirections[bidi=global,method=default]
>     \setupalign[r2l]
>
>     \def\LTR#1{{\lefttoright#1}}
>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>     \defineconversion[leftnumbers][\leftnumbers]
>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>
>     \starttext
>     \placecontent
>
>     \chapter{نمونه}
>     \dorecurse{10}{\section{متن}}
>     \stoptext
>
>
>     I guess the solution is to get the entire section head number string
>     (e.g., 1.10) to have RTL direction, however, each individual number
>     string inside (say, 1 or 10) should be written LTR.  How can this be
>     achieved?
>
>     The six TeX files (with corresponding PDF outputs) are attached.
>
>     BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt:
>     2016.4.7 int: english/english, running LuaTeX, Version beta-0.90.0
>     (TeX Live 2016) on Mac OS X.
>
>     Thanks a lot,
>     —MHB
>
>


-- 

-----------------------------------------------------------------
                                           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] 13+ messages in thread

* Re: RTL section heads
  2016-04-11 14:46   ` Hans Hagen
@ 2016-04-11 15:47     ` Mohammad Hossein Bateni
  2016-04-13  0:46       ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 13+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-11 15:47 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


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

Thanks, Hans!  This does solve the problem with the list of numbers.  And
actually if I add a numberstyle field, I can the section heads the way I
like.  Here is the setup that worked.  (I will update Wiki later.)

\setupdirections[bidi=global,method=two]
\setupalign[r2l]

\def\LTR#1{{\lefttoright#1}}
\def\leftpersiandecimals#1{\LTR{\persiandecimals{#1}}}
\defineconversion[leftpersiandecimals][\leftpersiandecimals]
\setuphead[chapter,title,section,subject]
[conversion=leftpersiandecimals,numberstyle=\righttoleft]

\defineseparatorset[dashsep][-,-,-,-]
\setuphead[section][sectionseparatorset=dashsep]

On Mon, Apr 11, 2016 at 10:46 AM, Hans Hagen <pragma@wxs.nl> wrote:

> On 4/11/2016 4:25 AM, Mohammad Hossein Bateni wrote:
>
>> Hans & Wolfgang,
>>
>> Do you have suggestions here?  How can I get the behavior I want for the
>> section head numbers?
>>
>> In fact, the following may be quite relevant.
>>
>> \usemodule[simplefonts]
>> \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>
>> \setupdirections[bidi=global,method=default]
>> \setupalign[r2l]
>>
>> \starttext
>>
>> اعداد ۱، ۲، ۳ و ۴ را در نظر بگیرید.
>>
>> اعداد 1، 2، 3 و 4 را در نظر بگیرید.
>>
>> اعداد 1, 2, 3 و 4 را در نظر بگیرید.
>>
>> \stoptext
>>
>>
>> I expect the numbers 1, 2, 3 and 4 to appear in the same order from
>> right to left.  However, the visual order that I observe (regardless of
>> whether I use Persian digits or English digits, or whether I use Persian
>> or English commas) is 4, 1, 2, 3 (from left to right).  Is this a bug in
>> the bidi code?  If so, are there any workarounds?
>>
>
> method=two
>
> Thanks,
>> Hossein
>>
>> On Fri, Apr 8, 2016 at 5:20 PM, Mohammad Hossein Bateni
>> <bateni@gmail.com <mailto:bateni@gmail.com>> wrote:
>>
>>     Hi,
>>
>>     This is concerning an RTL text.  I have one chapter and 10 sections
>>     under that.  My goal is to achieve the following.
>>     1) The number 10 should appear correctly with '1' visually to the
>>     left of '0'.
>>     2) The chapter number should visually appear to the right of the
>>     section number.
>>     3) Chapter and section numbers should be separated with a dash.
>>       (This is ignored in this email and I will follow up about it in
>>     another thread.  To get a minimal working example, I also do not try
>>     to change the numbers to use Persian digits.)
>>
>>     In particular, the headings will be visually something like the
>>     following (aligned to the right).
>>     elpmas 1
>>     txet 1-1
>>     txet 2-1
>>     txet 3-1
>>     ...
>>     txet 10-1
>>
>>     Here's the first attempt.
>>
>>     %% Attempt 1
>>     \setupalign[r2l]
>>
>>     \starttext
>>     \placecontent
>>
>>     \chapter{sample}
>>     \dorecurse{10}{\section{text}}
>>     \stoptext
>>
>>     The result is:
>>     elpmas 1
>>     txet 1-1
>>     ...
>>     txet 01-1
>>
>>
>>     Then I add "\setupdirections[bidi=global,method=default]" to the
>>     beginning and I get the most strange result (number right-aligned
>>     but texts left-aligned):
>>     sample                                    1
>>     text                                       1.1
>>     ...
>>     text                                     1.10
>>
>>
>>     A third attempt gives almost what I want (without period as the
>>     separator).
>>
>>     %% Attempt 3
>>     \setupalign[r2l]
>>
>>     \def\LTR#1{{\lefttoright#1}}
>>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>>     \defineconversion[leftnumbers][\leftnumbers]
>>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>>
>>     \starttext
>>     \placecontent
>>
>>     \chapter{sample}
>>     \dorecurse{10}{\section{text}}
>>     \stoptext
>>
>>
>>     The big problem is that in my RTL documents, I always have the
>>     setupdirections command, which messes things up here.  (This makes
>>     it difficult to one section name with English title, which should
>>     still be typeset on the right-hand side of the page.)  Note that in
>>     attempt 2 above, there were two issues:
>>     (1) Text and numbers appeared on the two far ends of the screen
>>     instead of being close to each other.  This does not happen when I
>>     use Farsi text.
>>     (2) Chapter number appears to the left of section number.
>>
>>
>>     %% Attempt 5
>>     \usemodule[simplefonts]
>>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>
>>     \setupdirections[bidi=global,method=default]
>>     \setupalign[r2l]
>>
>>     \starttext
>>     \placecontent
>>
>>     \chapter{نمونه}
>>     \dorecurse{10}{\section{متن}}
>>     \stoptext
>>
>>
>>     Interestingly the table of contents looks fine if I put the number
>>     inside an LTR macro; still in the main body, the section heads are
>>     typeset incorrectly.
>>
>>     %% Attempt 6
>>     \usemodule[simplefonts]
>>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>
>>     \setupdirections[bidi=global,method=default]
>>     \setupalign[r2l]
>>
>>     \def\LTR#1{{\lefttoright#1}}
>>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>>     \defineconversion[leftnumbers][\leftnumbers]
>>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>>
>>     \starttext
>>     \placecontent
>>
>>     \chapter{نمونه}
>>     \dorecurse{10}{\section{متن}}
>>     \stoptext
>>
>>
>>     I guess the solution is to get the entire section head number string
>>     (e.g., 1.10) to have RTL direction, however, each individual number
>>     string inside (say, 1 or 10) should be written LTR.  How can this be
>>     achieved?
>>
>>     The six TeX files (with corresponding PDF outputs) are attached.
>>
>>     BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt:
>>     2016.4.7 int: english/english, running LuaTeX, Version beta-0.90.0
>>     (TeX Live 2016) on Mac OS X.
>>
>>     Thanks a lot,
>>     —MHB
>>
>>
>>
>
> --
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
> -----------------------------------------------------------------
>

[-- Attachment #1.2: Type: text/html, Size: 8102 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] 13+ messages in thread

* Re: RTL section heads
  2016-04-11 15:47     ` Mohammad Hossein Bateni
@ 2016-04-13  0:46       ` Mohammad Hossein Bateni
  2016-04-13  2:15         ` Otared Kavian
  0 siblings, 1 reply; 13+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-13  0:46 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


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

Unfortunately when I use method=two for bidi, the numbers in the main body
are written from right to left.  I'm starting to wonder whether it does
anything nontrivial at all.

\usemodule[simplefonts]
\setmainfont[ALM Fixed][features=arabic,range=arabic]

\setupdirections[bidi=global,method=two]
\setupalign[r2l]

\starttext

سال ۲۰۱۶

2016

\stoptext


I'm pretty sure this used to work (for example in version 2016.01.18
22:21).  A similar piece of code is working fine on the website
<http://wiki.contextgarden.net/RTL>.  I'm using CONTEXT version: 2016.04.01
13:01.  I also verified that it is not working in version: 2016.04.10 23:52.

On Mon, Apr 11, 2016 at 11:47 AM, Mohammad Hossein Bateni <bateni@gmail.com>
wrote:

> Thanks, Hans!  This does solve the problem with the list of numbers.  And
> actually if I add a numberstyle field, I can the section heads the way I
> like.  Here is the setup that worked.  (I will update Wiki later.)
>
> \setupdirections[bidi=global,method=two]
> \setupalign[r2l]
>
> \def\LTR#1{{\lefttoright#1}}
> \def\leftpersiandecimals#1{\LTR{\persiandecimals{#1}}}
> \defineconversion[leftpersiandecimals][\leftpersiandecimals]
> \setuphead[chapter,title,section,subject]
> [conversion=leftpersiandecimals,numberstyle=\righttoleft]
>
> \defineseparatorset[dashsep][-,-,-,-]
> \setuphead[section][sectionseparatorset=dashsep]
>
> On Mon, Apr 11, 2016 at 10:46 AM, Hans Hagen <pragma@wxs.nl> wrote:
>
>> On 4/11/2016 4:25 AM, Mohammad Hossein Bateni wrote:
>>
>>> Hans & Wolfgang,
>>>
>>> Do you have suggestions here?  How can I get the behavior I want for the
>>> section head numbers?
>>>
>>> In fact, the following may be quite relevant.
>>>
>>> \usemodule[simplefonts]
>>> \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>>
>>> \setupdirections[bidi=global,method=default]
>>> \setupalign[r2l]
>>>
>>> \starttext
>>>
>>> اعداد ۱، ۲، ۳ و ۴ را در نظر بگیرید.
>>>
>>> اعداد 1، 2، 3 و 4 را در نظر بگیرید.
>>>
>>> اعداد 1, 2, 3 و 4 را در نظر بگیرید.
>>>
>>> \stoptext
>>>
>>>
>>> I expect the numbers 1, 2, 3 and 4 to appear in the same order from
>>> right to left.  However, the visual order that I observe (regardless of
>>> whether I use Persian digits or English digits, or whether I use Persian
>>> or English commas) is 4, 1, 2, 3 (from left to right).  Is this a bug in
>>> the bidi code?  If so, are there any workarounds?
>>>
>>
>> method=two
>>
>> Thanks,
>>> Hossein
>>>
>>> On Fri, Apr 8, 2016 at 5:20 PM, Mohammad Hossein Bateni
>>> <bateni@gmail.com <mailto:bateni@gmail.com>> wrote:
>>>
>>>     Hi,
>>>
>>>     This is concerning an RTL text.  I have one chapter and 10 sections
>>>     under that.  My goal is to achieve the following.
>>>     1) The number 10 should appear correctly with '1' visually to the
>>>     left of '0'.
>>>     2) The chapter number should visually appear to the right of the
>>>     section number.
>>>     3) Chapter and section numbers should be separated with a dash.
>>>       (This is ignored in this email and I will follow up about it in
>>>     another thread.  To get a minimal working example, I also do not try
>>>     to change the numbers to use Persian digits.)
>>>
>>>     In particular, the headings will be visually something like the
>>>     following (aligned to the right).
>>>     elpmas 1
>>>     txet 1-1
>>>     txet 2-1
>>>     txet 3-1
>>>     ...
>>>     txet 10-1
>>>
>>>     Here's the first attempt.
>>>
>>>     %% Attempt 1
>>>     \setupalign[r2l]
>>>
>>>     \starttext
>>>     \placecontent
>>>
>>>     \chapter{sample}
>>>     \dorecurse{10}{\section{text}}
>>>     \stoptext
>>>
>>>     The result is:
>>>     elpmas 1
>>>     txet 1-1
>>>     ...
>>>     txet 01-1
>>>
>>>
>>>     Then I add "\setupdirections[bidi=global,method=default]" to the
>>>     beginning and I get the most strange result (number right-aligned
>>>     but texts left-aligned):
>>>     sample                                    1
>>>     text                                       1.1
>>>     ...
>>>     text                                     1.10
>>>
>>>
>>>     A third attempt gives almost what I want (without period as the
>>>     separator).
>>>
>>>     %% Attempt 3
>>>     \setupalign[r2l]
>>>
>>>     \def\LTR#1{{\lefttoright#1}}
>>>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>>>     \defineconversion[leftnumbers][\leftnumbers]
>>>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>>>
>>>     \starttext
>>>     \placecontent
>>>
>>>     \chapter{sample}
>>>     \dorecurse{10}{\section{text}}
>>>     \stoptext
>>>
>>>
>>>     The big problem is that in my RTL documents, I always have the
>>>     setupdirections command, which messes things up here.  (This makes
>>>     it difficult to one section name with English title, which should
>>>     still be typeset on the right-hand side of the page.)  Note that in
>>>     attempt 2 above, there were two issues:
>>>     (1) Text and numbers appeared on the two far ends of the screen
>>>     instead of being close to each other.  This does not happen when I
>>>     use Farsi text.
>>>     (2) Chapter number appears to the left of section number.
>>>
>>>
>>>     %% Attempt 5
>>>     \usemodule[simplefonts]
>>>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>>
>>>     \setupdirections[bidi=global,method=default]
>>>     \setupalign[r2l]
>>>
>>>     \starttext
>>>     \placecontent
>>>
>>>     \chapter{نمونه}
>>>     \dorecurse{10}{\section{متن}}
>>>     \stoptext
>>>
>>>
>>>     Interestingly the table of contents looks fine if I put the number
>>>     inside an LTR macro; still in the main body, the section heads are
>>>     typeset incorrectly.
>>>
>>>     %% Attempt 6
>>>     \usemodule[simplefonts]
>>>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>>
>>>     \setupdirections[bidi=global,method=default]
>>>     \setupalign[r2l]
>>>
>>>     \def\LTR#1{{\lefttoright#1}}
>>>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>>>     \defineconversion[leftnumbers][\leftnumbers]
>>>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>>>
>>>     \starttext
>>>     \placecontent
>>>
>>>     \chapter{نمونه}
>>>     \dorecurse{10}{\section{متن}}
>>>     \stoptext
>>>
>>>
>>>     I guess the solution is to get the entire section head number string
>>>     (e.g., 1.10) to have RTL direction, however, each individual number
>>>     string inside (say, 1 or 10) should be written LTR.  How can this be
>>>     achieved?
>>>
>>>     The six TeX files (with corresponding PDF outputs) are attached.
>>>
>>>     BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt:
>>>     2016.4.7 int: english/english, running LuaTeX, Version beta-0.90.0
>>>     (TeX Live 2016) on Mac OS X.
>>>
>>>     Thanks a lot,
>>>     —MHB
>>>
>>>
>>>
>>
>> --
>>
>> -----------------------------------------------------------------
>>                                           Hans Hagen | PRAGMA ADE
>>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
>> -----------------------------------------------------------------
>>
>
>

[-- Attachment #1.2: Type: text/html, Size: 9340 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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13  0:46       ` Mohammad Hossein Bateni
@ 2016-04-13  2:15         ` Otared Kavian
  2016-04-13  2:59           ` Mohammad Hossein Bateni
  2016-04-13  7:20           ` Hans Hagen
  0 siblings, 2 replies; 13+ messages in thread
From: Otared Kavian @ 2016-04-13  2:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans and Mohammad Reza,

I can confirm that the wrong behaviour of numbers and digits in Right to Left (more specifically Persian) is recent: indeed with 

	ConTeXt  ver: 2015.05.18 12:26 MKIV current  fmt: 2015.6.18  int: english/english

from TeXLive 2015 the numbers and digits are rendered as they should. Is it related to some changes in LuaTeX?

Best regards: OK

> On 13 Apr 2016, at 02:46, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
> 
> Unfortunately when I use method=two for bidi, the numbers in the main body are written from right to left.  I'm starting to wonder whether it does anything nontrivial at all.
> 
> \usemodule[simplefonts]
> \setmainfont[ALM Fixed][features=arabic,range=arabic]
> 
> \setupdirections[bidi=global,method=two]
> \setupalign[r2l]
> 
> \starttext
> 
> سال ۲۰۱۶
> 
> 2016
> 
> \stoptext
> 
> 
> I'm pretty sure this used to work (for example in version 2016.01.18 22:21).  A similar piece of code is working fine on the website.  I'm using CONTEXT version: 2016.04.01 13:01.  I also verified that it is not working in version: 2016.04.10 23:52.
> 
> On Mon, Apr 11, 2016 at 11:47 AM, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
> Thanks, Hans!  This does solve the problem with the list of numbers.  And actually if I add a numberstyle field, I can the section heads the way I like.  Here is the setup that worked.  (I will update Wiki later.)
> 
> \setupdirections[bidi=global,method=two]
> \setupalign[r2l]
> 
> \def\LTR#1{{\lefttoright#1}}
> \def\leftpersiandecimals#1{\LTR{\persiandecimals{#1}}}
> \defineconversion[leftpersiandecimals][\leftpersiandecimals]
> \setuphead[chapter,title,section,subject] [conversion=leftpersiandecimals,numberstyle=\righttoleft]
> 
> \defineseparatorset[dashsep][-,-,-,-]
> \setuphead[section][sectionseparatorset=dashsep]
> 
> On Mon, Apr 11, 2016 at 10:46 AM, Hans Hagen <pragma@wxs.nl> wrote:
> On 4/11/2016 4:25 AM, Mohammad Hossein Bateni wrote:
> Hans & Wolfgang,
> 
> Do you have suggestions here?  How can I get the behavior I want for the
> section head numbers?
> 
> In fact, the following may be quite relevant.
> 
> \usemodule[simplefonts]
> \setmainfont[ALM Fixed][features=arabic,range=arabic]
> 
> \setupdirections[bidi=global,method=default]
> \setupalign[r2l]
> 
> \starttext
> 
> اعداد ۱، ۲، ۳ و ۴ را در نظر بگیرید.
> 
> اعداد 1، 2، 3 و 4 را در نظر بگیرید.
> 
> اعداد 1, 2, 3 و 4 را در نظر بگیرید.
> 
> \stoptext
> 
> 
> I expect the numbers 1, 2, 3 and 4 to appear in the same order from
> right to left.  However, the visual order that I observe (regardless of
> whether I use Persian digits or English digits, or whether I use Persian
> or English commas) is 4, 1, 2, 3 (from left to right).  Is this a bug in
> the bidi code?  If so, are there any workarounds?
> 
> method=two
> 
> Thanks,
> Hossein
> 
> On Fri, Apr 8, 2016 at 5:20 PM, Mohammad Hossein Bateni
> <bateni@gmail.com <mailto:bateni@gmail.com>> wrote:
> 
>     Hi,
> 
>     This is concerning an RTL text.  I have one chapter and 10 sections
>     under that.  My goal is to achieve the following.
>     1) The number 10 should appear correctly with '1' visually to the
>     left of '0'.
>     2) The chapter number should visually appear to the right of the
>     section number.
>     3) Chapter and section numbers should be separated with a dash.
>       (This is ignored in this email and I will follow up about it in
>     another thread.  To get a minimal working example, I also do not try
>     to change the numbers to use Persian digits.)
> 
>     In particular, the headings will be visually something like the
>     following (aligned to the right).
>     elpmas 1
>     txet 1-1
>     txet 2-1
>     txet 3-1
>     ...
>     txet 10-1
> 
>     Here's the first attempt.
> 
>     %% Attempt 1
>     \setupalign[r2l]
> 
>     \starttext
>     \placecontent
> 
>     \chapter{sample}
>     \dorecurse{10}{\section{text}}
>     \stoptext
> 
>     The result is:
>     elpmas 1
>     txet 1-1
>     ...
>     txet 01-1
> 
> 
>     Then I add "\setupdirections[bidi=global,method=default]" to the
>     beginning and I get the most strange result (number right-aligned
>     but texts left-aligned):
>     sample                                    1
>     text                                       1.1
>     ...
>     text                                     1.10
> 
> 
>     A third attempt gives almost what I want (without period as the
>     separator).
> 
>     %% Attempt 3
>     \setupalign[r2l]
> 
>     \def\LTR#1{{\lefttoright#1}}
>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>     \defineconversion[leftnumbers][\leftnumbers]
>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
> 
>     \starttext
>     \placecontent
> 
>     \chapter{sample}
>     \dorecurse{10}{\section{text}}
>     \stoptext
> 
> 
>     The big problem is that in my RTL documents, I always have the
>     setupdirections command, which messes things up here.  (This makes
>     it difficult to one section name with English title, which should
>     still be typeset on the right-hand side of the page.)  Note that in
>     attempt 2 above, there were two issues:
>     (1) Text and numbers appeared on the two far ends of the screen
>     instead of being close to each other.  This does not happen when I
>     use Farsi text.
>     (2) Chapter number appears to the left of section number.
> 
> 
>     %% Attempt 5
>     \usemodule[simplefonts]
>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
> 
>     \setupdirections[bidi=global,method=default]
>     \setupalign[r2l]
> 
>     \starttext
>     \placecontent
> 
>     \chapter{نمونه}
>     \dorecurse{10}{\section{متن}}
>     \stoptext
> 
> 
>     Interestingly the table of contents looks fine if I put the number
>     inside an LTR macro; still in the main body, the section heads are
>     typeset incorrectly.
> 
>     %% Attempt 6
>     \usemodule[simplefonts]
>     \setmainfont[ALM Fixed][features=arabic,range=arabic]
> 
>     \setupdirections[bidi=global,method=default]
>     \setupalign[r2l]
> 
>     \def\LTR#1{{\lefttoright#1}}
>     \def\leftnumbers#1{\LTR{\numbers{#1}}}
>     \defineconversion[leftnumbers][\leftnumbers]
>     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
> 
>     \starttext
>     \placecontent
> 
>     \chapter{نمونه}
>     \dorecurse{10}{\section{متن}}
>     \stoptext
> 
> 
>     I guess the solution is to get the entire section head number string
>     (e.g., 1.10) to have RTL direction, however, each individual number
>     string inside (say, 1 or 10) should be written LTR.  How can this be
>     achieved?
> 
>     The six TeX files (with corresponding PDF outputs) are attached.
> 
>     BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt:
>     2016.4.7 int: english/english, running LuaTeX, Version beta-0.90.0
>     (TeX Live 2016) on Mac OS X.
> 
>     Thanks a lot,
>     —MHB
> 
> 
> 
> 
> -- 
> 
> -----------------------------------------------------------------
>                                           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
> ___________________________________________________________________________________

___________________________________________________________________________________
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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13  2:15         ` Otared Kavian
@ 2016-04-13  2:59           ` Mohammad Hossein Bateni
  2016-04-13 14:56             ` Hans Hagen
  2016-04-13  7:20           ` Hans Hagen
  1 sibling, 1 reply; 13+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-13  2:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

As far as I remember, it was working fine with betas in December 2015 and
January 2016.

On Tue, Apr 12, 2016 at 10:15 PM, Otared Kavian <otared@gmail.com> wrote:

> Hi Hans and Mohammad Reza,
>
> I can confirm that the wrong behaviour of numbers and digits in Right to
> Left (more specifically Persian) is recent: indeed with
>
>         ConTeXt  ver: 2015.05.18 12:26 MKIV current  fmt: 2015.6.18  int:
> english/english
>
> from TeXLive 2015 the numbers and digits are rendered as they should. Is
> it related to some changes in LuaTeX?
>
> Best regards: OK
>
> > On 13 Apr 2016, at 02:46, Mohammad Hossein Bateni <bateni@gmail.com>
> wrote:
> >
> > Unfortunately when I use method=two for bidi, the numbers in the main
> body are written from right to left.  I'm starting to wonder whether it
> does anything nontrivial at all.
> >
> > \usemodule[simplefonts]
> > \setmainfont[ALM Fixed][features=arabic,range=arabic]
> >
> > \setupdirections[bidi=global,method=two]
> > \setupalign[r2l]
> >
> > \starttext
> >
> > سال ۲۰۱۶
> >
> > 2016
> >
> > \stoptext
> >
> >
> > I'm pretty sure this used to work (for example in version 2016.01.18 22:21).
> A similar piece of code is working fine on the website.  I'm using CONTEXT
> version: 2016.04.01 13:01.  I also verified that it is not working in
> version: 2016.04.10 23:52.
> >
> > On Mon, Apr 11, 2016 at 11:47 AM, Mohammad Hossein Bateni <
> bateni@gmail.com> wrote:
> > Thanks, Hans!  This does solve the problem with the list of numbers.
> And actually if I add a numberstyle field, I can the section heads the way
> I like.  Here is the setup that worked.  (I will update Wiki later.)
> >
> > \setupdirections[bidi=global,method=two]
> > \setupalign[r2l]
> >
> > \def\LTR#1{{\lefttoright#1}}
> > \def\leftpersiandecimals#1{\LTR{\persiandecimals{#1}}}
> > \defineconversion[leftpersiandecimals][\leftpersiandecimals]
> > \setuphead[chapter,title,section,subject]
> [conversion=leftpersiandecimals,numberstyle=\righttoleft]
> >
> > \defineseparatorset[dashsep][-,-,-,-]
> > \setuphead[section][sectionseparatorset=dashsep]
> >
> > On Mon, Apr 11, 2016 at 10:46 AM, Hans Hagen <pragma@wxs.nl> wrote:
> > On 4/11/2016 4:25 AM, Mohammad Hossein Bateni wrote:
> > Hans & Wolfgang,
> >
> > Do you have suggestions here?  How can I get the behavior I want for the
> > section head numbers?
> >
> > In fact, the following may be quite relevant.
> >
> > \usemodule[simplefonts]
> > \setmainfont[ALM Fixed][features=arabic,range=arabic]
> >
> > \setupdirections[bidi=global,method=default]
> > \setupalign[r2l]
> >
> > \starttext
> >
> > اعداد ۱، ۲، ۳ و ۴ را در نظر بگیرید.
> >
> > اعداد 1، 2، 3 و 4 را در نظر بگیرید.
> >
> > اعداد 1, 2, 3 و 4 را در نظر بگیرید.
> >
> > \stoptext
> >
> >
> > I expect the numbers 1, 2, 3 and 4 to appear in the same order from
> > right to left.  However, the visual order that I observe (regardless of
> > whether I use Persian digits or English digits, or whether I use Persian
> > or English commas) is 4, 1, 2, 3 (from left to right).  Is this a bug in
> > the bidi code?  If so, are there any workarounds?
> >
> > method=two
> >
> > Thanks,
> > Hossein
> >
> > On Fri, Apr 8, 2016 at 5:20 PM, Mohammad Hossein Bateni
> > <bateni@gmail.com <mailto:bateni@gmail.com>> wrote:
> >
> >     Hi,
> >
> >     This is concerning an RTL text.  I have one chapter and 10 sections
> >     under that.  My goal is to achieve the following.
> >     1) The number 10 should appear correctly with '1' visually to the
> >     left of '0'.
> >     2) The chapter number should visually appear to the right of the
> >     section number.
> >     3) Chapter and section numbers should be separated with a dash.
> >       (This is ignored in this email and I will follow up about it in
> >     another thread.  To get a minimal working example, I also do not try
> >     to change the numbers to use Persian digits.)
> >
> >     In particular, the headings will be visually something like the
> >     following (aligned to the right).
> >     elpmas 1
> >     txet 1-1
> >     txet 2-1
> >     txet 3-1
> >     ...
> >     txet 10-1
> >
> >     Here's the first attempt.
> >
> >     %% Attempt 1
> >     \setupalign[r2l]
> >
> >     \starttext
> >     \placecontent
> >
> >     \chapter{sample}
> >     \dorecurse{10}{\section{text}}
> >     \stoptext
> >
> >     The result is:
> >     elpmas 1
> >     txet 1-1
> >     ...
> >     txet 01-1
> >
> >
> >     Then I add "\setupdirections[bidi=global,method=default]" to the
> >     beginning and I get the most strange result (number right-aligned
> >     but texts left-aligned):
> >     sample                                    1
> >     text                                       1.1
> >     ...
> >     text                                     1.10
> >
> >
> >     A third attempt gives almost what I want (without period as the
> >     separator).
> >
> >     %% Attempt 3
> >     \setupalign[r2l]
> >
> >     \def\LTR#1{{\lefttoright#1}}
> >     \def\leftnumbers#1{\LTR{\numbers{#1}}}
> >     \defineconversion[leftnumbers][\leftnumbers]
> >     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
> >
> >     \starttext
> >     \placecontent
> >
> >     \chapter{sample}
> >     \dorecurse{10}{\section{text}}
> >     \stoptext
> >
> >
> >     The big problem is that in my RTL documents, I always have the
> >     setupdirections command, which messes things up here.  (This makes
> >     it difficult to one section name with English title, which should
> >     still be typeset on the right-hand side of the page.)  Note that in
> >     attempt 2 above, there were two issues:
> >     (1) Text and numbers appeared on the two far ends of the screen
> >     instead of being close to each other.  This does not happen when I
> >     use Farsi text.
> >     (2) Chapter number appears to the left of section number.
> >
> >
> >     %% Attempt 5
> >     \usemodule[simplefonts]
> >     \setmainfont[ALM Fixed][features=arabic,range=arabic]
> >
> >     \setupdirections[bidi=global,method=default]
> >     \setupalign[r2l]
> >
> >     \starttext
> >     \placecontent
> >
> >     \chapter{نمونه}
> >     \dorecurse{10}{\section{متن}}
> >     \stoptext
> >
> >
> >     Interestingly the table of contents looks fine if I put the number
> >     inside an LTR macro; still in the main body, the section heads are
> >     typeset incorrectly.
> >
> >     %% Attempt 6
> >     \usemodule[simplefonts]
> >     \setmainfont[ALM Fixed][features=arabic,range=arabic]
> >
> >     \setupdirections[bidi=global,method=default]
> >     \setupalign[r2l]
> >
> >     \def\LTR#1{{\lefttoright#1}}
> >     \def\leftnumbers#1{\LTR{\numbers{#1}}}
> >     \defineconversion[leftnumbers][\leftnumbers]
> >     \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
> >
> >     \starttext
> >     \placecontent
> >
> >     \chapter{نمونه}
> >     \dorecurse{10}{\section{متن}}
> >     \stoptext
> >
> >
> >     I guess the solution is to get the entire section head number string
> >     (e.g., 1.10) to have RTL direction, however, each individual number
> >     string inside (say, 1 or 10) should be written LTR.  How can this be
> >     achieved?
> >
> >     The six TeX files (with corresponding PDF outputs) are attached.
> >
> >     BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt:
> >     2016.4.7 int: english/english, running LuaTeX, Version beta-0.90.0
> >     (TeX Live 2016) on Mac OS X.
> >
> >     Thanks a lot,
> >     —MHB
> >
> >
> >
> >
> > --
> >
> > -----------------------------------------------------------------
> >                                           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
> >
> ___________________________________________________________________________________
>
>
> ___________________________________________________________________________________
> 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: 12632 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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13  2:15         ` Otared Kavian
  2016-04-13  2:59           ` Mohammad Hossein Bateni
@ 2016-04-13  7:20           ` Hans Hagen
  1 sibling, 0 replies; 13+ messages in thread
From: Hans Hagen @ 2016-04-13  7:20 UTC (permalink / raw)
  To: ntg-context

On 4/13/2016 4:15 AM, Otared Kavian wrote:
> Hi Hans and Mohammad Reza,
>
> I can confirm that the wrong behaviour of numbers and digits in Right to Left (more specifically Persian) is recent: indeed with
>
> 	ConTeXt  ver: 2015.05.18 12:26 MKIV current  fmt: 2015.6.18  int: english/english
>
> from TeXLive 2015 the numbers and digits are rendered as they should. Is it related to some changes in LuaTeX?

maybe a bug .. i'll check it

> Best regards: OK
>
>> On 13 Apr 2016, at 02:46, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
>>
>> Unfortunately when I use method=two for bidi, the numbers in the main body are written from right to left.  I'm starting to wonder whether it does anything nontrivial at all.
>>
>> \usemodule[simplefonts]
>> \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>
>> \setupdirections[bidi=global,method=two]
>> \setupalign[r2l]
>>
>> \starttext
>>
>> سال ۲۰۱۶
>>
>> 2016
>>
>> \stoptext
>>
>>
>> I'm pretty sure this used to work (for example in version 2016.01.18 22:21).  A similar piece of code is working fine on the website.  I'm using CONTEXT version: 2016.04.01 13:01.  I also verified that it is not working in version: 2016.04.10 23:52.
>>
>> On Mon, Apr 11, 2016 at 11:47 AM, Mohammad Hossein Bateni <bateni@gmail.com> wrote:
>> Thanks, Hans!  This does solve the problem with the list of numbers.  And actually if I add a numberstyle field, I can the section heads the way I like.  Here is the setup that worked.  (I will update Wiki later.)
>>
>> \setupdirections[bidi=global,method=two]
>> \setupalign[r2l]
>>
>> \def\LTR#1{{\lefttoright#1}}
>> \def\leftpersiandecimals#1{\LTR{\persiandecimals{#1}}}
>> \defineconversion[leftpersiandecimals][\leftpersiandecimals]
>> \setuphead[chapter,title,section,subject] [conversion=leftpersiandecimals,numberstyle=\righttoleft]
>>
>> \defineseparatorset[dashsep][-,-,-,-]
>> \setuphead[section][sectionseparatorset=dashsep]
>>
>> On Mon, Apr 11, 2016 at 10:46 AM, Hans Hagen <pragma@wxs.nl> wrote:
>> On 4/11/2016 4:25 AM, Mohammad Hossein Bateni wrote:
>> Hans & Wolfgang,
>>
>> Do you have suggestions here?  How can I get the behavior I want for the
>> section head numbers?
>>
>> In fact, the following may be quite relevant.
>>
>> \usemodule[simplefonts]
>> \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>
>> \setupdirections[bidi=global,method=default]
>> \setupalign[r2l]
>>
>> \starttext
>>
>> اعداد ۱، ۲، ۳ و ۴ را در نظر بگیرید.
>>
>> اعداد 1، 2، 3 و 4 را در نظر بگیرید.
>>
>> اعداد 1, 2, 3 و 4 را در نظر بگیرید.
>>
>> \stoptext
>>
>>
>> I expect the numbers 1, 2, 3 and 4 to appear in the same order from
>> right to left.  However, the visual order that I observe (regardless of
>> whether I use Persian digits or English digits, or whether I use Persian
>> or English commas) is 4, 1, 2, 3 (from left to right).  Is this a bug in
>> the bidi code?  If so, are there any workarounds?
>>
>> method=two
>>
>> Thanks,
>> Hossein
>>
>> On Fri, Apr 8, 2016 at 5:20 PM, Mohammad Hossein Bateni
>> <bateni@gmail.com <mailto:bateni@gmail.com>> wrote:
>>
>>      Hi,
>>
>>      This is concerning an RTL text.  I have one chapter and 10 sections
>>      under that.  My goal is to achieve the following.
>>      1) The number 10 should appear correctly with '1' visually to the
>>      left of '0'.
>>      2) The chapter number should visually appear to the right of the
>>      section number.
>>      3) Chapter and section numbers should be separated with a dash.
>>        (This is ignored in this email and I will follow up about it in
>>      another thread.  To get a minimal working example, I also do not try
>>      to change the numbers to use Persian digits.)
>>
>>      In particular, the headings will be visually something like the
>>      following (aligned to the right).
>>      elpmas 1
>>      txet 1-1
>>      txet 2-1
>>      txet 3-1
>>      ...
>>      txet 10-1
>>
>>      Here's the first attempt.
>>
>>      %% Attempt 1
>>      \setupalign[r2l]
>>
>>      \starttext
>>      \placecontent
>>
>>      \chapter{sample}
>>      \dorecurse{10}{\section{text}}
>>      \stoptext
>>
>>      The result is:
>>      elpmas 1
>>      txet 1-1
>>      ...
>>      txet 01-1
>>
>>
>>      Then I add "\setupdirections[bidi=global,method=default]" to the
>>      beginning and I get the most strange result (number right-aligned
>>      but texts left-aligned):
>>      sample                                    1
>>      text                                       1.1
>>      ...
>>      text                                     1.10
>>
>>
>>      A third attempt gives almost what I want (without period as the
>>      separator).
>>
>>      %% Attempt 3
>>      \setupalign[r2l]
>>
>>      \def\LTR#1{{\lefttoright#1}}
>>      \def\leftnumbers#1{\LTR{\numbers{#1}}}
>>      \defineconversion[leftnumbers][\leftnumbers]
>>      \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>>
>>      \starttext
>>      \placecontent
>>
>>      \chapter{sample}
>>      \dorecurse{10}{\section{text}}
>>      \stoptext
>>
>>
>>      The big problem is that in my RTL documents, I always have the
>>      setupdirections command, which messes things up here.  (This makes
>>      it difficult to one section name with English title, which should
>>      still be typeset on the right-hand side of the page.)  Note that in
>>      attempt 2 above, there were two issues:
>>      (1) Text and numbers appeared on the two far ends of the screen
>>      instead of being close to each other.  This does not happen when I
>>      use Farsi text.
>>      (2) Chapter number appears to the left of section number.
>>
>>
>>      %% Attempt 5
>>      \usemodule[simplefonts]
>>      \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>
>>      \setupdirections[bidi=global,method=default]
>>      \setupalign[r2l]
>>
>>      \starttext
>>      \placecontent
>>
>>      \chapter{نمونه}
>>      \dorecurse{10}{\section{متن}}
>>      \stoptext
>>
>>
>>      Interestingly the table of contents looks fine if I put the number
>>      inside an LTR macro; still in the main body, the section heads are
>>      typeset incorrectly.
>>
>>      %% Attempt 6
>>      \usemodule[simplefonts]
>>      \setmainfont[ALM Fixed][features=arabic,range=arabic]
>>
>>      \setupdirections[bidi=global,method=default]
>>      \setupalign[r2l]
>>
>>      \def\LTR#1{{\lefttoright#1}}
>>      \def\leftnumbers#1{\LTR{\numbers{#1}}}
>>      \defineconversion[leftnumbers][\leftnumbers]
>>      \setuphead[chapter,title,section,subject] [conversion=leftnumbers]
>>
>>      \starttext
>>      \placecontent
>>
>>      \chapter{نمونه}
>>      \dorecurse{10}{\section{متن}}
>>      \stoptext
>>
>>
>>      I guess the solution is to get the entire section head number string
>>      (e.g., 1.10) to have RTL direction, however, each individual number
>>      string inside (say, 1 or 10) should be written LTR.  How can this be
>>      achieved?
>>
>>      The six TeX files (with corresponding PDF outputs) are attached.
>>
>>      BTW this is using ConTeXt ver: 2016.04.01 13:01 MKIV beta fmt:
>>      2016.4.7 int: english/english, running LuaTeX, Version beta-0.90.0
>>      (TeX Live 2016) on Mac OS X.
>>
>>      Thanks a lot,
>>      —MHB
>>
>>
>>
>>
>> --
>>
>> -----------------------------------------------------------------
>>                                            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
>> ___________________________________________________________________________________
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13  2:59           ` Mohammad Hossein Bateni
@ 2016-04-13 14:56             ` Hans Hagen
  2016-04-13 15:14               ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2016-04-13 14:56 UTC (permalink / raw)
  To: ntg-context

On 4/13/2016 4:59 AM, Mohammad Hossein Bateni wrote:
> As far as I remember, it was working fine with betas in December 2015
> and January 2016.

i uploaded a new beta


-----------------------------------------------------------------
                                           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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13 14:56             ` Hans Hagen
@ 2016-04-13 15:14               ` Mohammad Hossein Bateni
  2016-04-13 16:41                 ` Pablo Rodriguez
  2016-04-14  8:19                 ` Hans Hagen
  0 siblings, 2 replies; 13+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-13 15:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I updated my context standalone but it gives me current version: 2016.
*04.10* 23:52, which is buggy.  This is from 3 days ago.

On Wed, Apr 13, 2016 at 10:56 AM, Hans Hagen <pragma@wxs.nl> wrote:

> On 4/13/2016 4:59 AM, Mohammad Hossein Bateni wrote:
>
>> As far as I remember, it was working fine with betas in December 2015
>> and January 2016.
>>
>
> i uploaded a new beta
>
>
>
> -----------------------------------------------------------------
>                                           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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 2401 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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13 15:14               ` Mohammad Hossein Bateni
@ 2016-04-13 16:41                 ` Pablo Rodriguez
  2016-04-13 16:56                   ` Mohammad Hossein Bateni
  2016-04-14  8:19                 ` Hans Hagen
  1 sibling, 1 reply; 13+ messages in thread
From: Pablo Rodriguez @ 2016-04-13 16:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 04/13/2016 05:14 PM, Mohammad Hossein Bateni wrote:
> I updated my context standalone but it gives me current version:
> 2016.*_04.10_* 23:52, which is buggy.  This is from 3 days ago.

The server is experiencing some issues
(https://mailman.ntg.nl/pipermail/ntg-context/2016/084979.html).


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13 16:41                 ` Pablo Rodriguez
@ 2016-04-13 16:56                   ` Mohammad Hossein Bateni
  0 siblings, 0 replies; 13+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-13 16:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Thanks, Hans!  The update worked (current version: 2016.04.13 16:46) and
the RTL problem seems gone.

On Wed, Apr 13, 2016 at 12:41 PM, Pablo Rodriguez <oinos@gmx.es> wrote:

> On 04/13/2016 05:14 PM, Mohammad Hossein Bateni wrote:
> > I updated my context standalone but it gives me current version:
> > 2016.*_04.10_* 23:52, which is buggy.  This is from 3 days ago.
>
> The server is experiencing some issues
> (https://mailman.ntg.nl/pipermail/ntg-context/2016/084979.html).
>
>
> Pablo
> --
> http://www.ousia.tk
>
> ___________________________________________________________________________________
> 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: 2118 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] 13+ messages in thread

* Re: RTL section heads
  2016-04-13 15:14               ` Mohammad Hossein Bateni
  2016-04-13 16:41                 ` Pablo Rodriguez
@ 2016-04-14  8:19                 ` Hans Hagen
  1 sibling, 0 replies; 13+ messages in thread
From: Hans Hagen @ 2016-04-14  8:19 UTC (permalink / raw)
  To: ntg-context

On 4/13/2016 5:14 PM, Mohammad Hossein Bateni wrote:
> I updated my context standalone but it gives me current version:
> 2016.*_04.10_* 23:52, which is buggy.  This is from 3 days ago.

the garden is being reinstalled / updates but you can get the zip from 
the website and unpack it in the right spot

Hans

-----------------------------------------------------------------
                                           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] 13+ messages in thread

end of thread, other threads:[~2016-04-14  8:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08 21:20 RTL section heads Mohammad Hossein Bateni
2016-04-11  2:25 ` Mohammad Hossein Bateni
2016-04-11 14:46   ` Hans Hagen
2016-04-11 15:47     ` Mohammad Hossein Bateni
2016-04-13  0:46       ` Mohammad Hossein Bateni
2016-04-13  2:15         ` Otared Kavian
2016-04-13  2:59           ` Mohammad Hossein Bateni
2016-04-13 14:56             ` Hans Hagen
2016-04-13 15:14               ` Mohammad Hossein Bateni
2016-04-13 16:41                 ` Pablo Rodriguez
2016-04-13 16:56                   ` Mohammad Hossein Bateni
2016-04-14  8:19                 ` Hans Hagen
2016-04-13  7:20           ` 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).