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: footnotes when using RtL (Arabic)
Date: Fri, 31 Jul 2015 12:07:45 +0100	[thread overview]
Message-ID: <D7440195-E8A1-44A7-A013-598EE94D33F8@fastmail.fm> (raw)
In-Reply-To: <55BB342F.8070203@wxs.nl>

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

Excellent. This seems to solve the problem completely. I even tried mixing Arabic and English text in the RTL footnotes, switched on the “alternative=serried” option, and defined my own custom note streams — everything worked very well. The only thing that didn’t work is to mix, in the same stream, footnotes that are LTR with footnotes that are RTL. But I did not expect this to work, and I cannot think of a real world scenario in which such footnotes would/should be mixed in the same stream.

Attached are both the .tex file and the PDF with a perfectly working example. Many thanks to you both, Wolfgang and Hans. Hans, I assume we’ll know if the patch eventually makes it into a beta? 

Best,
Talal


[-- Attachment #2: RTL-paragraphed-footnotes.tex --]
[-- Type: application/octet-stream, Size: 3027 bytes --]

%%% Wolfgang & Hans' patch for R2L paragraphed footnotes (as of 20150731)
\unprotect

\unexpanded\def\leftorrightvbox{\ifconditional\displaylefttoright\expandafter\lefttorightvbox\else\expandafter\righttoleftvbox\fi}

\def\strc_notes_flush_global
 {\begingroup
  \useinterlinespaceparameter\noteparameter
  \doifelse{\noteparameter\c!paragraph}\v!yes
    {\leftorrightvbox
       {\starthboxestohbox
\iftrialtypesetting\unvcopy\else\unvbox\fi\currentnoteinsertionnumber
        \stophboxestohbox}}
{\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}%
  \endgroup}

\protect

%%% FONTS
\definefontfamily[mainface][serif][ALMFixed][%
	features=arabic,
	range=arabic,
	]
\setupbodyfont [mainface]

%%% BIDI

\setupdirections[bidi=global]

\startsetups[note:footnote]
  \setupdirections[bidi=global]
\stopsetups

\setupalign[r2l]

%%% FOOTNOTES

\setupnote[footnote][%
	setups=note:footnote,
	align=righttoleft,
	rule={on,right},
	paragraph=yes,
	]

\setupnotation[footnote][%
	align=righttoleft,
	alternative=serried,
	width=broad,
	distance=.5em,
	]

\definenote[afootnote][%
	setups=note:footnote, 
	align=righttoleft,
	rule={on,right},
	paragraph=yes,
	frame=on,framecolor=yellow,
	]
\setupnotations[afootnote][%s
	align=righttoleft,
	alternative=serried,
	width=broad,
	distance=.5em,
	display=no,
	]

\definenote[bfootnote][%
%	setups=note:footnote,
	paragraph=yes,
	frame=on,framecolor=yellow,
	]
\setupnotations[bfootnote][%s
	alternative=serried,
	width=broad,
	distance=.5em,
	display=no,
	]
	
%%% COMMANDS & BLOCKS

\definestartstop[arabik][%
	before={\blank\startalignment[r2l]},
	after={\stopalignment\blank},
	]

\definestartstop[english][%
	before={\blank\startalignment[l2r]},
	after={\stopalignment\blank},
	]

%%% THE DOCUMENT

\showframe

\starttext


\section{Arabic with default footnote stream}


هذه رسالة مني إليك. I wish you could read it. ولكنها مكتوبة بالعربية.
\footnote{
	هذه (تعليقة) أولى.
I wish you could read it.
ولكنها مكتوبة بالعربية.
}
فانتهيت.
\footnote{هذه (تعليقة) ثانية.}


\section{Arabic with custom afootnote stream}

هذه رسالة لطيفة ألفها العالم الكبير الفهامة النحرير.
\afootnote{وهذه هي التعليقة الأولى (وهي طويلة) إلا أنها ليست صحيحة.}
هذه رسالة جامعة مانعة ألفها الشيخ الفاضل الرَّحلة.
\afootnote{هذه تعليقة (ثانية).}


\startenglish

\section{English with custom bfootnote stream}

This is MY LTR sentence with a regular, LTR footnote.\bfootnote{This is a custom bfootnote. Notice how the serried spacing is working nicely in this footnote but also in the R2L ones above.}
This, also, is LTR sentence with a regular footnote.\bfootnote{This is the second custom bfootnote.}

\stopenglish

\stoptext

[-- Attachment #3: RTL-paragraphed-footnotes.pdf --]
[-- Type: application/pdf, Size: 14537 bytes --]

[-- Attachment #4: Type: text/plain, Size: 4010 bytes --]



> On 31 Jul 2015, at 09:39, Hans Hagen <pragma@wxs.nl> wrote:
> 
> On 7/31/2015 1:51 AM, talazem@fastmail.fm wrote:
>> You’re right. The patch gets us half way to the desired behaviour
>> (namely, correct ordering of the footnotes within the paragraph). But it
>> seems that the ‘paragraph’ option doesn’t play well with RTL generally,
>> resulting in the second note disappearing when using
>> \startsetups[note:footnote] \setupdirections[bidi=global] \stopsetups.
> 
> can you try
> 
> \unprotect
> 
> \unexpanded\def\leftorrightvbox{\ifconditional\displaylefttoright\expandafter\lefttorightvbox\else\expandafter\righttoleftvbox\fi}
> 
> \def\strc_notes_flush_global
>  {\begingroup
>   \useinterlinespaceparameter\noteparameter
>   \doifelse{\noteparameter\c!paragraph}\v!yes
>     {\leftorrightvbox
>        {\starthboxestohbox
> \iftrialtypesetting\unvcopy\else\unvbox\fi\currentnoteinsertionnumber
>         \stophboxestohbox}}
> {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}%
>   \endgroup}
> 
> \protect
> 
> 
>>> On 30 Jul 2015, at 20:04, Wolfgang Schuster
>>> <schuster.wolfgang@gmail.com <mailto:schuster.wolfgang@gmail.com>> wrote:
>>> 
>>>> talazem@fastmail.fm <mailto:talazem@fastmail.fm>
>>>> 30. Juli 2015 20:37
>>>> I’ve come across a snag. When using parentheses in Arabic footnotes, they are flipped. In any earlier email (http://article.gmane.org/gmane.comp.tex.context/91501/match=setupdirections+bidi+global), you had advised adding the following:
>>>> 
>>>>> \startsetups[note:footnote]
>>>>>   \setupdirections[bidi=global]
>>>>> \stopsetups
>>>>> 
>>>>> \setupnote[footnote][setups=note:footnote] % align=righttoleft
>>>> However, if one does this with your patch, the second footnote gets dropped. Here is the MWE:
>>>> 
>>> The second note disappears even without the patch, the problem this
>>> the paragraph option for the notes.
>>> 
>>> Wolfgang
>>> ___________________________________________________________________________________
>>> If your question is of interest to others as well, please add an entry
>>> to the Wiki!
>>> 
>>> maillist : ntg-context@ntg.nl <mailto: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 | 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
> ___________________________________________________________________________________


[-- Attachment #5: 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-07-31 11:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 19:56 talazem
2015-07-30 13:00 ` talazem
2015-07-30 14:26   ` Pablo Rodriguez
2015-07-30 14:43     ` talazem
2015-07-30 15:08       ` Pablo Rodriguez
2015-07-30 17:54     ` Wolfgang Schuster
2015-07-30 18:15       ` Idris Samawi Hamid ادريس سماوي حامد
2015-07-30 18:17       ` talazem
2015-07-30 18:18       ` Pablo Rodriguez
2015-07-30 18:37       ` talazem
2015-07-30 19:04         ` Wolfgang Schuster
2015-07-30 23:51           ` talazem
2015-07-31  8:39             ` Hans Hagen
2015-07-31 11:07               ` talazem [this message]
2015-07-31 12:05                 ` Idris Samawi Hamid ادريس سماوي حامد
2015-07-31 14:47                 ` Hans Hagen
2015-08-01 22:36                 ` talazem
2015-08-02  7:52                   ` Pablo Rodriguez
2015-08-02  9:20                     ` talazem
2015-08-02 10:02                       ` talazem
2015-08-02 10:47                         ` Pablo Rodriguez
2015-08-02 11:09                           ` talazem
2015-08-02 11:11                           ` Pablo Rodriguez
2015-08-03 19:14                             ` talazem
  -- strict thread matches above, loose matches on Subject: below --
2010-10-05 12:48 Talal Al-Azem
2010-10-05 13:28 ` Wolfgang Schuster
2010-10-05 14:18   ` Talal Al-Azem
2010-10-05 14:53     ` Khaled Hosny
2010-10-05 15:07     ` Wolfgang Schuster
2010-10-05 15:18       ` Talal Al-Azem
2010-10-05 15:25       ` Hans Hagen
2010-10-05 15:55         ` Talal Al-Azem
2010-10-05 16:20           ` Hans Hagen
2010-10-05 21:19   ` Hans Hagen
2010-10-05 21:50     ` Talal Al-Azem

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=D7440195-E8A1-44A7-A013-598EE94D33F8@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).