From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/94354 Path: news.gmane.org!not-for-mail From: Mohammad Hossein Bateni Newsgroups: gmane.comp.tex.context Subject: Re: RTL section heads Date: Sun, 10 Apr 2016 22:25:31 -0400 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1939041054966107532==" X-Trace: ger.gmane.org 1460341637 19284 80.91.229.3 (11 Apr 2016 02:27:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Apr 2016 02:27:17 +0000 (UTC) To: mailing list for ConTeXt users , Hans Hagen , Wolfgang Schuster Original-X-From: ntg-context-bounces@ntg.nl Mon Apr 11 04:27:13 2016 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1apRZE-0004qa-Kt for gctc-ntg-context-518@m.gmane.org; Mon, 11 Apr 2016 04:27:08 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C9C09A210; Mon, 11 Apr 2016 04:25:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JjJhHvniEQDk; Mon, 11 Apr 2016 04:25:49 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id E66CFA213; Mon, 11 Apr 2016 04:25:49 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C3AF5A209 for ; Mon, 11 Apr 2016 04:25:48 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Z4egVoRc9kN for ; Mon, 11 Apr 2016 04:25:44 +0200 (CEST) Original-Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 9FCEEA1F9 for ; Mon, 11 Apr 2016 04:25:33 +0200 (CEST) Original-Received: by mail-oi0-f49.google.com with SMTP id p188so191929408oih.2 for ; Sun, 10 Apr 2016 19:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=dqPd1iF8jrvlfITaNNAu7MHWQkxOUMle6arr8IbgH00=; b=lvBLRhTj18zJhtXkbF8ToIHyJvxEAjKsfLvJXbiS3jhc1H00TNm4f2q73qBkZR1DDV PFicrD9Eq1QrU4Yc47+uJqd1LRi8Q/JeBhigxrn4Ujbqh0e+ZBSz0NL6csQ2i/qK9mFP kXd6Z8TDciPTmsrSR+DKEOlCwxRD6lismdiWZf7Jr4ALVrvanOXmKs1l+e2EyiSK4NQC UGAq8VOOF9usnwM0dz7o9ZhJU/B6VhWbzIr6kMwuB8EftwT3qhd+4A/WxbOlTRfdwziV C8JRtD2X8jUqemqI2XjAh8BANO1BBXM3GjCqnk1PXiRclZ/iubr0Jop/uHhRpYeE6oXX jc/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=dqPd1iF8jrvlfITaNNAu7MHWQkxOUMle6arr8IbgH00=; b=XX/LRqaPVnqTn+GH9pd2aDJHPpPSnubABM14G02Wa0KOasGAfwM1sab84qMUTmLBx8 om90jbW4SfRLupUN1VXKLU/U9J/dogg2gE6hxbkgdLYemSdwIP8Fh4CqeuFCxSLAHy7r rx6GhcuM8IrWFHAztgI4hSVdUOM+YePBjWhnrNUH3zzbEh1vKct15m5rWA3QV0zkHav8 SGYSQNM9PG33S0eTlTfwuj5qQEAwRwGZYGY7mfQGw8brDbFfVQgPOBgQbhHMmtU5UQZ7 jBuoMSB+Kltm71mabGrZ5iiZf0yodMnx5WK9da67UAGKiy8IV64q1lpInjV3IfNaKE1Z PlZQ== X-Gm-Message-State: AD7BkJKLSpBDcBMd83rEOtTnnqzcBHCzo4j8L+03+PQ6OZ8zR+OgEkh1LdSu9T/YgMQ59KtLt5bJr5NH6RAH2w== X-Received: by 10.157.36.3 with SMTP id p3mr9357797ota.62.1460341531904; Sun, 10 Apr 2016 19:25:31 -0700 (PDT) Original-Received: by 10.202.188.134 with HTTP; Sun, 10 Apr 2016 19:25:31 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:94354 Archived-At: --===============1939041054966107532== Content-Type: multipart/alternative; boundary=001a1147b38e42907a05302c429b --001a1147b38e42907a05302c429b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=3Darabic,range=3Darabic] \setupdirections[bidi=3Dglobal,method=3Ddefault] \setupalign[r2l] \starttext =D8=A7=D8=B9=D8=AF=D8=A7=D8=AF =DB=B1=D8=8C =DB=B2=D8=8C =DB=B3 =D9=88 =DB= =B4 =D8=B1=D8=A7 =D8=AF=D8=B1 =D9=86=D8=B8=D8=B1 =D8=A8=DA=AF=DB=8C=D8=B1= =DB=8C=D8=AF. =D8=A7=D8=B9=D8=AF=D8=A7=D8=AF 1=D8=8C 2=D8=8C 3 =D9=88 4 =D8=B1=D8=A7 =D8= =AF=D8=B1 =D9=86=D8=B8=D8=B1 =D8=A8=DA=AF=DB=8C=D8=B1=DB=8C=D8=AF. =D8=A7=D8=B9=D8=AF=D8=A7=D8=AF 1, 2, 3 =D9=88 4 =D8=B1=D8=A7 =D8=AF=D8=B1 = =D9=86=D8=B8=D8=B1 =D8=A8=DA=AF=DB=8C=D8=B1=DB=8C=D8=AF. \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 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. T= o > 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=3Dglobal,method=3Ddefault]" to the begi= nning > 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=3Dleftnumbers] > > \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 abov= e, > there were two issues: > (1) Text and numbers appeared on the two far ends of the screen instead o= f > 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=3Darabic,range=3Darabic] > > \setupdirections[bidi=3Dglobal,method=3Ddefault] > \setupalign[r2l] > > \starttext > \placecontent > > \chapter{=D9=86=D9=85=D9=88=D9=86=D9=87} > \dorecurse{10}{\section{=D9=85=D8=AA=D9=86}} > \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=3Darabic,range=3Darabic] > > \setupdirections[bidi=3Dglobal,method=3Ddefault] > \setupalign[r2l] > > \def\LTR#1{{\lefttoright#1}} > \def\leftnumbers#1{\LTR{\numbers{#1}}} > \defineconversion[leftnumbers][\leftnumbers] > \setuphead[chapter,title,section,subject] [conversion=3Dleftnumbers] > > \starttext > \placecontent > > \chapter{=D9=86=D9=85=D9=88=D9=86=D9=87} > \dorecurse{10}{\section{=D9=85=D8=AA=D9=86}} > \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 strin= g > 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, > =E2=80=94MHB > --001a1147b38e42907a05302c429b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hans & Wolfgang,

Do you have sugges= tions here?=C2=A0 How can I get the behavior I want for the section head nu= mbers?

In fact, the following may be quite relevan= t.

\usemodule[simplefonts]
\setmainfont[ALM Fixed][features=3Da= rabic,range=3Darabic]

\setupdirections[bidi=3Dglobal,method=3Ddefaul= t]
\setupalign[r2l]

\starttext

=D8=A7=D8=B9=D8=AF=D8=A7=D8= =AF =DB=B1=D8=8C =DB=B2=D8=8C =DB=B3 =D9=88 =DB=B4 =D8=B1=D8=A7 =D8=AF=D8= =B1 =D9=86=D8=B8=D8=B1 =D8=A8=DA=AF=DB=8C=D8=B1=DB=8C=D8=AF.

=D8=A7= =D8=B9=D8=AF=D8=A7=D8=AF 1=D8=8C 2=D8=8C 3 =D9=88 4 =D8=B1=D8=A7 =D8=AF=D8= =B1 =D9=86=D8=B8=D8=B1 =D8=A8=DA=AF=DB=8C=D8=B1=DB=8C=D8=AF.

=D8=A7= =D8=B9=D8=AF=D8=A7=D8=AF 1, 2, 3 =D9=88 4 =D8=B1=D8=A7 =D8=AF=D8=B1 =D9=86= =D8=B8=D8=B1 =D8=A8=DA=AF=DB=8C=D8=B1=DB=8C=D8=AF.

\stoptext

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

Thanks,
Hossein

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

This i= s concerning an RTL text.=C2=A0 I have one chapter and 10 sections under th= at.=C2=A0 My goal is to achieve the following.
1) The number 10 s= hould appear correctly with '1' visually to the left of '0'= .
2) The chapter number should visually appear to the right of th= e section number.
3) Chapter and section numbers should be separa= ted with a dash. =C2=A0(This is ignored in this email and I will follow up = about it in another thread.=C2=A0 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 foll= owing (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 i= s:
elpmas 1
txet 1-1
...
txet = 01-1


Then I add "\setupd= irections[bidi=3Dglobal,method=3Ddefault]" to the beginning and I get = the most strange result (number right-aligned but texts left-aligned):
sample =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01
= text =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1.1
...
text =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1= .10


A third attempt gives almos= t what I want (without period as the separator).

%% Att= empt 3
\setupalign[r2l]

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

\starttext
\place= content

\chapter{sample}
\dorecurse{10}{\sectio= n{text}}
\stoptext


The big p= roblem is that in my RTL documents, I always have the setupdirections comma= nd, which messes things up here. =C2=A0(This makes it difficult to one sect= ion name with English title, which should still be typeset on the right-han= d side of the page.) =C2=A0Note that in attempt 2 above, there were two iss= ues:
(1) Text and numbers appeared on the two far ends of the scr= een instead of being close to each other.=C2=A0 This does not happen when I= use Farsi text.
(2) Chapter number appears to the left of sectio= n number.


%% Attempt 5
\u= semodule[simplefonts]
\setmainfont[ALM Fixed][features=3Darabic,range=3D= arabic]

\setupdirections[bidi=3Dglobal,method=3Ddefault]
\se= tupalign[r2l]

\starttext
\placecontent

\chapter{=D9=86= =D9=85=D9=88=D9=86=D9=87}
\dorecurse{10}{\section{=D9=85=D8=AA=D9=86}}\stoptext


Inter= estingly 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.<= /div>

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

\setupdirections[= bidi=3Dglobal,method=3Ddefault]
\setupalign[r2l]

\def\LTR#1{{\le= fttoright#1}}
\def\leftnumbers#1{\LTR{\numbers{#1}}}
\defineconversio= n[leftnumbers][\leftnumbers]
\setuphead[chapter,title,section,subject] [= conversion=3Dleftnumbers]

\starttext
\placecontent

\chapt= er{=D9=86=D9=85=D9=88=D9=86=D9=87}
\dorecurse{10}{\section{=D9=85=D8=AA= =D9=86}}
\stoptext


I guess the solutio= n 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) sho= uld be written LTR.=C2=A0 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 (Te= X Live 2016) on Mac OS X.

Thanks a lot,
= =E2=80=94MHB

--001a1147b38e42907a05302c429b-- --===============1939041054966107532== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============1939041054966107532==--