ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* RTL \definedescriptions
@ 2016-04-29  1:22 Mohammad Hossein Bateni
  2016-05-01 15:53 ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 3+ messages in thread
From: Mohammad Hossein Bateni @ 2016-04-29  1:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1359 bytes --]

Hello Hans and Wolfgang,

I tried different options in \definedescription and compared LTR and RTL
behavior.  There are certain inconsistencies/bugs in the RTL setting.
Attached you can see a TeX file and the resulting PDF, trying different
options.  The first two pages consider different parameters in the LTR
setting and then the same come in the RTL environment.

In the following I use alt instead of alternative.

Here are the issues I noticed:

1) Why isn't the head text consistently mirrored in the RTL environment?
It happens only in alt=serried.

2) Option hang=2 produces a strange result for RTL.  The hanging part
appears on the opposite side of the head text, which somehow pushes the
head text outside the text area.

3) Option alt=top for RTL still puts the head text on the left-hand side.

4) I expect the LTR and RTL versions of the same settings to mirror one
another, but they do not.   Although LTR/alt=left and RTL/alt=right look
pretty similar (and so do LTR/alt=right and RTL/alt=left), but these pairs
do not mirror one another.  In particular, there is some space to the right
of the head text in LTR/alt=right, while there is none to the left of
LTR/alt=left.  The same thing shows in the margin alternatives where the
distance between the head text and the body is different in RTL and LTR.

—MHB

[-- Attachment #1.2: Type: text/html, Size: 1557 bytes --]

[-- Attachment #2: test-d.pdf --]
[-- Type: application/pdf, Size: 20656 bytes --]

[-- Attachment #3: test-d.tex --]
[-- Type: application/x-tex, Size: 2567 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RTL \definedescriptions
  2016-04-29  1:22 RTL \definedescriptions Mohammad Hossein Bateni
@ 2016-05-01 15:53 ` Mohammad Hossein Bateni
  2016-05-01 20:37   ` Mohammad Hossein Bateni
  0 siblings, 1 reply; 3+ messages in thread
From: Mohammad Hossein Bateni @ 2016-05-01 15:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2123 bytes --]

Hans & Wolfgang,

I'm updating the RTL page <http://wiki.contextgarden.net/RTL>.  The version
used on the wiki, apparently the stable version from texlive 2015, does
certain things differently.  When using alternative=serried, the last line
of the paragraph has incorrect alignment.  This is not the case in the beta
version.

On the other hand, with bidi algorithm turned on, the wiki context places
the head on the right if I use alternative=top, only when the text is in
Persian.  In the beta, the situation is more stable but incorrect: it
places the head on the left-hand side no matter what.

—MHB

On Thu, Apr 28, 2016 at 9:22 PM, Mohammad Hossein Bateni <bateni@gmail.com>
wrote:

> Hello Hans and Wolfgang,
>
> I tried different options in \definedescription and compared LTR and RTL
> behavior.  There are certain inconsistencies/bugs in the RTL setting.
> Attached you can see a TeX file and the resulting PDF, trying different
> options.  The first two pages consider different parameters in the LTR
> setting and then the same come in the RTL environment.
>
> In the following I use alt instead of alternative.
>
> Here are the issues I noticed:
>
> 1) Why isn't the head text consistently mirrored in the RTL environment?
> It happens only in alt=serried.
>
> 2) Option hang=2 produces a strange result for RTL.  The hanging part
> appears on the opposite side of the head text, which somehow pushes the
> head text outside the text area.
>
> 3) Option alt=top for RTL still puts the head text on the left-hand side.
>
> 4) I expect the LTR and RTL versions of the same settings to mirror one
> another, but they do not.   Although LTR/alt=left and RTL/alt=right look
> pretty similar (and so do LTR/alt=right and RTL/alt=left), but these pairs
> do not mirror one another.  In particular, there is some space to the right
> of the head text in LTR/alt=right, while there is none to the left of
> LTR/alt=left.  The same thing shows in the margin alternatives where the
> distance between the head text and the body is different in RTL and LTR.
>
> —MHB
>

[-- Attachment #1.2: Type: text/html, Size: 2692 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RTL \definedescriptions
  2016-05-01 15:53 ` Mohammad Hossein Bateni
@ 2016-05-01 20:37   ` Mohammad Hossein Bateni
  0 siblings, 0 replies; 3+ messages in thread
From: Mohammad Hossein Bateni @ 2016-05-01 20:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3267 bytes --]

Hello Hans,

I looked more into this and have now "fixed" everything but the
margin-related alternatives.  In the attached file, I have redefined one
macro and two setups from strc-con.mkvi.  These involve changing three
\vtop's to \autodirvtop's as well as changing left and flushleft to right
and flushright (and the other way around) depending on paragraph direction.

Now it is possible to get the exact mirror behavior for RTL/LTR if one sets
headalign properly.  I tested it on alternatives in {left, right, top,
serried, hanging} and with hang=x option.

I have run into a dilemma, though.  Sometimes left and right retain their
meanings in LTR and RTL and sometimes they mean opposite things.  I mean,
alternative=left in RTL acts *similarly* to alternative=right in LTR;
however, headalign=left sort of has the same meaning in LTR and RTL.  This
sometimes becomes confusing in setting the macro/setup parameters.  Is
there a simple philosophy here?

—MHB

On Sun, May 1, 2016 at 11:53 AM, Mohammad Hossein Bateni <bateni@gmail.com>
wrote:

> Hans & Wolfgang,
>
> I'm updating the RTL page <http://wiki.contextgarden.net/RTL>.  The
> version used on the wiki, apparently the stable version from texlive 2015,
> does certain things differently.  When using alternative=serried, the last
> line of the paragraph has incorrect alignment.  This is not the case in the
> beta version.
>
> On the other hand, with bidi algorithm turned on, the wiki context places
> the head on the right if I use alternative=top, only when the text is in
> Persian.  In the beta, the situation is more stable but incorrect: it
> places the head on the left-hand side no matter what.
>
> —MHB
>
> On Thu, Apr 28, 2016 at 9:22 PM, Mohammad Hossein Bateni <bateni@gmail.com
> > wrote:
>
>> Hello Hans and Wolfgang,
>>
>> I tried different options in \definedescription and compared LTR and RTL
>> behavior.  There are certain inconsistencies/bugs in the RTL setting.
>> Attached you can see a TeX file and the resulting PDF, trying different
>> options.  The first two pages consider different parameters in the LTR
>> setting and then the same come in the RTL environment.
>>
>> In the following I use alt instead of alternative.
>>
>> Here are the issues I noticed:
>>
>> 1) Why isn't the head text consistently mirrored in the RTL environment?
>> It happens only in alt=serried.
>>
>> 2) Option hang=2 produces a strange result for RTL.  The hanging part
>> appears on the opposite side of the head text, which somehow pushes the
>> head text outside the text area.
>>
>> 3) Option alt=top for RTL still puts the head text on the left-hand side.
>>
>> 4) I expect the LTR and RTL versions of the same settings to mirror one
>> another, but they do not.   Although LTR/alt=left and RTL/alt=right look
>> pretty similar (and so do LTR/alt=right and RTL/alt=left), but these pairs
>> do not mirror one another.  In particular, there is some space to the right
>> of the head text in LTR/alt=right, while there is none to the left of
>> LTR/alt=left.  The same thing shows in the margin alternatives where the
>> distance between the head text and the body is different in RTL and LTR.
>>
>> —MHB
>>
>
>

[-- Attachment #1.2: Type: text/html, Size: 4267 bytes --]

[-- Attachment #2: p-dabeer-patch-strc-con.mkiv --]
[-- Type: application/octet-stream, Size: 2946 bytes --]

%% These are a few experimental patches to make strc-con.mkvi (and as
%% a result strc-des.mkiv and strc-enu.mkiv) behave better in RTL
%% settings.  I advise you to not use this file unless you know what
%% you are doing.

\unprotect

%% I use these to set headalign keys, so that they mirror in RTL and
%% LTR settings.  They cannot be used everywhere, though, and I guess
%% that may have to do with expansions.
\define\autodirleft{\ifconditional\displaylefttoright\v!left\else\v!right\fi}
\define\autodirright{\ifconditional\displaylefttoright\v!right\else\v!left\fi}

% Patching macros defined in tex/context/base/mkiv/strc-con.mkvi
\unexpanded\def\boxedconstructionhead#1%
  {\autodirvtop
   %\vtop
     {\hsize\constructionsheadwidth
      \edef\p_strc_constructions_headalign{\constructionparameter\c!headalign}%
      \ifx\p_strc_constructions_headalign\empty \else
        \setupalign[\p_strc_constructions_headalign]% \use...
      \fi
      #1}}


\startsetups[\??constructionrenderings:\v!left:\v!hanging]%
\ifconditional\displaylefttoright
    \let\\=\crlf
    \dontcomplain
    \advance\constructionsheadwidth \constructionsheaddistance
    \strc_constructions_set_hang_box\v!flushleft
    \strc_constructions_set_hang\v!left
    \noindent
    \llap {
        \autodirvtop to \zeropoint {%
            \box\constructionheadbox
        }
    }
    \nobreak
    \useconstructionstyleandcolor\c!style\c!color
    \ignorespaces
\else
    \let\\=\crlf
    \dontcomplain
    \advance\constructionsheadwidth \constructionsheaddistance
    \strc_constructions_set_hang_box\v!flushright  %%
    \strc_constructions_set_hang\v!right %%
    \noindent
    \llap {
        \autodirvtop to \zeropoint {
            \box\constructionheadbox
        }
    }
    \nobreak
    \useconstructionstyleandcolor\c!style\c!color
    \ignorespaces
\fi
\stopsetups


\startsetups[\??constructionrenderings:\v!right:\v!hanging]%
\ifconditional\displaylefttoright
    \let\\=\crlf
    \dontcomplain
    \advance\constructionsheadwidth \constructionsheaddistance
    \strc_constructions_set_hang_box\v!flushright
    \strc_constructions_set_hang\v!right
    \noindent
    \rlap {
        \hbox to \dimexpr\hsize-\leftskip-\rightskip\relax {
            \hss
            \vtop to \zeropoint {
                \box\constructionheadbox
            }
        }
    }
    \nobreak
    \useconstructionstyleandcolor\c!style\c!color
    \ignorespaces
\else
    \let\\=\crlf
    \dontcomplain
    \advance\constructionsheadwidth \constructionsheaddistance
    \strc_constructions_set_hang_box\v!flushleft  %%
    \strc_constructions_set_hang\v!left %%
    \noindent
    \rlap {
        \hbox to \dimexpr\hsize-\leftskip-\rightskip\relax {
            \hss
            \vtop to \zeropoint {
                \box\constructionheadbox
            }
        }
    }
    \nobreak
    \useconstructionstyleandcolor\c!style\c!color
    \ignorespaces
\fi
\stopsetups

\protect

[-- Attachment #3: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-01 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29  1:22 RTL \definedescriptions Mohammad Hossein Bateni
2016-05-01 15:53 ` Mohammad Hossein Bateni
2016-05-01 20:37   ` Mohammad Hossein Bateni

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).