[NTG-context] r2l alignment and linenumbering conflict?

talazem at fastmail.fm talazem at fastmail.fm
Tue Aug 4 05:46:57 CEST 2015


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
=========

-------------- next part --------------
A non-text attachment was scrubbed...
Name: num-ar.pdf
Type: application/pdf
Size: 13479 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150804/302eb58d/attachment-0001.pdf>
-------------- next part --------------


> On 3 Aug 2015, at 17:52, talazem at 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 at 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 at wxs.nl> wrote:
>>> 
>>> On 8/3/2015 3:54 PM, talazem at 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 at 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 at 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 at 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
> ___________________________________________________________________________________



More information about the ntg-context mailing list