Re: Starthanging inside reverse paragraph incorrectly places distance
Aryeh Zapinsky <[email protected]> Sun, 5 Jul 2026 19:38:52 -0400
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <CAD+MA4tOaXmbz26GUP4v+MgPHbqMn8Yr0i1PnRN7ezL=e2Zwaw@mail.gmail.com> |
I took a look at spac-ver.mkxl where starthanging is defined and found the
following snippet:
\ifx\m_spac_hanging_location\v!right
\rlap{\kern\scratchhsize\kern\scratchdistance\box\nextbox}%
\else
\llap{\box\nextbox\kern\scratchdistance}%
\fi
If I replace the line with that starts with \rlap with the following:
\rlap{\box\nextbox\kern\scratchdistance}%
Then the graphic appears in the expected location when in the framed text
block (image of this attached).
This change aligns with tangential point as well, copied below and fixed to
reflect location needs to be set to left when using r2l not in a paragraph.
Also tangentially, when using r2l, location has to be set to [left] to
> place it in the correct location on the right side of the text, while using
> start paragraph where direction is reverse, the location has to be set to
> right to place it on the right side of the text.
I think the change makes sense because when the location is set to right
and the direction is reverse, the behavior should be the inverse of the
\llap.
I'm not sure how to detect if we are in an r2l snippet, or if this means
there should be an additional parameter like direction added to the
\starthanging interface, or what the standard approach would be for this
scenario, so I don't have a code suggestion.
-- Aryeh
On Fri, Jul 3, 2026 at 7:59 AM Aryeh Zapinsky <[email protected]>
wrote:
> Hi,
>
> It seems like the distance option in \starthanging puts a variable amount
> of space between the hanging content and the wrapping text. When using r2l,
> this seems to work as intended. When using in a paragraph that has
> direction=reverse set, it appears the distance is placed between the start
> of the paragraph and the hanging content and pushes up against the wrapping
> text. Anything to do to fix this?
>
> Also tangentially, when using r2l, location has to be set to right to
> place it in the correct location on the right side of the text, while using
> start paragraph where direction is reverse, the location has to be set to
> right to place it on the right side of the text.
>
> Minimal example below and screenshots attached. Any help is appreciated.
>
> -- Aryeh
>
> *Minimal example:*
> \definefontfeature[minimal][hebrew]
> \starttypescript [serif] [hebrew]
> \definefontsynonym [Serif]
> [file:/workspaces/context_lmtx/context_2/build_from_cmake_2/context_from_scratch/tex/texmf-fonts/firago/FiraGO-Regular.ttf][features=minimal]
> \definefontsynonym
> [SerifBold][file:/workspaces/context_lmtx/context_2/build_from_cmake_2/context_from_scratch/tex/texmf-fonts/firago/FiraGO-Regular.ttf][features=minimal]
> \stoptypescript
> \definetypeface [hebrew] [rm] [serif] [hebrew]
> \definetypeface [hebrew] [ss] [serif] [hebrew]
> \setupbodyfont[hebrew, 20pt]
> \setupalign[r2l]
> \setupdirections[bidi=global, method=unicode]
> \definegridsnapping[tolerant]
> \setuplayout
> [grid=normal]
>
> \starttext
>
> \startuseMPgraphic{letter_w}
> picture q;
> q := outlinetext(\MPstring{hebrew_letter}) scaled 3;
> for i within q:
> j := j + 1;
> draw pathpart i withpen pencircle scaled 2;
> endfor;
> \stopuseMPgraphic
> \starttexdefinition hangingCharacter #1
> \setMPtext{hebrew_letter}{#1}
> \hbox{\useMPgraphic{letter_w}}
> \stoptexdefinition
>
>
> \starthanging[distance=3*ex,location=left]{\snaptogrid\vbox{\hangingCharacter{חַ}}}
> י ה' וּבָרוּךְ צוּרִי בַּה' תִּתְהַלֵּל נַפְשִׁי כִּי ה' יָאִיר נֵרִי
> בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי %
> \stophanging
>
> \blank
>
> \defineparagraphs[ChaiHashemPar][n=2, direction=reverse]
> \startChaiHashemPar
> \startframedtext[width=.5\textwidth,align=flushright,strut=none]
> \starthanging[distance=3*ex,location=right]{{\hangingCharacter{חַ}}}
> י ה' וּבָרוּךְ צוּרִי בַּה' תִּתְהַלֵּל נַפְשִׁי כִּי ה' יָאִיר נֵרִי
> בְּהִלּוֹ נֵרוֹ עֲלֵי רֹאשִׁי %
> \stophanging
> \stopframedtext
> \ChaiHashemPar
> \startframedtext[width=.5\textwidth,align=flushright,strut=none]
> \starthanging[distance=3*ex,location=right]{{\hangingCharacter{יִ}}}
> שְׁלַח מַלְאָכוֹ לְפָנָי
> לְלַוֹּתִי לְוָיָה
> בְּכוֹס יְשׁוּעוֹת אֶשָּׂא פָנָי
> מְנָת כּוֹסִי רְוָיָה
> \stophanging
> \stopframedtext
> \stopChaiHashemPar
>
> \stoptext
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
Screenshot 2026-07-05 at 7.28.51 PM.png
(image/png, 13.9 KB) - not displayed