ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mohammad Hossein Bateni <bateni@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Hans Hagen <pragma@wxs.nl>,
	 Wolfgang Schuster <schuster.wolfgang@gmail.com>
Subject: Re: RTL section heads
Date: Sun, 10 Apr 2016 22:25:31 -0400	[thread overview]
Message-ID: <CAMHZ1dYCNZt110XSbckX9+sqQLga1nhO=icuwyv+QpFtmxr_4Q@mail.gmail.com> (raw)
In-Reply-To: <CAMHZ1dajFFa+bRLK_9RBXXHqBPKN1BRAz1Q4PWkGTn-M+tYy0A@mail.gmail.com>


[-- 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
___________________________________________________________________________________

  reply	other threads:[~2016-04-11  2:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 21:20 Mohammad Hossein Bateni
2016-04-11  2:25 ` Mohammad Hossein Bateni [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMHZ1dYCNZt110XSbckX9+sqQLga1nhO=icuwyv+QpFtmxr_4Q@mail.gmail.com' \
    --to=bateni@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.nl \
    --cc=schuster.wolfgang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).