ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "talazem@fastmail.fm" <talazem@fastmail.fm>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: r2l alignment and linenumbering conflict?
Date: Tue, 4 Aug 2015 04:46:57 +0100	[thread overview]
Message-ID: <30722134-227C-43CB-AD9F-9EE49E83506B@fastmail.fm> (raw)
In-Reply-To: <E8289FA4-2FBA-4850-B9CA-CC36972696EF@fastmail.fm>

[-- Attachment #1: Type: text/plain, Size: 3649 bytes --]

Hans, the beta is a solid step forward regarding bidi and Arabic support, and not just in footnotes. Thank you.

However, it appears that my earlier declarations of ‘problem solved’ were a bit premature.  Footnotes display everything correctly, but not linenumber notes. Using the three bidi methods of \setupdirections[bidi]:

- ‘default’ orders the linenumber notes and their texts right-to-left, but any number therein is reversed (4102 instead of 2014).

- ‘one’ does not render either the note block nor the individual notes' texts right-to-left.

- ‘two’ is identical to method ‘one’.

Compare these to regular footnotes, where everything is rendered correctly as of this new beta.

Below is a minimal example with resulting PDF output.

Talal

=========
%%% LANGUAGE FONTS BIDI
\mainlanguage[arabic]	
\definefontfamily [mainface] [rm] [ALM Fixed] [range=arabic,features=arabic]	   
\setupbodyfont[mainface,11pt]

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

%% HEADINGS
\setuppagenumber[numberconversion=arabicdecimals]

%%%	NOTES

\definenote[footnote][% Used for my comments in English.
	setups=note:footnote,
	align=righttoleft,
	rule={on,right},
	paragraph=yes,
	]

\setupnotations[footnote][%
	align=righttoleft,
	alternative=serried,
	width=broad,
	distance=.5em,
	display=no,
	numberconversion=arabicdecimals,
	headstyle=\lefttoright,
	]

\setuplinenumbering[%
	style=\tfxx,
	referencing=on,
	step=1,
	location=outer,
	method=page,
	align=left,
	distance=1em,
	width=0.4em,
	conversion=arabicdecimals,
	]

\definelinenote[linenotedefault][%
	setups=note:linenotedefault,
	align=righttoleft,
	rule={on,right},
	paragraph=yes,
	]
\setupnotations[linenotedefault][% 
	align=righttoleft,
	alternative=serried,
	width=broad,
	distance=.5em,
	display=no,
	numberconversion=arabicdecimals,
	headstyle=\lefttoright,
	]

\definelinenote[linenoteone][%
	setups=note:linenoteone,
	align=righttoleft,
	rule={on,right},
	paragraph=yes,
	]
\setupnotations[linenoteone][% 
	align=righttoleft,
	alternative=serried,
	width=broad,
	distance=.5em,
	display=no,
	numberconversion=arabicdecimals,
	headstyle=\lefttoright,
	]

\definelinenote[linenotetwo][%
	setups=note:linenotetwo,
	align=righttoleft,
	rule={on,right},
	paragraph=yes,
	]
\setupnotations[linenotetwo][% 
	align=righttoleft,
	alternative=serried,
	width=broad,
	distance=.5em,
	display=no,
	numberconversion=arabicdecimals,
	headstyle=\lefttoright,
	]

\startsetups[note:footnote] 
	\setupdirections[bidi=on,method=two,fences=no] 
\stopsetups

\startsetups[note:linenotedefault]
	\setupdirections[bidi=on,method=default]
\stopsetups

\startsetups[note:linenoteone]
	\setupdirections[bidi=on,method=one]
\stopsetups

\startsetups[note:linenotetwo]
	\setupdirections[bidi=on,method=two] 
\stopsetups

%%% DOCUMENT

\starttext \showframe 

\startlinenumbering
\input ward\footnote{هذه تعليقة أولى كتبت عام ٢٠١٤.}
\input ward\footnote{هذه تعليقة ثانية (٢٠١٤).}
\input ward\linenotedefault{هذه تعليقة أولى كتبت عام ٢٠١٤.}
\input ward\linenotedefault{هذه تعليقة ثانية (٢٠١٤).}
\input ward\linenoteone{هذه تعليقة أولى كتبت عام ٢٠١٤.}
\input ward\linenoteone{هذه تعليقة ثانية (٢٠١٤).}
\input ward\linenotetwo{هذه تعليقة أولى كتبت عام ٢٠١٤.}
\input ward\linenotetwo{هذه تعليقة ثانية (٢٠١٤).}
\stoplinenumbering
\stoptext

\stoptext
=========


[-- Attachment #2: num-ar.pdf --]
[-- Type: application/pdf, Size: 13479 bytes --]

[-- Attachment #3: Type: text/plain, Size: 7376 bytes --]



> On 3 Aug 2015, at 17:52, talazem@fastmail.fm wrote:
> 
> Well, I don’t know if ‘solves’ the underlying questions that Hans wrote about, but after some more fiddling, I now have all the numbers appearing as I expect them to.
> 
> It required specifying `method=two` as part of `\setupdirections[bidi=global,method=two]`. That, along with the 	`numbercommand=\righttoleft` in \setuphead[section], means that it now looks as I expect it to.
> 
> Unless someone identifies a problem with any of this, I think I’ll write up a summary on the Wiki. Without trolling through the mailing list for anything on RTL and then experimenting with the various combinations, it would be hard for one to divine how to get this to work.
> 
> For posterity’s sake, here is a full MWE example:
> 
> ======
> %%% LANGUAGE AND FONTS
> \mainlanguage[arabic]	
> \definefontfamily [mainface] [rm] [ALM Fixed][range=arabic,features=arabic]	   
> \setupbodyfont[mainface,12pt]
> 
> \setupdirections[bidi=global,method=two]
> \setupalign[r2l]
> %\righttoleft
> 
> %% HEADINGS
> 
> \setuphead[section][
> 	conversion=myconversion,
> 	numbercommand=\righttoleft, % <-- toggle
> 	]
> \setuplinenumbering[conversion=myconversion]
> \setupnotations[footnote][numberconversion=myconversion]
> \setupnotations[linenote][numberconversion=myconversion]
> \setuppagenumber[numberconversion=myconversion]
> 
> \defineconversion
> 	[myconversion]
> [١,٢,٣,٤,٥,٦,٧,٨,٩,١٠,
> ١١,١٢,١٣,١٤,١٥,١٦,١٧,١٨,١٩,٢٠,
> ۲۱,۲۲,۲۳,۲٤,۲٥,۲٦,۲۷,۲۸,۲۹,۳۰,
> ٣١,٣٢,٣٣,٣٤,٣٥,٣٦,٣٧,٣٨,٣٩,٤٠,
> ٤١,٤٢,٤٣,٤٤,٤٥,٤٦,٤٧,٤٨,٤٩,٥٠,
> ٥١,٥٢,٥٣,٥٤,٥٥,٥٦,٥٧,٥٨,٥٩,٦٠,
> ٦١,٦٢,٦٣,٦٤,٦٥,٦٦,٦٧,٦٨,٦٩,٧٠,
> ٧١,٧٢,٧٣,٧٤,٧٥,٧٦,٧٧,٧٨,٧٩,٨٠,
> ٨١,٨٢,٨٣,٨٤,٨٥,٨٦,٨٧,٨٨,٨٩,٩٠,
> ٩١,٩٢,٩٣,٩٤,٩٥,٩٦,٩٧,٩٨,٩٩,١٠٠,
> ١٠١,١٠٢,١٠٣,١٠٤,١٠٥,١٠٦,١٠٧,١٠٨,١٠٩,١١٠,
> ١١١,١١٢,١١٣,١١٤,١١٥,١١٦,١١٧,١١٨,١١٩,١٢٠,
> ١٢١,١٢٢,١٢٣,١٢٤,١٢٥,١٢٦,١٢٧,١٢٨,١٢٩,١٣٠,
> ١٣١,١٣٢,١٣٣,١٣٤,١٣٥,١٣٦,١٣٧,١٣٨,١٣٩,١١٣٠,
> ١٤١,١٤٢,١٤٣,١٤٤,١٤٥,١٤٦,١٤٧,١٤٨,١٤٩,١٥٠,
> ١٥١,١٥٢,١٥٣,١٥٤,١٥٥,١٥٦,١٥٧,١٥٨,١٥٩,١٦٠,
> ١٦١,١٦٢,١٦٣,١٦٤,١٦٥,١٦٦,١٦٧,١٦٨,١٦٩,١٧٠,
> ١٧١,١٧٢,١٧٣,١٧٤,١٧٥,١٧٦,١٧٧,١٧٨,١٧٩,١٨٠,
> ١٨١,١٨٢,١٨٣,١٨٤,١٨٥,١٨٦,١٨٧,١٨٨,١٨٩,١٩٠,
> ١٩١,١٩٢,١٩٣,١٩٤,١٩٥,١٩٦,١٩٧,١٩٨,١٩٩,٢٠٠,
> ٢٠١,٢٠٢,٢٠٣,٢٠٤,٢٠٥,٢٠٦,٢٠٧,٢٠٨,٢٠٩,٢١٠,
> ٢١١,٢١٢,٢١٣,٢١٤,٢١٥,٢١٦,٢١٧,٢١٨,٢١٩,٢٢٠,
> ٢٢١,٢٢٢,٢٢٣,٢٢٤,٢٢٥,٢٢٦,٢٢٧,٢٢٨,٢٢٩,٢٣٠,
> ٢٣١,٢٣٢,٢٣٣,٢٣٤,٢٣٥,٢٣٦,٢٣٧,٢٣٨,٢٣٩,٢٢٣٠,
> ٢٤١,٢٤٢,٢٤٣,٢٤٤,٢٤٥,٢٤٦,٢٤٧,٢٤٨,٢٤٩,٢٥٠,
> ٢٥١,٢٥٢,٢٥٣,٢٥٤,٢٥٥,٢٥٦,٢٥٧,٢٥٨,٢٥٩,٢٦٠,
> ٢٦١,٢٦٢,٢٦٣,٢٦٤,٢٦٥,٢٦٦,٢٦٧,٢٦٨,٢٦٩,٢٧٠,
> ٢٧١,٢٧٢,٢٧٣,٢٧٤,٢٧٥,٢٧٦,٢٧٧,٢٧٨,٢٧٩,٢٨٠,
> ٢٨١,٢٨٢,٢٨٣,٢٨٤,٢٨٥,٢٨٦,٢٨٧,٢٨٨,٢٨٩,٢٩٠,
> ٢٩١,٢٩٢,٢٩٣,٢٩٤,٢٩٥,٢٩٦,٢٩٧,٢٩٨,٢٩٩,٣٠٠,
> ]
> 
> %%% DOCUMENT
> 
> \starttext \showframe 
> 
> \section{section one}
> 
> \startlinenumbering
> \input tufte
> \input tufte
> \stoplinenumbering
> 
> \dorecurse{20}{
> \section{محمد الجمل (١٨٧٢—١٩٢٣)}
> 	مرحباً باعالم . ١٢٣٤٥٦٧٨٩٠ مرحباً بالعالم. ولد عام ١٩٣٤.
> \footnote{تعليقة لطيفة.}
> \pagebreak
> }
> 
> \stoptext
> ======
> 
> Best wishes,
> Talal
> 
>> On 3 Aug 2015, at 17:29, talazem@fastmail.fm wrote:
>> 
>> Just to note: all numbers in the body text are having their digits placed individually right-to-left. Notice, in the attached PDF, how the ١٤ is displayed as ٤١, and how ١٨٧٢ is ٢٧٨١ … but also the footnote marker is ٣١ instead of ١٣ as it correctly is below in the footnote itself.
>> 
>> Is there any temporary work around for this, until we sort out the underlying causes?
>> 
>> Talal
>> 
>> <PastedGraphic-1.pdf>
>>> On 3 Aug 2015, at 16:19, Hans Hagen <pragma@wxs.nl> wrote:
>>> 
>>> On 8/3/2015 3:54 PM, talazem@fastmail.fm wrote:
>>>> I am having problems with the directionality of numbers and mirrored
>>>> characters (like parentheses). When using bidi, the numbers are inverted
>>>> (5102 instead of 2015); with the explicit commands, the mirrored
>>>> characters are inverted as well.
>>> 
>>> we have several approaches:
>>> 
>>> the oldest method is based on some heuristics and targets at tex input in the sense that we assume tagging and directional switches
>>> 
>>> the other two are unicode bidi based (successive versions and there might be more as that evolves)
>>> 
>>> in any case, everything bidi / rl has to fit into some system and that's something idris and i are working on (well, we did at some point but we need to pick up that thread) ... so maybe you can trigger idris into onthology mode and help him
>>> 
>>> Hans
>>> 
>>> 
>>> -----------------------------------------------------------------
>>>                                        Hans Hagen | PRAGMA ADE
>>>            Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>>  tel: 038 477 53 69 | voip: 087 875 68 74 | 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
>> ___________________________________________________________________________________
> 
> ___________________________________________________________________________________
> 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 #4: 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:[~2015-08-04  3:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 15:30 talazem
2015-08-01 15:37 ` talazem
2015-08-01 18:04   ` Pablo Rodriguez
2015-08-01 18:35   ` Idris Samawi Hamid ادريس سماوي حامد
2015-08-01 18:47   ` Wolfgang Schuster
2015-08-02  9:24     ` talazem
2015-08-02 11:51       ` Idris Samawi Hamid ادريس سماوي حامد
2015-08-02 13:31         ` talazem
2015-08-02 17:15           ` Idris Samawi Hamid ادريس سماوي حامد
2015-08-02 20:46             ` talazem
2015-08-03 13:54             ` talazem
2015-08-03 14:56               ` Hans Hagen
2015-08-03 15:13                 ` Hans Hagen
2015-08-03 15:42                   ` Idris Samawi Hamid ادريس سماوي حامد
2015-08-03 15:56                     ` Hans Hagen
2015-08-03 16:17                       ` Idris Samawi Hamid ادريس سماوي حامد
2015-08-03 16:06                     ` Idris Samawi Hamid ادريس سماوي حامد
2015-08-03 19:25                 ` Otared Kavian
2015-08-03 23:30                   ` Hans Hagen
2015-08-04 16:25                     ` Otared Kavian
2015-08-03 15:19               ` Hans Hagen
2015-08-03 16:29                 ` talazem
2015-08-03 16:52                   ` talazem
2015-08-04  3:46                     ` talazem [this message]
2015-08-04 21:06                       ` 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=30722134-227C-43CB-AD9F-9EE49E83506B@fastmail.fm \
    --to=talazem@fastmail.fm \
    --cc=ntg-context@ntg.nl \
    /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).